OOP Best Five Feature

OOP is based on the concept of object which contains data. Objects have attributes and methods. Just like real world objects attributes are the properties of the object i.e Human has two ears and two eyes.The OOP best five Feature over functional programming paradigm is explain as follows.

OOP (Object oriented Programming) is so valuable because of the fact that it simplifies the process of problem solving by dividing the problem into small pieces. Unlike functional programming OOP divide the code in smaller code pieces. So it makes easy to solve really complex problems.

1. CODE REUSABILITY THROUGH INHERITANCE

The most important feature of the Object Oriented Concept is the code re-usability. There are two types of code re-usability. One type is copy / paste and make any require modification in the code. Write such code which is understandable and other programmers can understand easily. The other concept is that the use of common classes and methods. Here I will explain this through a proper example.

For example we want to make a class for computer. So there are different type of computer like desktop and laptops. But both laptop and desktop are computer and have some common properties and functionalities. Here we will use the concept of inheritance. Make a common class with the name “computers” and define the common properties and functionalities in this class. Now make two sub class of computer class as “desktop” and “laptop”. Both of the child class will have access to the parent “computer” class and can reuse its attributes and methods. That’s why inheritance is so much valuable.

2. EASY AND EFFECTIVE PROBLEM SOLVING.

Object Oriented Programming (OOP) is the most effective and easiest way of problem solving according to my approach. In can structural programming languages it’s really difficult to write code for complex problems. On the other hand procedural languages are not really helpful. The question is why OOP is effective?

Structural and procedural style of programming don’t divide the problem in smaller blocks. The only way to simplify the problem is OOP. In case of OOP, programmers write small pieces of code in the form of classes. Class is a block of code which contains about similar attributes and methods. Through objects you can access those methods and attributes.

This also helps us when a team of developers is working on the same project. Every programmer write their own piece of code and there is very little chances of duplications. And at the end all modules are integrated with each other.

3. POLYMORPHISM

Poly means many and morph mean structures or forms. So polymorphism means many forms of the same thing. In case of OOP polymorphism means have different methods with the same name. Therefore polymorphism is really helpful for programmers. When you will call the method with different objects it will give you different result.

Real life example.

I will explain this concept through real life scenario. Take an example of vehicle. Vehicle are of different types. Cars, heavy vehicles and many more. All vehicle can drive. So all have this functionality but not the same. Everyone have different way to drive. So through polymorphism you can define different methods with the same name just “drive()” for different scenario.

4. MODULARITY

Procedural programming is really difficult when you made some mistake. You don’t know where the error is. You will have to overview all of the code. This is headache. Even no one can read all the code and understand the logic.

The modular programming makes it easy for someone to find out where the fault is. Because in modular programming you divide the code in smaller pieces which are called class or model. So if the problem is with the car class then just go there and you will not need to read out the whole code.

OOP allows you modular programming. This help you in the development of big projects where a team of programmers works simultaneously. Different programmers’ works on different modules. At the end all the modules are integrated with each other.

This is the beauty of Object Oriented programming.

5. DATA HIDING.

One of the OOP best five feature is data hiding which is called Encapsulation. All the data with in the class is just only accessible within the same class. So this prevents programmers from tempering values they shouldn’t. Changes can be made easily and independently with in the code without affecting other classes. Therefore encapsulation also enhance maintenance.

Comments