Sunday, June 7, 2015

Java Programming.

Object Oriented Programming.

Object Oriented Programming is an approach that provides a way of modulating programs by creating partitioned memory area for both data and functions that can be used as templates for creating copies of such modules on demand.
  

Basic Concepts of Object Oriented Programming.


  • Classes and Objects.
             


  • Data Abstraction and Encapsulation.
                             Data and Methods are wrapped up into a single unit called class.
                             Data Hiding - The insulation of data from direct access by the program.
                             Encapsulation makes it possible for objects to be treated like "Black boxes".


  • Inheritance.
                            The process which objects of one class acquire the properties of objects of another.
                            Gives the concept of   "is a"  relationship in a hierarchical classification.
                            Provides the idea of  "Re-usability".

                       
                        Parent / Super /Base class  -   The existing, inherited class.
                        Child / Sub / Derived class-   The new class which inherits the parent class.
                     

  • Polymorphism.
                      This gives the ability to take more than one form. i.e a general class of operations may be accessed in the                              same manner even though specific actions associated with each operation may differ.
                      Extensively used in implementing inheritance.
                   
                   

                       It is similar to a particular word having several different meanings depending on the content. 


  • Dynamic Binding.
                         Process of converting the labels into memory address. This is done at runtime.
                         i.e The linking of a procedure call to the code to be executed in response to the call.

  • Message Communication.
                         An object communicates with the other object by using method calls.
                         A message for an object is a request for execution of a procedure, and therefore will invoke a method                                      (procedure) in the receiving object that generates the desired results.