Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
CoWeb Assignment 1:
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.
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
- Robert Schirmer last edited on 13 June 2006 at 4:01 pm by adsl-33-173-159.asm.bellsouth.net