Smalltalk is completely object-oriented;
more than other OO programming languages claim to be. In its design
there is no compromise between objects and machine-dependent
types (strings, number representations, ...). Everything is an object!
What is an object anyway?
- Objects have a number of state variables. Example: a telephone knows
of its colour, number.
- Every object is unique, thus we can access an object by its unique
identification. Think of something like car plates or telephone numbers.
- Every object is of a specified class. A class is just
the meta information that defines objects. A class can actually create
new objects (named instances) of its type.
- Objects do respond to messages, which may take parameters
or not.
- Further, we need to consider an object's lifetime,
that is, the duration of the existence of the object, starting with
its creation, lasting till its destruction. You control it!
Others? There are none, thus everything is an object. A Smalltalk
program lives in an environment full of objects. It does only see
objects and sends messages to them following your programming code,
then, waits for the message to return and continues.
Why objects?
You may have wondered why there is a need for such things like object-oriented
programming. Considering MolTalk as an application
of object-oriented programming it jumps right
at your eyes: once you know an object's identifier you can access
all of its information by simply sending messages to it. Objects can
ideally represent the hierarchical organisation of information stored
in macromolecular structures.
moltalk@moltalk.org version of this document: V3.0