View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Spring 2006

CoWeb Assignment 1:

Class-Based Inheritance

In an object-oriented programming system, objects are the basic units of a program. A class is the blueprint for building an instance of an object. Classes contain the definitions of attributes (or data) and services (or behaviors/responses to messages) for an object, they provide reusable parts (through inheritance), and behave as factories (instance creation). An instance is the actual object built when the program is run, which is capable of holding data and performing functions, as defined by the class upon which it is based.

Class variables and methods are those that exist in and are understood by the class itself. Instance variables and methods only have meaning once an instance of the class is created. Instance variables are private.

Message Passing

In Squeak, all computation is triggered by sending messages to an object. These messages trigger methods to perform their function. The receiving object determines the mapping of a message to its associated method. This decision is based on the class of the receiver object, and is made at runtime (late-binding). If a receiver object/class does not know how to handle a message, it will pass the message to its parent class (class-based inheritance).

Different objects can respond to the same message in different ways (polymorphism). This is useful because it allows a message to specify the programmer's goal, rather than identifying a specific segment of code to be executed. Through late-binding, decisions about the handling of messages are made at runtime. Because of this it is not possible to determine exactly what action is going to be carried out until the message is received by the object.

Link to this Page