Object oriented programming is an essential part of our today’s programming methodology. It is being extensively used in all programming languages due to its key aspects and benefits which will be discussed later on. It is a technique in which we visualize our programming problems in the form of objects and their interactions as happens in real life.

We have different objects around us in our real life that interact with each other to perform different operations For example, Human beings, cars, tree, house etc.
Take an example of a person lives in a house. He drives a car. All these are objects and have their own unique characteristics. Take another example of a School; the objects in a school are student, teacher, books, pen ,school bag, classroom, parents, playground etc.

Suppose we want to develop a fee collection system for a school for this we will need to find out related objects and their interactions as happens in real life. In this way we can say that object orientation makes it easier for us to solve our real world problems by thinking solution of the problem in terms of real world objects.
So we can say that in our daily life everything can be taken as an object that behaves in a certain way and has certain attributes. In object orientation we move our concentration to objects in contrast to procedural paradigm in which we simply write our code in functions and call them in our main program.

What is a Model?
A model is an abstraction of something real or conceptual. We need models to understand an aspect of reality.

Model Examples
Highway maps
Architectural models
Mechanical models

OO Models:

In the context of programming models are used to understand the problem before starting developing it. We make Object Oriented models showing several interacting objects to understand a system given to us for implementation.
Object Oriented Model

Ali, Car, House, Tree

Ali lives in the house
Ali drives the car

Object Oriented Model (A School Model)
Teacher, Student, School Bag, Pen, Book Playground
Teacher teaches Student.
Student has School Bag, Book and Pen


Object-Orientation - Advantages

As Object Oriented Models map directly to reality as we have seen in examples above therefore,
We can easily develop an object oriented model for a problem.
Everyone can easily understand an object oriented model.
We can easily implement an object oriented model for a problem using any object oriented language like c++ using its features like classes, inheritance, virtual functions etc.

What is an Object?
An object is,
  1. Something tangible (Human being, School, House, Car).
  2. Something conceptual (that can be apprehended intellectually for example time, date and so on…).
An object has,
  1. State (attributes)
  2. Well-defined behavior (operations)
  3. Unique identity

Tangible and Intangible Objects

Examples of Tangible Objects:
Ali is a tangible object, having some characteristics (attributes) and behavior as given below,
Characteristics (attributes)
Behaviour (operations)


We will identify Ali using his name.
Car is also a tangible object having some characteristics (attributes) and behavior given below,

State (attributes)


Behavior (operations)
Start Car
Change Gear

We can identify Car using its registration number.

Examples of Intangible Objects (also called as conceptual objects):

Time is an intangible (conceptual) object

State (attributes)


Behavior (operations)
Set/Get Hours
Set/Get Seconds
Set/Get Minutes
We will assign our own generated unique ID in the model for Time object. 

Date is also an intangible (conceptual) object

State (attributes)

Behavior (operations)
Set/Get Year
Set/Get Day
Set/Get Month
We will assign our own generated unique ID in the model for Date object.

Let us look at some of the key aspects of object orientation.

Key Aspects:
  • Model is the abstraction of some real word scenario. It helps us to understand that scenario.
  • Object oriented model of any scenario (problem) describes that scenario (problem) in the form of interacting objects.
  • We use Object Orientation because it helps us in mapping real world problem in a programming language.
  • Object Orientation is achieved using objects and their relationships.
  • Properties of an object are described using its data members and behavior of an object is described using its functions.
  • Objects may be tangible (physical) or intangible (also called conceptual or virtual).
  • Generally when we have given a certain problem description, nouns in that problem description are candidates for becoming objects of our system.
  • There may be more than one aspects of an object
  • It is not necessary that every object has a specific role in implementation of a problem there may be some objects without any role, like school parking in our school.
  • It is easier to develop programs using Object Oriented Programming because it is closer to real life.


1 comment: