SDSU CS 535 Object-Oriented Programming
Fall Semester, 2003
Some Code Management
Previous    Lecture Notes Index    Next    
© 2003, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 07-Oct-03

Contents of Doc 11, Some Code Management



Reference

VisualWorks Application Developer Guide, doc/vwadg.pdf in the VisualWorks installation. Chapter 8 Managing Smalltalk Code



Doc 11, Some Code Management Slide # 2

Change File – Change List Browser


Smalltalk records all changes you make in the .cha file

You can


View Your Change file

In the launcher select the “Change List” item in the “Tools” menu.


This will open an empty Change List browser.




Doc 11, Some Code Management Slide # 3
In the Change List browser select the “Recover Last Changes” item from the “File” menu.



A dialog window will show you a list of dates & times the image has been saved. You can select how far back you wish to view the changes.



Doc 11, Some Code Management Slide # 4
Once you have done that you can view the changes. They are listed in the upper left pane of the change list browser. You can also filter which changes you view. You can scroll to find methods of interest. You can use the “Find” menu help find methods & classes of interest. Below I found the method testRotate and clicked on “selector” to the right, which limits the view to the changes to the method. By deselecting “selector” I get the original list of changes. Items in the “Replay” menu can be used replay a version of a method.


You can see the difference between the version of the method selected and the current version. In the Change List browser’s “Show” menu select the “Show Conflicts” item.




Doc 11, Some Code Management Slide # 5
When you do this the lower text pane splits in two. On showing the version you selected, the other showing current version of the method. Differences are highlighted in color.


Doc 11, Some Code Management Slide # 6

Local Changes – Change Sets


There are times when you may wish to keep separate list of changes. For example you may want a list of changes related to assignment 4. We will see several reasons for doing this soon. You can do this in a change set, which just keeps a list of selected changes for you. Changes sets do not affect the .cha file in any way. All changes are still saved to the .cha file. Change sets just allow you to have a list of changes related to a particular project.

To create a new change set the “Change Sets” item in the “Changes” submenu of the “System” menu of the launcher.



This opens up the Change Sets window. Now select the “Add..” item in the “ChangeSet” menu in the Change Sets window.



You will get a dialog window. In the window give your change set a name.



Doc 11, Some Code Management Slide # 7
After you click “OK” your change set will be created. Make sure that change set you created is selected in the Change Set window. This makes it the current changes set. All new methods and changes to existing methods will be recorded in the change set. The changes are also stored in the .cha file.




Doc 11, Some Code Management Slide # 8
Viewing the contents of a Change Set

There are several ways to view the contents of a change set. One is to select the “Browse..” item of the “ChangeSet” menu in the Change Set window. This opens a standard browser on the changes. You can also select the “Edit..” item of the “ChangeSet” menu in the Change Set window. This opens a “Change Set Editor, which allows you to move items between change sets. Sometimes one forgets and methods get added to the wrong change set.



An historical reason to Use Change Sets

Note that you can file out a change set and file in a change set. This allows you to work on assignment 4 at home, file out the change set (a small file) and bring the change set to school or work. Once there you can file in the change set and have the code you were working on without having to bring the entire image. Note people use parcels and packages for this now.

Doc 11, Some Code Management Slide # 9

Parcels & Packages


Parcels and packages allow you to group Smalltalk code

A parcel can contain


A method in a parcel can belong to a class not in the parcel

A method in a parcel can override a method not in the parcel

A parcel includes:

Parcels can be


When a Parcel is unloaded overridden methods revert back to original unoverridden version


Doc 11, Some Code Management Slide # 10
Parcel verses Package

A Package is basically the format for a parcel so it can be stored in a version control system

VisualWorks version control system is called Store

Store


Doc 11, Some Code Management Slide # 11
Why do we need Parcels?

Case 1
Add a method foo to the String class

Create a program that uses foo

Send program code to a user, but forget to send foo

User complains that program does not work


Case 2

Modify an existing method in String class

Create a program that uses the modified method

Send the program to someone else

User loads the program, tries it, then removes your classes

Modified method in String class still exists in their image


Doc 11, Some Code Management Slide # 12
How to create a Parcel

Open a System Browser. Select the “Parcel” item in the “Browser” menu in a System Browser. The browser will now show the Parcel view of the code.


Select the “New..” item in the “Parcel” menu of the System Browser. This menu only exists in the Parcel view.


You will get dialog window asking for the name of the parcel. Below is the Parcel view after adding a parcel called CS535. The left most pane is a list of the parcels.


Doc 11, Some Code Management Slide # 13
Standard Operating Procedure

One common problem among beginners is adding methods to existing classes and forgetting to ship those methods with the rest of your code. One way to avoid doing this is to use change sets. Say you are working on assignment 5. Create a change set called Assignment5Changes and create a parcel for your code. Now add all your methods. When done you can add your change set to the parcel. Select the parcel in the browser. Select the “Add Changes” item in the “Build” submenu of the Parcel menu in the browser. This will add all methods in the change set to the Parcel. Once you have done that you can save your parcel in a separate file by using the “Save” item in the Parcel menu in the browser.



Copyright ©, All rights reserved.
2003 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

Previous    visitors since 07-Oct-03    Next