On a fresh Cuis-Smalltalk installation, each code you edit in the System Browser is recorded in a Change Set,
You browse a change set with a tool named the Change Sorter:
...World menu → Changes...
→
Change Sorter
...
The TheBook
class we added to Cuis-Smalltalk in the previous section
is a change made to the core of the system. By default, it is recorded
in a change set automatically created by the system. In
Figure 9.3 at the top right, observe the class
TheBook
, it belongs to a change set named
4439-CuisCore-AuthorName-2020Nov16-13h40m
. In the left pane,
each unsaved change set is marked with a --->
. Here it tells us
the change was not saved on disk. To save the change set, just use its
contextual menu and use one of the file out
entries. The change
set will be saved along the Cuis-Smalltalk image under its system name with
AuthorName
substituted with the real author name.
Observe Figure 9.4, after we added the method
pages
to the TheBook
class, the middle pane lists the
added or modified methods. When a method is selected its source code
is printed in the bottom pane.
Let’s say we save the change set – File out
entries in the
change sorter tool menu. This creates a new file
4451-CuisCore-HilaireFernandes-2020Nov14-21h08m-hlsf.001.cs.st
along the Cuis-Smalltalk image file:
From Cuis 5.0 [latest update: #4450] on 18 November 2020 at 9:05:09 am'! !classDefinition: #TheBook category: 'TheCuisBook'! Object subclass: #TheBook instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TheCuisBook'! !TheBook methodsFor: 'as yet unclassified' stamp: 'hlsf 11/18/2020 09:04:58'! pages ^ 151! !
To load this change set back in a new image, you use the File
List tool ...World menu → Open
→
File List
... Browse the folder containing the change set file
to load, then select it, from there you have three options to
manipulate it.
code
. It opens a kind of System Browser limited to
the code in the change set file. It is a very handy tool to read and
to learn the code from the change set.
contents
. It opens a Change List tool to review
the modifications to the image this change set will produce once
installed. It also let you cherry pick the individual changes you
want to install and to discard. Each line you cherry pick represents
a class or a method addition/modification. Once you select the code
to install, press the file in selections
button to proceed
with the installation.
Consider a co-developer modifying the TheBook
class, she
added an instance variable pages
and adjusted the
pages
methods accordingly. She filed out her changes then
shared the file with you. Observe in Figure 9.6 how you
will review her changes with the Change List tool. Our code that
will be removed from the image is shown in red stroked, and her code
that will be installed is shown in green.
install
. It just installs the complete change set
without interactivity.
The change set way of managing the source code is used by the developers of Cuis-Smalltalk, to work on its core image. When you want to write an application, a dedicated tool or even a set of classes covering a specific domain, you really want to use something else to manage the code: a package.