Hitchhikers Guide to Squeak
Last updated at 7:12 pm UTC on 4 December 2007
If you download the current Squeak distribution (Squeak 3.8 at the time of this writing) it again looks like a toy. This is a short tutorial showing you how to use and customize Squeak and create a full fledged Smalltalk IDE out of it.
Download and Install Squeak
Just visit http://www.squeak.org to download a full package of the lates release for your platform and start the Squeak image with the VM.
You can also grab the latest relase from http://ftp.squeak.org. There are also separate downloads for the platform specific virtual machines and the platform independent image file.
Here are the steps if you want to run Squeak on a Windows machine and follow this tutorial:
Now run Squeak by starting the image with the virtual machine (VM). You can either do this by dragging the Squeak image file "Squeak3.8-6665full.image" onto the VM executable ("Squeak.exe") or by double clicking the VM executable. The first one is a little bit faster since the VM now knows wich image file to use and does not search for an appropriate image file in the current directory. You can also associate the ".image" file extension with the virtual machine.
Updating the image
After startup you may get asked if you want check for updates. If you want to get the latest stuff for your release hit "Yes, Update". If you find the question annoying just click on "Don't ask again"
Whenever you wish, you may choose 'update code from server' from the 'help...' menu off of the World Menu.
The mechanism to update Squeak is described in detail in the "Code updates" section of this swiki.
Play with Squeak
If you use a standard Squeak image from the distribution you may ask yourself: what is it? A toy? That's not looking like an IDE. All these colours and where are the tools? Be patient!
A standard image starts up with something like a beginners view for first time users. Play with Squeak - it's the best way to explore the environment. Read the Introduction provided in the "Welcome Workspace" and try the examples. You can also study some of the online Introductions to Squeak. Note that Squeak itself is implemented using the Smalltalk programming language. If you want to learn Smalltalk I would recommend to download the free online Smalltalk books.
Stop looking like a toy
After playing with Squeak for a while we first want to get rid of all the windows and toy like stuff inside the standard image. So first close all windows you see in the environment. Now we want to get rid of the Squeak Logo. Just click on it while pressing the command key (which is the ALT-key on Windows). So just hold ALT and click on the graphic. The logo is now surrounded by a so called "Halo"
If you click on the upper left Halo button the logo will disappear. It is moved to the Squeak trash can. Double click the trashcan and click on 'E' to empty the trash can. To remove the trash can itself open it's Halo and delete the morph.
And finally we want to hide the colored bars (called Flaps) used to provide a quick access objects and tools from the Squeak desktop. So right click on the squeak desktop and disable the shared flaps in the context menu. As you see in the context menu you can alternatively hold down the command key (ALT on windows) and press SHIT+F. This key command will enable/disable the global flaps too.
Beside updating the image over the internet it is possible to download and install Squeak software over the network. Open the World menu and click on open... and then SqueakMap Package Loader. This little tool let you access all Squeak software packages registered on SqueakMap (SM) and install them from within the Squeak image. SqueakMap is a catalogue over hopefully all code ever written in the Squeak Smalltalk dialect.
There is also a web interface for SqueakMap at http://map1.squeakfoundation.org/sm where you can register own packages and make them widely available.
When you open the SM Package Loader the first time Squeak will create a directory called "sm" in the image directory and cache the available package map. If you may have trouble with SqueakMap caused by corrup downloading, etc. it can often be helpfull to delete this directory. When you open a new SM Package Loader it will automatically be created.
Now let's use the Package Loader to install the package "LookEnhancements", either lookup the package in the package list or enter a phrase into the search pane (like "LookEnh" as in the above image) and hit ENTER to search for an appropriate package. Hitting ENTER again will show the next matching package.
Right click to open a context menu where you can select "install" to download and install the package.
Now close all windows and open the package loader again. You will notice that it's user interface (UI) look has changed.
You can modify the UI behavior through different settings in Squeak. Therefore open the Squeak preference panel by selecting appearance and preferences... from the World menu. Again you can enter a search phrase to lookup a Preference. Enter Round and hit ENTER.
As a result you get all matching preferences. Now enable roundedMenuCorners and roundedWindowCorners and close the Preference tool after that. I typically also the resizeOnAllSides preference in the windows preference category.
First coding steps
Using the Smalltalk programming language we can access the whole system. The easiest way to accomplish this is to open a workspace and type in some Smalltalk code. Select open... and Workspace from the World menu. Alternatively you can use the command key and 'K' (so use ALT+K if you run Squeak on a Windows operating system). A new Workspace window will appear.
You can use a workspace to enter Smalltalk expressions and run them. Let's enter Workspace open in the text pane, select it using the mouse and select "do it" from the workspace context menu (which can be opened by right clicking into the text area of the workspace).
A new Workspace window will open. We have instructed Squeak to open a new workspace just by writing this little script and running it.
Let's do something more: type in the expression 3+4 in the second workspace, again select it and choose "do it" again. Nothing happened. Why? We have instructed Squeak to calculate 3+4 and Squeak did exact this. Nothing more! While our first expression "Workspace open" had some visual feedback (a new workspace window appeared) we have no visual feedback for this simple calculation.
So let's select 3+4 again and choose "print it" from the context menu. Squeak will again evaluate the expression and now print the resulting object in the workspace.
So while "do it" just runs our code the "print it" workspace command will run it and print the result.
A third option is to use "inspect it" which runs the code and open an inspector window on the result.
Here is a short summary for evaluating code in workspaces:
|do it||ALT+D||run the code|
|print it||ALT+P||run the code and print the result|
|inspect it||ALT+I||run the code and inspect the result|
Colors in workspace - Syntax highlighting
Browsing the environment
Squeak provides full source code access to the underlying Smalltalk programming language.