What is Abstraction?

What is Abstraction?

What is Abstraction?

What is Abstraction?
  • Abstraction is one of the most important principles in object-oriented software engineering and is closely related to several other important concepts, including encapsulation, inheritance, and polymorphism.
  • Hiding internal implementation and just highlight the set of services what we are offering, is the concept of abstraction.
  • Through Bank ATM GUI screen bank people are highlighting the set of services what they are offering without highlighting internal implementation.
  • The main advantages of abstraction are
    1. We can achieve security because we are hiding our internal implementation.
    2. Without affecting outside person we can able to perform any type of changes in our system and hence enhancement will become easy.
    3. It improves maintainability of the application.
    4. It improves easiness to use our system.
  • By using interfaces and abstract classes we can implement Abstraction.
  • Abstract classes may or may not contain abstract methods, i.e., methods without the body ( public void get(); )
  • But, if a class has at least one abstract method, then the class must be declared abstract.
  • If a class is declared abstract, it cannot be instantiated.
  • To use an abstract class, you have to inherit it from another class, provide implementations of the abstract methods in it.
  • If you inherit an abstract class, you have to provide implementations to all the abstract methods in it.
  • Abstraction is one of the key concepts of object-oriented programming (OOP) languages. Its main goal is to handle complexity by hiding unnecessary details from the user. That enables the user to implement the more complex logic on top of the provided abstraction without understanding or even thinking about all the hidden complexity.

Let’s Study Abstraction concept with an Example

Suppose you want to create a banking application and you are asked to collect all the information about your customer. There are chances that you will come up with following information about the customer

But, not all of the above information to create a banking application.

So, you need to select only the useful information for your banking application from that pool. Data like name, address, tax information, etc. make sense for a banking application

Since we have fetched/removed/selected the customer information from a larger pool, the process is referred to as Abstraction.

However, the same information once extracted can be used for a wide range of applications. For instance, you can use the same data for hospital application, job portal application, a Government database, etc. with little or no modification. Hence, it becomes your Master Data. This is an advantage of Abstraction.

Leave a Reply

Your email address will not be published. Required fields are marked *

*