OO and the Nodal Model
The OOP methodology helps us to model our systems in terms of real objects and relationships. It is a methodology so it can be done in any programming language, not just the object-oriented-programming-languages (OOPL's). In fact OO was even around before programming languages under the name of abstract data types (ADT's) in maths.
- A quick OOP refresher
Objects are containers of properties, the values of which form the objects' state. Also contained in the object are a set of methods which are functions designed to manipulate its state. The function names and the parameters they require form the interface of the object, through which all external interactions take place. This is called encapsulation and allows the internal workings of the object to be independent from programs which use it.
Different kinds of objects are defined by the names and types of properties and the interfaces (names and parameters) of their methods. This structural aspect of an object is its class. When objects come into being to be used by a program, they are created by effectively using the class as a template, creating a new "live" version of it in a specific context and under a specific name.
The way this template-like activity happens is via methods called a constructor and a destructor, which create and remove occurences of the class "in the field". Such an occurrence of a class is called an instance and the process of creating one is referred to as the class instantiating itself.
Often a new class needs to be created which is a refinement or extension of an existing class. This is called inheritance and we say that the new class is derived from the existing one. The new class is the sub-class or derived-class of the original one, and the original is the super-class or base-class of the new. Multiple-inheritance is when a class is derived from more than one base-class; it inherits the properties and methods from them all. (Note: multiple-inheritance is not the class-chain formed from classes to sub-classes, multiple inheritance means a class is actually derived from more than one chain. Today the only commonly known language supporting this is C++).
Polymorphism is when a base-class defines the interface for a method, but leaves it to the derived classes to implement the method. For example, a shape class may define the interface for an area method which all shapes must have, but the actual implementation (in this case a formula) depends on the specifics of the derived classes such as triangle or circle.