Definitions of Terms in Object-Oriented Programming

Note : Part of this notes are extracted from :

http://www.csm.uwe.ac.uk/eng/randall/soft_des/lectures/lec01.htm

Please read this as an extra information and NOT as a complete treatment of the definitions.

Key components of the Object-Oriented Paradigm

Adapted from Wiener, R.S., Pinson, L.J., The C++ Workbook, Addison-Wesley, pp.1-3

The object-oriented paradigm offers a new approach to the development of software for a variety of applications. The fundamental concept for the object-oriented paradigm is that problem solutions are implemented by sending messages to objects. This requires that the objects in a solution be defined along with messages to whch each object will respond. This is in contrast to structured programming wherein one defines data structures and sends those data structures to defined procedures as parameters.

There are five key components to the object-oriented paradigm: object, message, class, instance, and method. These components are strongly interrelated and defined in terms of each other. To understand one is to understand them all. They are defined as follows:

Object: An object is an encapsulated abstraction that includes state information (internally accessible data) and a clearly defined set of accessing protocol (messages to which the object responds in order to manipulate its state data). In C++, an object is a variable of type className where className has been defined by the programmer according to the rules associated with the reserved word class.

Message: A message is a special symbol, identifier, or word(s) with or without parameters that represent an action to be taken by an object. In C++, a message is a function prototype that is a member of a defined class.

Class: A class represents a specific kind of object and is defined by a class description that identifies both the state variables and the accessing protocol for an object of that class. In C++, a class is a reserved word for a user-defined data type that is an extension of the ANSI C struct.

Instance: Objects are instances of a class. The properties of any instance (object) are given by the class description of its class. In C++, an object is instantiated when you declare its class and its variable name.

Method: A method exists for every message defined for an object of any class. The method defines how a message to an object is to be implemented. It typically consists of a series of object-message expressions and may use protocol from other classes as well. In C++, methods are function definitions. Together with the message to which the class responds (function prototype), methods are called member functions.

The Properties of an Object-Oriented Language

Adapted from Wiener, R.S., Pinson, L.J., The C++ Workbook, Addison-Wesley, p.6

An object oriented language must also support the four properties of abstraction, encapsulation, inheritance, and polymorphism. Besides these required properties, other desirable features for an object-oriented language are support for incremental problem-solving, reusable software components, generics, and some form of garbage collection (which may be automatic or controlled).

An object provides an encapsulated abstraction that maintains it own state. They way in which an object responds to a message depends not only on the specific message sent (along with its parameters) but also on the internal state of the object itself. An object also has a clearly defined protocol of messages to which it responds and methods that define how it responds. It is this encapsulation of state and protocol that is unique to the object-oriented paradigm. Additionally, the concepts of inheritance and polymorphism are fully supported by object-oriented languages.

Webster's New World Dictionary defines abstraction as "formation of an idea, as of qualities or properties of a thing, by mental separation from particular instances or material objects". It is interesting that this definition includes two of the key concepts defined to be part of the object-oriented approach to problem solving. Abstractions that are supported by a software system and language provide support for the development of high-level solutions to problems.

The dictionary defines encapsulation as the result of "enclosing in or as if in a capsule; putting into a concise form, a condensation." In an object-oriented language, the unit of encapsulation is the object. The capsule or object includes specific entities such as state data and messages protocols to which the object responds.

The dictionary defines inheritance as "the action of inheriting; the transfer of property (properties); to receive from a predecessor." The definition is clearly intended for inheritance by persons but the concept can be applied to objects and classes of objects as illustrated by biological classes. For object-oriented programming and objects, inheritance is interpreted as receiving properties (state data and message protocols) from the protocol given in a parent class.

The dictionary defines polymorphism as "the condition in which a species has two very different morphological forms." In object-oriented programming, this property obviously applies to messages and their implementations. It is extended to mean that a particular message takes form at run time. That is, the actual form of the implementation for a message is determined and bound to an object at run time.