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.
- OOP and Tree Structures
It's clear that the base class to derived class relationships tie the classes together into a tree structure. This structure is called the class tree or inheritance tree. These trees are referred to as models in UML because the interconnections between them can't usually be represented as a simple one-to-many tree. In this document we will just use tree which is synonymous with structure, hierarchy or model.
It was mentioned above that the running instances also formed trees. These could generally be called dynamic trees, but they've also often referred to as object models or runtime models. These instances also form a tree structure because the content of an instance are also instances, they're defined by the class in terms of classes, so there's a very strong connection between the two trees. On instantiation, the initial state structure is instantiated too. When an instance contains another instance like this, it's called the parent of the instance, and the contained instance is the child. All the instances in the same parent are siblings to each other.
So we have two strongly related trees, a static tree of classes, and a dynamic tree of instances.
- How the Nodal Model differs from OO
- Naming: Many problems in OO come from its foundation in naming - all the classes and objects use textual-names as their fundamental means of identity and distinction leading to problems with naming conflicts and language-dependence.
- Instance-based: Problems arrise in OO from the fundamental difference between class and instance...
- Unified-space: Problems arrise in OO from the runtime space not being a logical continuation of the file-system and global network spaces
- Self-organising: Change is inherent in the network, so applications within can execute directly from their conceptual description requiring less code
- Self-contained: Like OO, the Nodal Model is a methodology and so can be implimented in any programming environment, but unlike OO, the Nodal Model fully describes its own instantiation into those enviornments.