Adsense

Concepts and Advantages

The basic concepts underlying OOP are: Class, Object, abstraction, encapsulation, inheritance, and polymorphism.

 Abstraction: Abstraction is the essence of OOP. Abstraction means the representation of the essential features without providing the internal details and complexities. In OOP, abstraction is achieved by the help of class, where data and methods are combined to extract the essential features only. Encapsulation: Encapsulation is the process of combining the data (called fields or attributes) and functions (called methods or behaviors) into a single framework called class. Encapsulation helps preventing the modification of data from outside the class by properly assigning the access privilege to the data inside the class. So the term data hiding is possible due to the concept of encapsulation, since the data are hidden from the outside world.

  Inheritance: Inheritance is the process of acquiring certain attributes and behaviors from parents. For examples, cars, trucks, buses, and motorcycles inherit all characteristics of vehicles. Object-oriented programming allows classes to inherit commonly used data and functions from other classes. If we derive a class (called derived class) from another class (called base class), some of the data and functions can be inherited so that we can reuse the already written and tested code in our program, simplifying our program.

 Polymorphism: Polymorphism means the quality of having more than one form. The representation of different behaviors using the same name is called polymorphism. However the behavior depends upon the attribute the name holds at particular moment.

Some of the advantages are:

 Elimination of redundant code due to inheritance, that is, we can use the same code in a base class by deriving a new class from it.

 Modularize the programs. Modular programs are easy to develop and can be distributed independently among different programmers.

 Data hiding is achieved with the help of encapsulation.

 Data centered approach rather than process centered approach.

 Program complexity is low due to distinction of individual objects and their related data and functions.

  Clear, more reliable, and more easily maintained programs can be created.

No comments:

Post a Comment