khit-group Toll: 1800-986-4152

Data Abstraction

Abstraction is the process of recognizing and focusing on important characteristics of a situation or object and leaving/filtering out the un-wanted characteristics of that situation or object.

Data abstraction is usually the first step in database design. A complete database is much too complex a system to be developed without first creating a simplified framework. Data abstraction makes it possible for the developer to start from essential elements -- data abstractions -- and incrementally add data detail to create the final system.

Benefits of Data Abstraction-

1 Class internals are protected from inadvertent user-level errors, which might corrupt the state of the object.

2 The class implementation may evolve over time in response to changing requirements or bug reports without requiring change in user-level code.

This principle is at the core of Object Orientation. In this form 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 would be only add and delete operations separately but their association with the queue data will not be captured. Similarly, 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.

(1) Identify simple data abstractions in your kitchen and associated operations. Justify these abstractions by showing that when requirements change, these abstractions will help to manage the change.

(2) Identify operations that can be associated with the counter abstraction.