=== Top of the Swiki === Attachments ===
The Squeaky way of Code
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/C++/(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 terms' 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.
A Method is a description of how an object recieving a certain question should respond. It's similar in some ways to a que card - it tells the object (in it's own terms) how to respond to a certain request. Each Class holds a MethodDictionary, which holds for each message the appropriate Method.
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 reciever should know about getting forks) but more along the lines of "move arm 10 degrees right, then lower it 10 cm..." where the reciever is a robot arm. To do that, Squeak has Blocks of code that can be passed around. These may seem a simple variation on Methods, 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 it's 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 that makes it all go 'round.