Abstraction in Java

Okay ! today we talk about Abstraction, a lot of you know what “abstract” keyword means,

and how to use it to achieve polymorphisme, but what Abstraction really means ?

In simple words: “Abstraction captures only those details about an object that are relevant to the current perspective.” it’s a bit of a  fancy definition , but essentially Abstraction defines object’s that acts as “abstract actors” ,they can communicate , perform work , and report their change of state.

it can also work as kind of a layer(s) to hide how low level  work is done, and make the programmer focus on doing bigger stuff, and not concerne himself  with all the jargon

from low level communication and network buffering, to splitting a string or sorting an array .

It’s good to know that their is two types of abstraction

Control Abstraction :

All software written is just a bunch of statements and declarations that are repeated (one way or another) or similar in structure.

Control abstraction is the process of identifying all such statements and expose them as a unit of work. We normally use this feature when we create a function to perform any work.

Data Abstraction :

Is the way to create complex data types and exposing only meaningful operations to interact with data type, where as hiding all the implementation details  from outside world.

Benefit of this approach involves capability of improving the implementation over time e.g : solving performance issues, easy debugging ,easy backward compatibility …

The idea is that such changes are not supposed to have any impact on client code, since they involve no difference in the abstract behaviour.

Well that’s it for Abstraction , Happy Coding …

Leave a comment