Wednesday, 15 May 2013

What is object oriented approach or object oriented language?

 What is object oriented approach or object oriented language?
             
                  Object Oriented Programming (OOP) is one of the popular methodologies in software development.  It offers a powerful model for creating computer programs.  It speeds the programming development process, improves maintenance, and enhances re-usability of programs.  Object orientation is a software development methodology that relates to the real world system. Object is the main thing in this methodology.  An object is the thing which can be seen, touch or feel logically and physically.  For example a Man, Bird, Car can be called as objects.  You can say object oriented model as collection of objects and relationship between them or each other.
               
                 THE FOUNDATION OF OBJECT ORIENTATION

An object oriented program consists of classes, objects, and methods.  Now i will make you understand each of them. Firstly we will see OBJECTS.

OBJECTS
           
          An  object means a 'material thing'  that can be presented physically.  In other words, an object is a touchable entity that may show some well defined behavior.  For example, consider the following statements in context of a tennis ball:
  •  A tennis ball is a touchable entity, with a visible boundary in physical terms.
  • A tennis ball has a specific defined purpose ( such as bouncing).
  • A tennis ball can be acted upon( such as can be hit with a racket or can be tossed around).
       But in software world the definition of object is not limited to merely something that can be seen, held and touched such as tennis ball or human non touchable things can be also considered as objects.  For example , in a car racing video game, the car is an object.  You can drive the car , turn the car , or stop the car when needed.  There are no visible boundaries when you are playing a video game.  Here everything is abstract.
        
       Now we will dig deep in OBJECTS 
        
       For example we will take the state, behavior and identity of object

STATE, BEHAVIOR AND IDENTITY OF AN OBJECT

An object has the following characteristics
  • It has a state that is indicated by a set of attributes and their values.
  • It may display behavior that is reflected by the change of its attributes over a period of time.
  • It has a unique identity, which distinguishes it from other objects.
For example, consider a bike as an object.  A bike has the following characteristics.
  • A bike can have various states, such as moving and stationary.
  • It can show various behaviors such as accelerating decelerating or turning.
  • It also has an identity, such as unique registration number.
Two objects may have same behaviors and states, but they never have the same identity.  The identity of an object does not change in its lifetime.  for example two tennis ball have the same color, be made of same material, have same weight and display the same behavior.  However , they will have distinct identities

CLASSES

Look at the world around you.  It is full of objects of various shapes, sizes, colors and behaviors.

              For example, there are millions of animals on earth.  All animals and birds, which are essentially objects can be classified on the basis of common attributes. For example, the peacock, the sparrow, and the kingfisher are all birds.  All of them share characteristics that are common to the family of birds.  All of them lay eggs, have feathers, have hollow bone structures, and have the ability to fly.  Therefore, they share structural and behavioral similarities and belong to the class called Birds.

             Similarly, objects such as truck, a van, a sports car, and a bus are kind of vehicles.  Therefore, all these objects belong to the class, Vehicle.


MESSAGES AND METHODS
         
           Objects do not exist alone.  Means they communicate with other objects.  These communications take place through messages.  Grady Booch has defined behavior as , "Behavior is how an object acts and reacts, in terms of its state changes and message passing."
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           Readers if you want to know more about programming then please read and please comment 

No comments:

Post a Comment