As in other object-oriented languages, the central concept in Smalltalk-80 (but not in Smalltalk-72) is that of an ''object''.
An object is always an 'Instance' of a 'Class. Classes are "blueprints" that describe the properties and behaviour of their instances.
For example, a GUI's window class might declare that windows have properties such as the label, the position and whether the window is visible or not. The class might also declare that instances support operations such as opening, closing, moving and hiding.
Each particular window object would have its own values of those properties, and each of them would be able to perform operations defined by its class - wikipedia ![]()
A Smalltalk object can do exactly three things: - Hold state (references to other objects). - Receive a message from itself or another object. - In the course of processing a message, send messages to itself or another object.
The state an object holds is always private to that object. Other objects can query or change that state only by sending requests (messages) to the object to do so. Any message can be sent to any object: when a message is received, the receiver determines whether that message is appropriate.
Alan Kay has commented that despite the attention given to objects, messaging is the most important concept in Smalltalk:
The big idea is 'messaging'—that is what the kernel of Smalltalk/Squeak is all about (and it's something that was never quite completed in our Xerox PARC phase)Prototypes vs Classes in squeakfoundation.org
Smalltalk is a "pure" object-oriented programming language, meaning that, unlike Java (Java (programming language)) and C++, there is no difference between values which are objects and values which are primitive types. In Smalltalk, primitive values such as integers, booleans and characters are also objects, in the sense that they are instances of corresponding classes, and operations on them are invoked by sending messages. A programmer can change or extend (through subclassing (Subclass (computer science))) the classes that implement primitive values, so that new behavior can be defined for their instances—for example, to implement new control structures—or even so that their existing behavior will be changed. This fact is summarized in the commonly heard phrase "In Smalltalk everything is an object", which may be more accurately expressed as "all values are objects", as variables are not.
Since all values are objects, classes (class (computer science)) themselves are also objects. Each class is an instance of the ''metaclass'' of that class. Metaclasses in turn are also objects, and are all instances of a class called Metaclass. Code block (#Code blocks)s—Smalltalk's way of expressing anonymous functions—are also objects.[ Smalltalk-80 The Language]