Most of the following is text. This is a deliberate choice, as it is easy to edit, provides a lowest common denominator for all browsers, and makes the page easily indexable by search engines. For more visual presentations, see:
The Squeak homepage is http://www.squeak.org (mirrored at http://squeak.cs.uiuc.edu/). Download it from there, and unpack the archive. There will be a Squeak executable, which you can run directly.
This is all you need to know if you just want to play around. Further instructions for using Squeak in the labs are below.
After you've gotten Squeak running, you will probably want to do save your system as a fresh image file and then begin working in your own project. Read the notes below on using Squeak and saving your work for more details.
The version used in the Mark Guzdial text is 2.7; the CD included with the book has both 2.7 and 2.8 on it. The current released version is 3.8. If you want to use the examples in the book with minimal confusion, use 2.7. If you want to have the latest bells and whistles, and don't mind adjusting yourself mentally to the new environment (which uses the Morphic library much more heavily), then use Squeak 3.8.
However, probably all of the examples used in lecture will work on any of these versions. The Squeak language (as opposed to the Squeak environment) is basically vanilla Smalltalk, and is the same across all Squeak versions.
Squeak is stored in c:\Program Files\squeak. Double-click on the mouse to start. You can make any changes you want to Squeak, but when you log out, all of your files on C: will be wiped clean -- so if you make any changes you care about, file out the changes and put the fileout file on a server.
Alternatively, you can get your own copy of Squeak and work out of your network home directory. Then you can save your workspace when you quit, and resume right where you left off. Here's how:
Instructions are pretty much as above (for working out of your network home directory), except you don't have to map any network drives or such. Just download Squeak, extract the archive to its own folder, and run it. You will want to see the notes about saving changes below, so that you can bring things back and forth between school and home. This will be particularly crucial for demos of class projects.
I discourage you from using the instructional Linux servers, as running an entire Squeak environment for many users on the servers will probably overload them. However, if you want to try out Linux Squeak, then:
Audio will not work (X servers do not currently transmit audio over the network).
Instructions are as above, but obviously you do it on your own machine, not on the servers. Squeak will run substantially faster, and audio will probably work (although Squeak tries to monopolize your sound card, so you may want to disable sound).
The Guzdial book, starting in Chapter 2, describes the Squeak environment pretty well. However, it takes a while to get into the details of the environment, so here's a quick start guide to getting all the pretty Squeak garbage out of the way so that you can code:
Here are color-to-button mappings for (Also on the bottom of p. 42 in the Guzdial book).
Macintosh: |
![]() |
Windows: |
![]() |
Unix:(or any 3-button mouse) |
![]() |
I will refer to mouse buttons by color throughout this document.
Note: the following is taken more or less directly from Guzdial section 2.4. You may find his more verbose instructions (with illustrations) more helpful, or you may find them just verbose. Compare and see.
x := 3 + 4.
You can actually do this from the workspace, but you don't want to. Instead, use the system browser:
Object subclass: #NameOfClass instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Keunwoo'In general, when you click on a class category, a fresh class template will appear in the bottom browser pane.
message selector and argument names "comment stating purpose of message" | temporary variable names | statements"-- all --" is a method category. In general, when you click on a method category, a fresh method template will appear in the bottom browser pane.
showMe: aValue for: numTimes "Prints aValue to the Transcript numTimes." numTimes timesRepeat: [ Transcript show: aValue; cr ].Type Alt-s to accept this method. Fix any typos you made.
x := Foobar new. x showMe: 'hi' for: 5.and Alt-d it.
That's it for the basics of creating classes, creating methods, and running code. Refer to Guzdial or the Squeak documentation (UIUC mirror) for further information.
Because Squeak is such an insular environment, saving your work and sharing it with others can be a bit of a hassle. There are many ways to save your work, and they are appropriate in different situations...
Red-click on the Squeak desktop. Select "save". Your system's "image" will be saved in the Squeak directory. If you start Squeak again from that system image, you will recover the entire environment, including any source code changes you have made.
Image files actually deserve some more comment, and you should definitely read the discussion of them at the beginning of Guzdial 2.4. For the purposes of this class, you probably want to create your own image, leaving the old system image alone. To do this, red-click the Squeak desktop and select "save as..." and type a new name---e.g., keunwoo.image.
The next time you run Squeak, pass it the name of the image at the command line:
./squeak keunwoo.image
In Windows, you can do this by dragging and dropping your image file onto the Squeak executable. Your system image will be recovered from this file.
Do not lose or delete your system image! All your work is stored in this image. However, if you create your own image/changes files, you probably should delete the original Squeak system image and changes files (e.g. Squeak-2.7.image and Squeak-2.7.changes) in order to save space in your home directory.
By the way, if you want to transport your whole system from one machine to another, then make sure you copy both the .image file and its corresponding .changes file. For the example above, I would copy both keunwoo.image and keunwoo.changes.
There are two easy ways:
Either way, a text file in Macintosh-format (grrr!) will appear in the directory in which you launched Squeak.
If you want to read a file that has been "filed out", red-click the Squeak desktop and "open..." -> "file list". A very ugly typical graphical file browser window will pop up. Red-click on file names in the upper-right panel, then yellow-click to bring up the context menu for files. If you select "fileIn", you will be able to read a .st (SmallTalk) file as code.
Filing out individual classes or class categories only goes so far. You can group larger sets of changes into a "change set", which can then be filed out as a file with the .cs extension.
There are lots of ways to group changes into a change set, but what you probably want to do most is to save all of a given project's changes to a change set, and load those changes somewhere else.
Assuming you have a project named "Keunwoo-Coding", you can create a change set based on all the changes in this project as follows:
Be warned that you can make bad things happen while browsing around with change sets: I brought up a window and tried to examine a class that no longer existed, resulting in a big chain of errors that eventually crashed the window.
Changes that are loaded from a change set are treated like any other changes you make; if you want them to be logged under a project, open that project and fileIn the change set while inside that project. Otherwise, they will be logged as an "UnnamedN" change set, where N is the number of unnamed change sets currently in your image.