What is abstraction in OOP?

Abstraction is the process of removing unnecessary characteristics from something in order to reduce it to a set of essential, well defined characteristics. In object-oriented programming, abstraction is one of central principles, along with polymorphism, inheritance and encapsulation, closely tied with the last two.

Through the process of abstraction, a software developer hides all but the relevant data about an object in order to reduce it's complexity and increase efficiency. The resulting object can be referred to as an abstraction, meaning a particular entity made up of selected attributes and behavior specific to a particular usage of the originating entity.

For example, you decided that you need Customer class for your banking application. While you can assume that Customer possesses some characteristics of human in real world, probably you don't need such information as his weight, eyes color or feet size. However, you might need information about his age. Process of decision-making about what information you need in your class and what you can oppress in particular case for particular entity is called abstraction.

Short answer

  • Abstraction is one of the four fundamental concepts in OOP.
  • Abstraction in OOP is the process of removing unnecessary information from programming entity in order to reduce it to a set of essential, well defined characteristics.

Comments