Objects
SenseTalk was designed to enable people to create their own software, without years of study to master the intricate and arcane details of programming. Information provided in other sections of this documentation focus on SenseTalk scripts primarily as simple lists of statements that tell the computer what you want it to do. For many people that basic approach to scripting will be sufficient for their needs.
For those who care to learn just a little bit more, SenseTalk’s object model offers a much richer environment, without adding greatly to its complexity.
The information explained here provides an overview of the modular structure of SenseTalk, and introduces the key concepts and terminology that you will want to be familiar with as you proceed with learning how to write your own object-oriented SenseTalk software.
Setting the Stage
SenseTalk is a "scripting" language. You create SenseTalk software by writing scripts that describe what different elements of your system will do. The usual way to do this in SenseTalk is to create a number of different “objects” which will be the actors in your system. Each object has its own script that tells what it does in the system. By taking this modular approach, each script can be relatively short and self-contained, which makes even complex systems relatively easy to work with.
The objects in your system will interact by sending and receiving messages. An object responds to a message if it has a handler for that message. A script consists of a series of handlers, one for each message that the object will respond to. Any other messages will be ignored by the object.
One SenseTalk object can help another. When you have a number of objects that need to have similar behaviors or abilities, you can create a helper object which embodies those shared behaviors and abilities. Each of the other objects can then be helped by the helper object, eliminating the need for them to each have those behaviors defined in their own scripts. This saves you a lot of time and effort. It also makes it easy to update a behavior by simply changing the script of the helper object. All of the other objects will then “inherit” the changed behavior.
It should be noted, for those who may be familiar with other object oriented languages, that SenseTalk is somewhat different. Most other languages define “classes” of objects and generally only implement behavior at the class level, for all objects in that class. In SenseTalk, each individual object has its own script, so it can have its own unique behavior.
SenseTalk has no classes, but its helpers provide a similarly rich set of capabilities by allowing objects to use (or inherit) functionality provided by any number of other objects. This all-object (classless) approach is both simpler and more versatile than class-based systems.