Pages

Friday, October 5, 2012

OBJECT ORIENTED PROGRAMMING






From Addison Wesley – The Essence Of Object Oriented Programming With Java and UML


ü   Object Orientation is a significantly different way of thinking about solving problems and developing software solutions.
ü An Object-Oriented System is one that has been designed using abstraction with objects, encapsulated classes, communication via messages, object lifetime, class hierarchies, and polymorphism.
ü         An object represents an instance of a real or abstract thing.
ü   Encapsulation is enforced by having the definitions for attributes and methods inside a class definition.
ü   The attributes of  a class are defined by the declaration of  variables of  various types such as int or boolean.
ü     A Java class includes the definitions of  the methods used to implement the behaviors of  the class.
ü        The method definitions are integral parts of the class definition.
ü     A class is the definition of the attributes and methods needed to model a related group of objects.
ü  Classes can be organized into hierarchies. Association is a relationship between classes. Aggregation and composition represent whole/part relationships. Inheritance represents generalization/specialization.
ü   The interaction can be between objects of the same class, or objects of different classes. This interaction is handled  by sending messages (in Java, this is done by calling methods) to other objects to pass information or request action.
ü  Object Lifetime. The time an object exists - from its instantiation in its constructor until the object no longer exists and has been finalized by the Java garbage collector.
ü  Inheritance allows subclasses to selectively derive the properties of a superclass.
ü  Identity The characteristics or state of an object that allows it to be distinguished from other objects.
ü      Polymorphism is a characteristic of inheritance that ensures that instances of such subclasses behave correctly.
ü   Polymorphism goes hand in hand with inheritance, and means the right methods are used for individual objects in a derived class.
An understanding of how objects are created and implemented can make it easier to write good OO programs.
ü           There are four level visibility of methods.
ü Public Visibility. Public attributes and operations are visible to the whole world. Any other class can access the public items of a class.
ü Private Visibility. Private attributes and operations are visible only to members of the given class.
ü Protected Visibility. Protected attributes and operations are visible to the class and its subclasses.
ü  Friend Visibility. Friend attributes and operations are visible to a specified set of other classes. In Java, the package is used to define friend visibility. In C++, the friend specifier is used.
ü Just as any other specialized discipline, object-orientation has its own vocabulary.

0 comments:

Post a Comment