Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Class
Last updated at 1:00 pm UTC on 20 December 2005
A class defines the structure and behavior of it's instances.

It holds a collection of the names of instance variables instances have.
printIt - Class instanceVariablesString.

A class holds a MethodDictionary, mapping messages to Method Statementss. These methods are precisely what is updated when you accept code in the code pane. This dictionary is also where the virtual machine looks for the code to run for a message.
InspectIt - Point methodDict

Classes take care of lots of details - having a name that's global in the system (that's why writing "Point" above worked), keeping track of variables known to all the classes' instances.

Many of the most important things classes know, they inherit from their superclass Behavior.
It is Behavior that holds the method dictionary, and keeps track of the classes' superclass (see Inheritance).
Playing with Behavior is one of the ways that Squeak lets us do radical things like playing with other representations of objects (for example, Objects without classes - aka, prototype systems).

After you're comfortable with classes, you should investigate Metaclasses. In a way, they're sort of "the Dark Side of the class". OTOH, they help classes be objects themselves.


From theclass comment:

This class adds a number of facilities to those in ClassDescription:

The instances describe the representation and behavior of objects. More comprehensive programming support facilities are added to the basic attributes of Behavior and the descriptive facilities of ClassDescription.

The slot 'subclasses' is a redundant structure. It is never used during execution, but is used by the development system to simplify or speed certain operations.


See also How to get the class object if the name is given as a string