next up previous

2.6.2 Primary OOP Features

There are five primary characteristics that an OOP system must possess: abstraction, encapsulation, inheritance, polymorphism and dynamic binding. An abstraction is a higher level, more intuitive representation for a complex concept. Encapsulation is the process whereby the implementation details of an object are masked by a welldefined external interface. Classes may be described in terms of other classes by use of inheritance. Polymorphism is the ability of different objects to respond to the same message in a specialized manner. Dynamic binding is the ability to defer the selection of which specific messagehandlers will be called for a message until runtime.

The definitions of new classes allows the abstraction of new data types in COOL. The slots and messagehandlers of these classes describe the and of a new group of objects.

COOL supports encapsulation by requiring messagepassing for the manipulation of instances of userdefined classes. An instance cannot respond to a message for which it does not have a defined messagehandler.

COOL allows the user to specify some or all of the properties and behavior of a class in terms of one or more unrelated superclasses. This process is called inheritance. COOL uses the existing hierarchy of classes to establish a linear ordering called the for a new class. Objects which are instances of this new class can inherit properties (slots) and behavior (messagehandlers) from each of the classes in the class precedence list. The word precedence implies that properties and behavior of a class first in the list override conflicting definitions of a class later in the list.

One COOL object can respond to a message in a completely different way than another object; this is polymorphism. This is accomplished by attaching messagehandlers with differing actions but which have the same name to the classes of these two objects respectively.

Dynamic binding is supported in that an object (see section 2.3.1) in a send function call is not bound until runtime. For example, an instancename or variable might refer to one object at the time a message is sent and another at a later time.


next up previous