top of page
Writer's pictureyashponnaganti

Abstraction in OOP

Object oriented programming (OOP) is full of complex concepts which are used to represent the real world in the form of coding. Upcoming software designers & developers need to understand these concepts in order to effectively code the applications. OO programming is totally different from procedural ways of thinking.


Abstract art for coding


Abstraction, inheritance, encapsulation & polymorphism are four foundational concepts in object oriented analysis & design (OOAD). Today, we will learn about the abstraction in this session. I will cover the rest of the topics in future sessions.


Abstraction is all about hiding the internal details in your class from other people. The best example to understand the abstraction is the car. Consider a car manufacturer who has a deep understanding of the internal functions of working engine, steering wheel, brakes, and more. However, as a car owner, you don't need to be concerned with the internal and complex details of how the brakes functions. Your only concern is to use the brakes for driving the car. Essentially, the car manufacturer shields you from the internal functionality of the car.You just need to know how to drive the car. This is exactly an abstraction. i.e. hiding the internal details from outside people. In coding terms, abstraction mirrors the car analogy. It involves encapsulating the inner workings of a system, such as classes and functions, and providing a simplified interface for users to interact with, much like driving a car without needing to understand the engine's components.


Now, coming to the programming world, this is how it looks.


Abstraction car analogy




You can see that the data & methods are hidden from the outside world. The outside class, ‘Car owner’ , can invoke the methods like driveStright(), turnLeft(), turnRight(), reverse(), … etc while driving the car.


The outside class, ‘Car owner’ , does not have access to the data of the class & internal details of the methods (). An interface has been provided to access all internal details of the car. Think about it, you have a push button to start the car, knob to increase/decrease the music volume, buttons to control the AC/Heating, … etc. These buttons/knobs are called interfaces. An interface is a mechanism through which the outside people can access the behavior of the car.




Watch this video to gain a deeper understanding of abstraction:



Hope, you understood the basic concepts about abstraction. Please feel free to provide your feedback.


Thank you for reading my article.


Yashwant Ponnaganti.


bottom of page