Abstraction

Abstraction

 Abstraction

Hiding internal implementation and just highlet the set of services what we are offering is a concept of abstraction.

Through bank ATM GUI screen, bank people are highlighting the set of services what they are offering without highlighting internal implementation.

In another word-:

Abstraction is a process of hiding the implementation details and showing only functionality to the user.
Another way, it shows only essential things to the user and hides the internal details, for example, sending SMS where you type the text and send the message. You don't know the internal processing about the message delivery.

There are two ways to achieve abstraction in Java

  1. Abstract class (0 to 100%)
  2. Interface (100%)

The main advantage of abstraction are-:

  • We can achieve security because we are not highlighting our internal implementation.
  • Without affecting outside person, we can able to perform any type of changes in our internal system and hence enhancement will become easy.
  • It improves maintainability of the application.
  • It improves easy ness to use our system.

Disadvantages of Abstraction in Java:
  • Abstraction can make it more difficult to understand how the system works.
  • It can lead to increased complexity, especially if not used properly.
  • May limit the flexibility of the implementation.
  • Abstraction can add unnecessary complexity to code if not used appropriately, leading to increased development time and effort.
  • Abstraction can make it harder to debug and understand code, particularly for those unfamiliar with the abstraction layers and implementation details.
  • Overuse of abstraction can result in decreased performance due to the additional layers of code and indirection.
Encapsulation vs Data Abstraction
  • Encapsulation is data hiding(information hiding) while Abstraction is detailed hiding(implementation hiding).
  • While encapsulation groups together data and methods that act upon the data, data abstraction deal with exposing the interface to the user and hiding the details of implementation.
  • Encapsulated classes are Java classes that follow data hiding and abstraction, while We can implement abstraction by using abstract classes and interfaces. 
  • Encapsulation is a procedure that takes place at the implementation level, while abstraction is a design-level process.

Reference-:
   Oracle Java Tutorials: Abstraction: