In this article, I would like to introduce a beautiful programming paradigm that solves a lot of real-life problems in terms of programming.
Let us look into what is OOPs, the ideology behind OOPs and also main concepts of OOPs. And the complete article would be described in Non Programming terms, i.e., in layman’s terms.
Note: Once you are done reading the article, and understand, learning the OOPs Languages would be easy. It would give better understandability to learn any OOPs languages.
What is OOPs?
Object-Oriented Programming is a programming paradigm/ way of writing a solution for a given problem statement.
In a simpler way, it is a way of writing computer programs that are using the idea of “Objects” as a reference to represent the data and methods.
Instance: Take a scenario, Building a car. Building a car has a lot of things that are to be taken care of.
- Drawing out a blueprint of how the car should look like.
- Things that are required to build a car.
- Things that should be accessible to the one who builds it.
- Things that are accessible to one who drives it.
- How things attached to it should function
- How different things help function the other things
Here things are the data and methods are functionality associated with that data. Object-Oriented Paradigm basically is an idea of binding both the data and functionality for the simplicity of finding real-world problems.
Basically, some real-world problems are efficiently solved when taken Object-Oriented Approach, say in the above instance, Building the car was the problem statement.
How we go about it, can be understood as we go ahead.
You might have read the term “Object” above. Wondering, what is an Object?
An Object is the basic fundamental unit of Object-Oriented Programming. It’s a unit formed by the data and the methods(things and how things function) which is built from a blueprint.
Taking the same instance as above, we can say, Car is an Object. It holds all the things and functions together to have the behavior of a vehicle.
Talking about Blueprint, reminds of another important term, “Class”, which basically is a blueprint for creating objects.
For instance, for a Car Blueprint, we take care of essential features like fuel, type of fuel, the engine to be used, design how it should look, on Ignition how the vehicle should function.. so on.
It’s possible to produce cars in series using the blueprint, without re-building the machine from scratch.
This basically gives a clear image of what OOPs is all about.
Now, taking note of the major features of OOPs concepts:
What do you mean by “Abstraction”?
It simply means showing the essential features of a module, hiding the details of internal functionality.
Example: A driver that uses the accelerator, doesn’t need to know how it precisely works at the Mechanic level. He only knows that if he presses the accelerator, the car accelerates.
Now jumping into another term, “Encapsulation”,
It is a method of wrapping up the things (data) and in a way, it can function to do something productive (methods).
Basically, putting together the data and methods together to classify them. In other words, we can also define it as, way of exposing a solution to a problem without requiring to fully understand the problem domain.
Example: In the Car designing/Integrating team, the members working on the Lighting system of the car don’t need to know how the Brake System in the car works, as simple as that.
Now, explaining the term “Inheritance”
“Inheritance”, as the word suggests is a way to inherit some features(methods) or things(data) from a parent to its child. This is an important feature in OOPs, which basically deals allows you re-define the model.
Another Example: There is a Car X and are planning to release a Model A and Model B for Car X. Now Model A is already designed and implemented. Model B is almost the same except for the Tyre and Disc Brake System.
So, here what happens is, Model B can take the design of the Model A and alter as per their requirement for Tyre and Disc Brake System.
Made sense? They don’t have to redesign it from scratch. Instead, they inherit the things and functionality from Model A.
Finally, talking of “Polymorphism”
Polymorphism is a feature that defines the different implementation of the same objects.
To put in simple words, “Polymorphism” is a feature that enables to define the same functionality in different forms.
Simple silly but effective example would be using ‘Cut’ as a polymorphic word;
- Surgeon would begin to make an incision
- Hair Stylist would begin to cut someone’s hair
- Actor would abruptly stop acting of the current scene
Another Example: Car X has Model A and Model B, where both need fuels to run the vehicle.
Say, Car A-Model A uses petrol and other uses diesel as its fuel. Hence, the design of Automotive Engine design varies though they perform the same functionality.
This is how simple OOPs concepts are. I hope you got at least little clarity on what OOPs is and what their features are.
This basically speaks OOPs in general terms.
If you really want me to write down the explanation of the OOPs in the programming point of view.
This is a revised version of my Medium Post
Stay Tuned for more posts.
Connect me email@example.com