Monday, 12 May 2014

Concepts of Object-Oriented Programming or Characteristics of OOP

Concepts of Object-Oriented Programming
Objects
In procedure-oriented programming, a program is divided into functions. Unlike this, in object oriented programming, a program is divided into objects.
In our day-to-day life, we come across number of objects. Some examples are: telephone, car, computer, table, chair, washing machine etc. Each object has the following two characteristics:
 1.   State or Attributes
The state or attributes refers to the built-in characteristics of an object. For example color T.V. has the following attributes:
·       Color receiver
·       Volume control
·       Picture control
·       128 channels
·       Remote control unit

2. Behaviour or Operations
    The behaviour or operations of an object refers to its action. For example, a TV can behave in any of the following manner at a giver point of time:
·       Switched on
·       Switched off
·       Displays picture and sound from
·       A TV cable connection
·       A TV transmitter
·       A DVD
·       A VCR

Software objects can be visualized in a similar manner. Hence one of the most interesting features of OOP is that objects correspond to real objects.

Objects are made up of data and functions, bounded together as you can see below:






Hence, an object consist of the following
·       Data members
·       Member Functions
The data members establish the state or attributes for the object. The behaviour or operation of the object is determined by the member functions. From the Above figure, it is clear that data can only accessed through the member functions. The outside world cannot directly access. The function is the window to the outside world for accessing the data. Thus, the data is well-protected and inadvertent manipulation thereof can be stopped.
Following are the two ways to diagrammatically represent the object in Object Oriented Analysis and Design







No comments:

Post a Comment