next up previous contents
Next: Getting started Up: Introduction Previous: Introduction   Contents

Basics

TOM is an object oriented programming language. A programming language can be used to instruct a computer. In an object oriented programming language the instructions consist of a description of objects and how they interact with each other.

An object is an entity with a certain behaviour. Objects can send messages to each other to evoke their behaviour. An object can maintain state to support its behaviour. If, for example, a Counter object is to respond as expected to repeated questions about its nextValue, it needs to maintain a notion of its current value. This current value would be the state of the Counter object.

As an example, sending the message nextValue to an object known as counter is written like this:

[counter nextValue];

A program can employ more than one object of the same kind, e.g. two Counter objects. The behaviour exposed by these objects is identical--they understand the same messages--but they maintain separate state: one Counter object in general has a different current value than another Counter object.

The Counter objects are said to be instances of the Counter class. The class describes the behaviour of its instances. Since all Counter objects are instances of the same class, they behave identically.

The Counter class itself is also available as an object. The most prominent behaviour of such a class object is its ability to create new instances.

00.5cm The fact that each class has a class object suggests the existence of an object describing the behaviour of the class object. Such an object exists; it is called the meta class object. To avoid inifinite meta levels, all meta class objects have a certain meta class object as their meta-meta class object. This implies that one of the meta class objects describes its own behaviour. However true, this observation does not lead to any spectacular possibilities--the language is about instances and their classes mostly; meta class objects aren't of any special interest. Now the basic terminology of objects, classes and instances has been introduced, time has come to look at an actual TOM program.


next up previous contents
Next: Getting started Up: Introduction Previous: Introduction   Contents
Pieter J. Schoenmakers tiggr at gerbil.org