Skip to main content
Engineering LibreTexts

6.8: Change Sets and the Change Sorter

  • Page ID
    38005
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)

    Whenever you are working in Squeak, any changes that you make to methods and classes are recorded in a change set. This includes creating new classes, re-naming classes, changing categories, adding methods to existing classes — just about everything of significance. However, arbitrary doits are not included, so if, for example, you create a new global variable by assigning to it in a workspace, the variable creation will not make it into a change set.

    At any time, many change sets exist, but only one of them — ChangeSet current — is collecting the changes that are being made to the image. You can see which change set is current and can examine all of the change sets using the change set browser, available from World ⊳ open... ⊳ simple change sorter or by dragging the Change Set icon out of the Tools flap.

    Figure \(\PageIndex{1}\) shows this browser. The title bar shows which change set is current, and this change set is selected when the browser opens.

    The Change Set Browser.
    Figure \(\PageIndex{1}\): The Change Set Browser.

    Other change sets can be selected in the top-left pane; the yellow button menu allows you to make a different change set current, or to create a new change set. The top-right pane lists all of the classes affected by the selected change set (with their categories). Selecting one of the classes displays the names of those of its methods that are also in the change set (not all of the methods in the class) in the central pane, and selecting a method name displays the method definition in the bottom pane. Note that the browser does not show you whether the creation of the class itself is part of the change set, although this information is stored in the object structure that is used to represent the change set.

    The change set browser also lets you delete classes and methods from the change set using the yellow button menu on the corresponding items. However, for more elaborate editing of change sets, you should use a second tool, the change sorter, available under that name in the Tools flap or by selecting World ⊳ open... ⊳ dual change sorter, which is shown in Figure \(\PageIndex{2}\).

    The Change Sorter.
    Figure \(\PageIndex{2}\): The Change Sorter.

    The change sorter is essentially two change set browsers side by side; each side can focus on a different change set, class, or method. This layout supports the change sorter’s main feature, which is the ability to move or copy changes from one change set to another, as shown by the yellow button menu in Figure \(\PageIndex{2}\). It is also possible to copy individual methods from one side to the other.

    You may be wondering why you should care about the composition of a change set. the answer is that change sets provide a simple mechanism for exporting code from Squeak to the file system, from where it can be imported into another Squeak image, or into another non-Squeak Smalltalk. Change set export is known as “filing-out”, and can be accomplished using the yellow button menu on any change set, class or method in either browser. Repeated file outs create new versions of the file, but change sets are not a versioning tool like Monticello: they do not keep track of dependencies.

    Before the advent of Monticello, change sets were the main means for exchanging code between Squeakers. They have the advantage of simplicity (the file out is just a text file, although we don’t recommend that you try to edit with a text editor), and a degree of portability. It’s also quite easy to create a change set that makes changes to many different, unrelated parts of the system — something that Monticello is not yet equipped to do.

    The main drawback of change sets, compared to Monticello packages, is that they do not support the notion of dependencies. A filed-out change set is a set of actions that change any image into which it is loaded. To successfully load a change set requires that the image be in an appropriate state. For example, the change set might contain an action to add a method to a class; this can only be accomplished if the class is already defined in the image. Similarly, the change set might rename or re-categorize a class, which obviously will only work if the class is present in the image; methods may use instance variables that were declared when they were filed out, but which do not exist in the image into which they are imported. The problem is that change sets do not explicitly describe the conditions under which they can be filed in: the file in process just hopes for the best, usually resulting in a cryptic error message and a stack trace when things go wrong. Even if the file in works, one change set might silently undo a change made by another change set.

    In contrast, Monticello packages represent code in a declarative fashion: they describe the state of the image should be in after they have been loaded. This permits Monticello to warn you about conflicts (when two packages require contradictory final states) and to offer to load a series of packages in dependency order.

    In spite of these shortcomings, change sets still have their uses; in particular, you may find change sets on the Internet that you want to look at and perhaps use. So, having filed out a change set using the change sorter, we will now tell you how to file one in. This requires the use of another tool, the file list browser.


    This page titled 6.8: Change Sets and the Change Sorter is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by Andrew P. Black, Stéphane Ducasse, Oscar Nierstrasz, Damien Pollet via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.