Abstraction

Abstraction is the process of describing the general concept of an object without defining its specific details.

 

For example, we all understand what a motorbike is and your idea may be slightly different to someone else's (they might think it is red, has a specific engine size, or manufacturer), but in general terms you understand the concept of a motorbike because you've seen enough motorbikes and can abstract the essential details of a motorbike without having to go into too much detail.

 

 

We know that a motorbike has two wheels, handlebars and an engine, i.e. we know its prerequisites, the bare minimum that make this a motorbike.

 

We also know that a motorbike doesn't have a foot or branches so we can forget about those things since they have nothing to do with a motorbike.

 

Therefore, abstraction focuses on the common essential qualities of an object rather than any specific example.

 

Abstraction is at the very core of OOP, since it is this concept that allows us to create classes and from there to create objects.

 

We can therefore create a single class that can create many objects based on that class, with its common abstracted qualities.

 

This allows us to focus on what an object should have, specific to the application's requirements and the context.

Leave a Reply