Data abstraction

Data abstraction

Data abstraction is a principle of data modeling theory that emphasizes the clear separation between the external interface of objects and internal data handling and manipulation. In many programming languages, interfaces (or abstract classes) provide abstraction, and their concrete implementations form the implementation.

This abstraction allows a much simpler API for the system models, mostly objects of different classes while having a complex internal structure. This separation enables APIs to remain essentially unchanged while the implementation of the API can improve over time. The net result is that the ecosystem built around the APIs does not break with every iterative refinement of the implementation.

What are interfaces?

Interfaces are a structure of object-oriented programming language that defines the external behavior of data structures without defining how the data is stored. Each interface outlines the basic operations allowed on the data type. It becomes the responsibility of any data type that implements the interface to populate the functionality.

For example, the map type is an interface that offers a lookup functionality. This interface can be implemented by a binary search tree or by a list of two-element tuples. Either implementation can offer the lookup method and act the same for any user of the map data type.

Write clean and secure code with DeepSource

Powerful static analysis that takes 5 minutes to set up and helps you fix code health and security problems on every pull request.