Skip to main content

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:



Popular posts from this blog

Java

Codes With Java — Basics Codes With Java Java tutorials & fundamentals About Contact Privacy Basic Fundamentals Java source file structure Import Statement Static Import Packages Data Type Variables Final Variable Declaration and Access Modifier Inner classes applicable modifiers Static Modifier Synchronized Native Transient Volatile Interface Introduction Interface Declaration and Implementation Interface methods and variables Naming Conflicts Interface Marker interface and Ad...

Short Circuite Operators part 4

                                                             Short Circuit Operators In  Java logical operators , if the evaluation of a logical expression exits in between before complete evaluation, then it is known as  Short-circuit . A short circuit happens because the result is clear even before the complete evaluation of the expression, and the result is returned. Short circuit evaluation avoids unnecessary work and leads to efficient processing. 1-: AND(&&) 2-:OR(||) these are exactly same as bitwise operators (&,|) except the following differences. Single Short Circuit Operator(&,|) Both arguments Should be evaluated always. relatively performance is low. Applicable for both boolean and Integral types. Double Short Circuit Operator(...

Operators & Assignment part 3

                                                                                       Operators & Assignment 1-:instanceof Operators 2-:Bitwise Operators                                                                        instanceof Operators we can use instanceof operator to check whether the given object is of a particular type are not. Example-: /* list is a collection of objects. List l=new List(); l.add(Customer); l.add(Student); l.add(Test); Object o=l.get(...