Application of OOP


This article will take you to the overview of oop application and you'll know how to use the oop concept and where you can use it and finally how it helps you.

OOP is a new level of programming concept. You can implement any level of complex situation in the programming. For startup lets mark out the points which are the lifeline of the oop.

1. Abstraction - the give what they need idea.

2. encapsulation - break it down idea.

3. Inheritance - reuse what you already have.

4. Polymorphism - be flexible and take different forms.

5. Organisation - keep it clean.

 

Now that we know what the oop is and what are its main components, we will see how they can help you in real life situation and we will answer how they are used to serve the purpose.

 

1. Definition of The real world problem: The oop is based on the class and object scenario, that means you can define the real world problems in to the modules which are compatible with the programs. The Class is a blueprint of your model and the Object is a real structure that is using that blueprint. For example The Vehicle Class can be a blueprint for all the vehicles. and a Car could be an object of that class.

 

2. Keeping it abstract: When you do something it could go awfully complex but when you come to present it to someone it shall be nice and clean. This is what abstraction means. that means none of your client is going to care what code you write all they need is functionality. so you better present them with a good user interface and hide your code behind it. All that matters is it should work well. In our vehicle example we know car can be speed up by changing gears but we don’t care how that gear shift effects the engine.

 

3. Keep it Encapsulated: With abstraction you’ll be good with what you give to your customers but with Encapsulation you’ll do good to yourself. Suppose you make a very nice and good application for one of your customer. Now he asks for a small little change, if you have written it in a bad way you’ll have to make so many changes that you’ll be cursing yourself. So all you need to do is keep things smaller and well defined. so that you don’t have to change whole code if you want to make one little change. For our car example , suppose we want to redefine the looks of the car we don’t need to change engine all we need to do is have our interior or body looks redefined.

 

4. what have you got from the parent: Now now ! we have a vehicle class and we want to define a car class and a bike class, how easy is that ? vehicle has wheels so do cars and bikes, well, afterall these two are also a vehicle. so would you mind writing the code again for the car’s wheel and bike’s wheel? Instead I would say lets use Inheritance and get over it. You have the wheel method defined in the vehicle class just inherit the vehicle in Car and bike class and redefine the properties of vehicle. In this manner you don’t have to do much. This is how your parents care for you.

 

5. Keep it Clean: This is what your final plan shall be, to keep everything organised so that it is easy to manage. For example you can separate the classes that define looks of a vehicle in a directory and classes that define the performance in another. it will make easy to maintain the code.

 

6. The clown is fun: Do you remember the clown from the circus, the one who changes his appearance often ? Well this is how the polymorphism works. You can define the methods with various functionality but with the same name. In this way you can remember the names easily and perform various functions without redefine the whole new thing.

 

See, how simple is the life with the OOP.