Logical View  «Prev 

Object-oriented (OO) terminology

During the development of the object-oriented (OO) terminology, three very similar terms came into use: "object model," "class diagram," and "object diagram." Some people use them interchangeably, not realizing that they describe very different concepts.
Object model and class diagram typically refer to a class-level model. The class-level model is the one implemented by all OO CASE tools. The object diagram literally models objects and their connections, or links. This diagram is very useful but is rarely included in a CASE tool. We cover the object model or class diagram in this module and the object diagram later in the course.
Object-oriented methodology is a way of viewing software components and their relationships. Object-oriented methodology relies on three characteristics that define object-oriented languages: encapsulation, polymorphism, and inheritance. These three terms are elaborated below.

Objects and Methods

An object is an encapsulation of data together with procedures that manipulate the data and functions that return information about the data. The procedures and functions are both called methods.


Encapsulation refers to mechanisms that allow each object to have its own data and methods. The idea of encapsulating data together with methods existed before object-oriented languages were developed. It is inherent in the concept of an abstract data type. Objects can be implemented in classical languages such as C using separate compilation or structs to provide the encapsulation. This is a common technique for implementing abstract data types in procedural languages.
Object-oriented languages provide more powerful and flexible encapsulation mechanisms for restricting interactions between components. When used carefully, these mechanisms allow the software developers to restrict the interactions between components to those that are required to achieve the desired functionality. The management of component interactions is an important part of software design. It has a significant impact on the ease of understanding, testing, and maintenance of components.

Polymorphism and Overloading

Polymorphism refers to the capability of having methods with the same names and parameter types exhibit different behavior depending on the receiver. In other words, you can send the same message to two different objects and they can respond in different ways. More generally, the capability of using names to mean different things in different contexts is called overloading. This also includes allowing two methods to have the same name but different parameters types, with different behavior depending on the parameter types.
The capability of using words or names to mean different things in different contexts is an important part of the power of natural languages. People begin developing the skills for using it in early childhood.


One important characteristic of object-oriented languages is inheritance. Inheritance refers to the capability of defining a new class of objects that inherit from a parent class. New data elements and methods can be added to the new class, but the data elements and methods of the parent class are available for objects in the new class without rewriting their declarations.
For example, Java uses the following syntax for inheritance:
public class B extends A {
	//declarations for new members

Objects in class B will have all members that are defined for objects in class A. In addition, they have the new members defined in the declaration of class B. The extends keyword signals that class B inherits from class A. We also say that
  1. B is a subclass of A and that
  2. A is the parent class of B.

Access Modifiers

Access Modifiers
In Java the programmer has control over which members are inherited. In Java, a member is defined with a keyword indicating its level of accessibility.
The keyword private indicates that the member is not inherited by subclasses.