What is an Object?
At the simplest level, an object is just an area of your computer's memory that contains some data bytes describing the object's state. For example, an object representing the text string, 'hello', would contain (amongst other things) the bytes:
104 101 108 108 111
Here each byte, of course, represents one character in the string. However, every object also contains additional information that allows it to "know" what kind of object it is. How this knowledge is encoded as part of the object is not relevant at this stage, but it is very important since it allows the object to determine how it should behave. For example, if we have two objects that are numbers it seems quite reasonable that we should be able to subtract one from the other. If, however, we had two text strings we would not expect to be able to perform a similar subtraction operation. The fact that the number objects "know" that they are numbers allows them to determine that subtraction is a relevant operation and also how that subtraction should be performed.
In Dolphin, there are objects that represent (amongst other things):
|•||Everything is an object.|
|•||All objects know what kind, or class, of object they are.|
Class is a very important word in Smalltalk parlance. The class of an object allows it to determine how it should behave.
Tip: the fact that everything is an object in Smalltalk is highly significant. It makes Smalltalk a very pure object oriented programming language, much more so than other languages such as C++ or Java. This purity imparts a uniformity to the system that means that the language can be simple to learn and yet very powerful.
When you are programming in Smalltalk, some objects can be represented directly in the language. These are called literals. Take a look at the following examples of literal objects:
'Hello world' - a text string
$H - the character H
517 - an integer number
789.45 - a floating point number
#(1 2 3) - an array of three integers
#show - a special object called a Symbol