Pure object-oriented development requires that object-oriented techniques be used during the analysis, design, and implementation of the system. Various methods have been proposed for OOA and OOD, many of which propose a combined analysis and design technique.
We’ll be covering the following topics in this tutorial:
Classes and objects:
Classes and objects are the basic building blocks of an OOD, just like functions are for function-oriented design.
Encapsulation
The basic property of an object is encapsulation: it encapsulates the data and information it contains and supports a well-defined abstraction. This encapsulation of information along with the implementation of the operations performed on the information such that from outside an object can be characterized by the set of services it provides is a key concept in object orientation.
State, behavior, and identity
An object has state, behavior and identity. The encapsulated data for an object defines the state of the object. The state and services of an object together define its behavior. The behavior of an object is how an object reacts in terms of changes when it is acted on, and how it acts upon other objects by requesting services and operations.
Classes
Objects represent the basic run-time entity in the OO system; they occupy space in memory that keeps its state and is operated on by the defined operations on the objects. A class, on other hand, defines a possible set of objects. A class can be considered template that specifies the properties for objects of the class. Classes have:
1. An interface that defines which parts of an object of a class can be accessed from outside and how.
2. A class body that implements the operations in the interface.
3. Instances are variables that contain the state of an object of that class.
Relationship among objects: If an object invokes some services in other objects, we can say that the two objects are related in some way to each other. All objects in a system are not related to all other objects. If an object uses some services of another object, there is an association between the two objects.
This association is also called a link – link exits from one object to another if the object uses some services of the other object. A link capture the fact that a message is flowing from one object to another.
Inheritance and polymorphism:
Inheritance is a unique concept to object orientation. It is a relation between classes that allows for definition and implementation of one class based on the definition of existing classes. When a class B inherits from another class A, B is referred to as the subclass or the derived class and A is referred to as the superclass or the base class.
With polymorphism, an entity has a static type and a dynamic type. The static type of an object is the type in which the object is declared in the program text, and it remains unchanged. The dynamic type of an entity, on the other hand, can change from time to time and is known only at reference time.