Skip to content

Abstraction

Estimated time to read: 1 minute

Overview

Abstraction is the idea of simplifying a concept in the problem domain to its essentials within some context.

It allows you to better understand a concept by breaking it down into a simplified description that ignores unimportant details.

It emphasises the essentials needed for the concept, whilst removing detail that is not required.

What is an Abstraction?

Abstraction is the base upon which Encapsulation, Inheritance and Polymorphism are derived from. It is the concept of simplifying complex operations into its constituent parts.

Abstraction only exposes what is required to complete a task or to solve a problem. Methods unique to the abstraction are hidden away, they complete their task and should not need to be exposed publicly.

You, as the user, should not need to worry about what is going on under the hood if you give the abstract class / layer the correct data. It should do its job - Toby

Principles of OOP.png

Rule of Least Astonishment

An abstraction captures the essential attributes and behaviours for a concept with no surprises and no definitions that fall beyond its scope. Do not include irrelevant characteristics.