29.11.2014 Views

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

If the file does not exist you will raise <strong>an</strong> exception “File not found”. Otherwise the result of filing in<br />

the file will be printed in the System Tr<strong>an</strong>script window.<br />

15.4 Ch<strong>an</strong>ge list<br />

15.4.1 The ch<strong>an</strong>ges file<br />

To underst<strong><strong>an</strong>d</strong> the use of the ch<strong>an</strong>ges list tool, you must first underst<strong><strong>an</strong>d</strong> the signific<strong>an</strong>ce of the ch<strong>an</strong>ges<br />

file. This is a system provided file which has a .cha extension (<strong><strong>an</strong>d</strong> is named after the image, for<br />

example, if the image is named Visual.im then the ch<strong>an</strong>ges file will be named Visual.cha). The<br />

ch<strong>an</strong>ges file is always located in the same directory (folder) as the image file (<strong><strong>an</strong>d</strong> should never be<br />

m<strong>an</strong>ually moved).<br />

This file lists all the ch<strong>an</strong>ges which have been made to VisualWorks for the current image. That is,<br />

all the ch<strong>an</strong>ges to existing classes <strong><strong>an</strong>d</strong> methods as well as all new classes <strong><strong>an</strong>d</strong> methods which have been<br />

defined. It also records all the actions that have created objects <strong><strong>an</strong>d</strong> sent messages in the image. Thus as<br />

you develop a system within <strong>an</strong> image, your ch<strong>an</strong>ges file grows - each time you make a ch<strong>an</strong>ge it is<br />

recorded.<br />

In fact, if you m<strong>an</strong>ually move your ch<strong>an</strong>ges file <strong><strong>an</strong>d</strong> then attempt to view the code you have written<br />

you will find that VisualWorks says that it c<strong>an</strong>’t find the ch<strong>an</strong>ges file <strong><strong>an</strong>d</strong> wi ll have to disassemble your<br />

code. This is <strong>an</strong> indication that VisualWorks uses the ch<strong>an</strong>ges file to store the actual source of the<br />

compiled byte encoded class <strong><strong>an</strong>d</strong> method definitions.<br />

The main use of the ch<strong>an</strong>ges file, however, is as a recovery aid. It allows a sequence of ch<strong>an</strong>ges to<br />

be replayed. This may be done following a system crash, or following the accidental deletion of a class<br />

or method. The result is that, even if you did not save your work before a system crash, you c<strong>an</strong> get<br />

back to where you were by replaying the ch<strong>an</strong>ges file. This is done using the Ch<strong>an</strong>ge List tool.<br />

15.4.2 Viewing <strong><strong>an</strong>d</strong> replaying the ch<strong>an</strong>ges file<br />

The Ch<strong>an</strong>ge List tool (illustrated in Figure 15.3) is used to view the contents of t he ch<strong>an</strong>ges file. It is<br />

made up of:<br />

• a scrollable list selection (referred to as the ch<strong>an</strong>ges view),<br />

• a set of selection boxes which allow the user to restrict the display of past ch<strong>an</strong>ges (for example in<br />

Figure 15.3 the l ist has been restricted to references to the same class, in this case the MyClass<br />

class.<br />

• a code display area where the result of the ch<strong>an</strong>ge (if <strong>an</strong>y) is displayed. In Figure 15.3 the result of<br />

editing the age method is presented.<br />

125

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!