Data abstraction

Data abstraction is the reduction of a particular body of data to a simplified representation of all the data.

Abstraction is the process of taking away or removing the characteristics from something in order to reduce it to a set of important characteristics. In abstract art, the representation is likely to be one potential abstraction of a no. of possibilities. A database abstraction layer, for example, is one of a number of that possibilities.

Forms of Abstractions in Programming :

  • Procedural Abstraction
  • Data Abstraction

Procedural Abstraction:

Procedural abstraction gives mechanisms for abstracting well defined procedures or operations as entities. The implementation of the procedure requires a number of steps to be performed. A simple example is a debit operation which performs various steps to debit certain amount from the bank account. Hence at the banking level, credit and debit become well defined procedural abstractions.

Procedural abstractions are used extremely by requirements analysts, designers and programmers.

Procedural abstractions are normally characterized in a programming language as “function/sub-function” or “procedure” abstraction.

Data Abstraction:

Data Abstraction’s principle is the core of Object Orientation. In this type of abstraction, instead of just focusing on operations, we focus on data first and then the operations that manipulate the data. A simple example is queue data and the associated operations add() and delete(). Both add() and delete() operations manipulates queue data. In a simple procedural abstraction, there will be only add and delete operations separately but their association with the queue data will not be captured. As like in the bank example discussed above, credit and debit operations get associated with the bank account data.

The advantage of data abstraction over procedural abstraction is that the data and the associated operations get specified together and hence it is easy to modify the code when data changes. For example when the queue data structure changes from array structure to linked list, it is easy to figure out the associated operations that need to be changed. It is also easy to add code associated with requirements change. For example if the queue needs to be reset at regular intervals, a simple reset() can be added.