What is Abstraction in OOPs?

What is Abstraction in OOPs is an important question in programming. When you start learning a programming language nowadays. You realize that you will have to learn Object-Oriented Programming concepts. As soon as you start understanding Object Oriented programming concepts, you come to know that we have 6 concepts in OOPs which are mentioned below.

  1. Object
  2. Class
  3. Inheritance
  4. Polymorphism
  5. Encapsulation
  6. Abstraction

Abstraction is one of those 6 basic concepts of programming. Usually, Abstraction is literally omnipresent. Let me give you an example.

When you began to learn how to drive a car, did you feel you will have to know the mechanism of a car engine? I know your answer will be No. I mean it’s a good idea if you know it but you can learn to drive without mastering the working of an engine.

You just need to know the basics or your car.

  1. How to start your car?
  2. How to stop it?
  3. How to take a turn.
  4. What type of fuel your car consumes?
  5. How many gears are there in your car or it’s an automatic car?
  6. The traffic rules and presence of mind obviously.

With the above information you can be a good driver. But do you know there are a lot of things those are hidden from your view. Those complex things are

  1. The design of an engine.
  2. What gives that engine so much power. How does an engine generate so much thrust?
  3. What happens inside an engine when you start or stop the car.
  4. What happens when you use the breaks and how does a car stops.

Why do these things are hidden and why you don’t need to know it? The simple answer is because they are complicated. This is the definition of Abstraction.

What is Abstraction in OOPs

Hiding the body of complex classes in programming and revealing only what is necessary. This is termed as Abstraction in the programming world.

When we say showing only what is necessary, it means you only need to know what type of and how many parameters that class will take to give you your desired output.

For example, We have been using Console.WriteLine() to write something on the console screen. If you are a good student of programming, you would know there is a Console class and inside that, there is a method called WriteLine. You are making use of the WriteLine method to print something on the console screen but you don’t need to know the code of the WriteLine method. This is called Abstraction.

Benefit of Abstraction

Abstraction is something that allows you to use everything in modules. Once you have created something complicated after a lot of brainstorming. You can make that available to the next generation programmer as a module. The next generation programmer will use that module and take the benefit of your hard work without even knowing how you coded that module that he is using as a tool in the form of a module. It will save him a lot of time and effort.

The time he will save using your class as a module he can use that time to create something more complicated using your module and make that available to the next generation.

Drawback of Abstraction

I watched the interview of a computer scientist who was putting his two cents on the drawbacks of Abstraction, I agreed with what he mentioned.

He said, Abstraction in programming can be useful at times but the Abstraction in the real world is a bit harmful. He says, devices that we are using nowadays are very complicated, we need some minds who understand the way these devices work. For example, an iPhone is an incredible piece of engineering. The phone has only one button that does everything, the kids nowadays know how to use an iPhone but these kids are likely future scientists and engineers.

Not only the iPhone but the majority of electronic devices nowadays are the use and destroy. The devices are designed in such a way that they are just a combination of modules working together and can be fixed easily without even understand how these modules are working together. If the kids will not understand their complexity, their critical thinking will not develop hence we will be in trouble at some point in the future.

This was it. I hope you have understood what is Abstraction in OOPs and Abstraction in general. In case of any confusion, feel free to comment. I will be glad to read your comments.

Stay Safe Stay Healthy!

Get real time updates directly on you device, subscribe now.

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More