Sunday, February 8, 2015

Object Oriented Programming (OOP) Concepts





   Object Oriented Programming (OOP)

Lets start with "Object" . What is it? Object is anything which you can see around or which has some set of  identity, behavior , property to show.  like all living & non-living things - human , dog, car, book etc.  then for its definition, identity, classifications we needed a schematics used to represent  these details & data about it. And this schematic is termed as Class in OOP concepts.  So if you and me (humans) are objects then home sapiens is our class. So essentially object comes first then the class. Class defines relationship, behavior and inheritance for objects.

There's different models to explore this interesting concept (Object) & its implementation (Class) -

Object Oriented Analysis (OOA) :
Field to explore the problem and requirements from the perspective of objects & classes present in
the given problem case.

Object Oriented Design (OOD) :
Field to represent, conceptualize, design process of the object oriented abstraction, notation/symbols to show the logical/physical model of the system, which fulfills the problem requirement.

Object Oriented Programming (OOP) :
Finally, We need to implement our conceptual solution or the design made out of the abstracted problem requirement into working model. In this process, there's programming which shows the collection of objects, and each would be the instance of some classes linked together directly or indirectly, and these classes would be either parent, present in some hierarchy, or associated with other classes.

In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions, methods)

A class may have three kinds of members:
–Attributes (fields, data members) are data variables associated with a class and its objects. They store results of computation performed by the class methods and also the state of the object.
–Methods define behaviors for object & contain the executable code of a class.
–Classes can be members of other classes.

for ex-


class Dog{
   int name;
   int breed;
   int age;

   printName(name);
   matchBreed(breed);
   happyBday(age++);
}


OOP relationships among Objects :




No comments:

Post a Comment