This article explains abstraction layers, which you can use in many programming domains. Let’s get started.
What is an abstraction layer?
The abstraction layer creates a separation between two things. For programming, this is often splitting tasks into separate entities.
For example, an entity A might be assigned the task of fetching an image from a database and then processing the image when retrieved
Creating an abstraction layer will split this entity A into entities A and B, where:
- Entity A fetches the resource.
- Entity B—now the abstraction—depends on the image to return from the first operation to then perform its second operation.
The abstraction layer allows one party, or operation, to be entirely responsible for one task while a dependent waits for that party to return data for them to process.
Abstraction in code
APIs are abstraction layers. While APIs serve many purposes, the way they are used is this: a developer is trying to create an application…