Friday, April 16, 2010

Basic Concepts of Object Oriented Programming

Procedural programming deals with functional parts of the problem. Programmers identify what actions must be taken to solve the problem at hand. Let us now, try to understand what aspect of problems are dealt with in object-oriented approach object-oriented.

In object-oriented, a problem is viewed in terms of the following concepts:

1. Objects
2. Classes
3. Data abstraction
4. Data encapsulation
5. Inheritance
6. Polymorphism
7. Dynamic binding
8. Message passing


Objects are the basic run-time entities in an object-oriented system. They may represent a person, a place, a bank account, a table of data; they also represent user-defined data such as vectors, time and lists. They accupy space in memory that keeps its state and is operations on the object. Each object contains data and code to manipulate the data. Objects can interact without having to know details of each other data or code.
2. C LASSES: A class represents a set of related objects. The class of an objects defined what attributes an object has. The entire set of data and code of an object can be made a user-defined data type with the help of a class. Classes are user defined data types that behave like the built-in types of a programming language. Classes have an interface that defines which part of an object of a class can be accessed from outside and how. A class body that implements the operations in the interface, and the instance variables that contain the state of an object of that class.


Abstraction refers to the act of representing essential-features without including the background details or explanations. Abstraction is indispensable part of the design process and is essential for problem partitioning essentially is the exercise in determining the components are not isolated from each other, they interact with each other. Since the classes use the concept of data castration, they are known as Abstract Data Type(ADT).


The wrapping up to data and functions into a single unit (class) is known as encapsulation. Data encapsulation is the most striking feature of class. The data is not accessible to the can access it. These functions provide the interface between the object’s data and the program. This insulation of the data from direct access by the program is called data hiding.


Inheritance is the process by which objects of one class acquire the properties of objects of another class. It supports the concept of hierarchical classification, for example, an manager class is a type of the class employee, which again is a type of the class person as illustrated below. The principle behind this sort of division is that each derived class shares common characteristics with the class from which it is derived. The power of inheritance lies in the super class. In other words, a feature is placed in the higher level of abstraction. Once this is done, such features can be inherited from the parent class and used in the subclass and used in the subclass directly. This implies that if there are many abstract class definitions available, when a new class is needed, it is possible that the new class is a specialization of one or more of the existing classes.


Polymorphism means the ability to take more than one from. An operation may exhibit different behavior in different instance. The behavior depends upon the types of the data used in the operation. The process of making operator to exhibit different behavior at different instance is called operator overloading. Another example of polymorphism is function overloading, where a single function can perform various different types of task.


Binding refers to the linking of procedure call to the code to be executed in response to the call. Dynamic binding means that the code associated with a given procedure call is not known until the time of call at run-time, the code matching the object under reference will be called.


Message passing is another feature of object-oriented programming. An object-oriented program consists of a set of objects that communicate with each other. The concept of massage passing makes it easier to talk about build systems that directly model or simulate their real-world counter-parts. A message for an object is a request for execution of procedure, and desired result. Message passing involves specifying the name of the object, the name of the function (message) and the information to be sent.

No comments:

Post a Comment