The Squeaky way of Code
Last updated at 10:21 am UTC on 3 November 2005
Squeak, being a development environment, has an intense interest in code. It holds code (lots of it), it performs code, and it shows it to us users.
In fact, probably the most common activities in Squeak are looking at code and messing around with it. And everybody does these things - you do it whether you're writing a primitive, your first Hello World or squinting at an error message.
If you want to do more than just Play With Things #N, you want to understand what code is like in Squeak. BTW, the ideas described here apply to other Smalltalks as well, though the details differ.
If you're familiar with programming environments for other languages and find Squeak's confusing, maybe you'd like to know How to get from Java or C++ or your favorite OO IDE to Squeak
What is code?
Code is what tells Squeak how to do things.
The description of code in Squeak results from a collaboration of many classes. But the heroes of this story are definitely classes, methods and blocks.
Here's a short description of how they work together. Lots more of the precise details are in each term's page.
A Class describes what a bunch of similar objects (called its instances) are like. The most important thing all these object have in common, is that when they are sent a message they understand, they all act similarly - they run the same Method Statements.
A Method Statements is a description of how an object receiving a certain question should respond. It's similar in some ways to a cue card - it tells the object (in its own terms) how to respond to a certain request. Each Class holds a MethodDictionary, which holds for each message the appropriate Method Statements.
Sometimes one object will want to pass another object not a mere request, but a specification of how to do something. Not "Pass me the fork, please" (where the receiver should know about getting forks) but more along the lines of "move arm 10 degrees right, then lower it 10 cm..." where the receiver is a robot arm. To do that, Squeak has Blocks of code that can be passed around. These may seem a simple variation on Method Statements, or something useful mostly for tricks, but they are very important, and a basic piece of what makes Squeak beautiful.
Other facilities that help us code Squeak:
The Browser is the main user interface to these riches.
The ChangeSet and its tools let us manage our every tweak and addition.
The busy trinity - Scanner, Parser and Compiler are the algorithmic workhorses that let Squeak read Smalltalk.
And of course, the Virtual Machine (Overview) that makes it all
Squeak way of Code in anoter OO-Languages
XOTclIDE - Squeak like reimplemtation in XOTcl