Need for Abstract Data Type and ADT Model

Prerequisite: Abstract Data Types or ADT

Why Abstract Data Type became a necessity?

  • Earlier if a programmer wanted to read a file, the whole code was written to read the physical file device. So that is how Abstract Data Type (ADT) came into existence.
  • The code to read a file was written and placed in a library and made available for everyone’s use. This concept of ADT is being used in the modern languages nowadays.

Example:
The code to read the keyboard is an ADT. It has a data structure, a character, and a set of operations that can be used to read that data structure.



  • ADT does the work that is necessary implementation and it is not of much concern that how the work is being done. It is like unspecified implementation which can be termed as Abstraction.
  • Consider we want maintain a record of quantity of items sold in a sale. At least three possibilities of data structure are there. One can use a linear list or an array or may be a vector to save space and dynamic memory allocation or a linked list so that there is no missing item. A user does not need to know the hidden implementation as long as the data is being entered and obtained correctly.
  • For definition refer to Abstract Data Types

Abstract Data Type Model

There is an interface between Application Program and the Abstract Data Type present at the right. ADT consists of the data structures and the functions(private and public) which are interconnected with each other. Since they are entirely present in the ADT so they are out of the scope of the Application Program.

  1. ADT Data Structure
    • All data that is being processed is maintained in a data structure and its implementation must not to be known to the user.
    • At the same time all the data about the structure should be present inside the ADT because just encapsulating the data in ADT is not sufficient.
  2. ADT operations
    • Data is inserted, deleted and updated through the application program via the interface. The functions that are publicly declared are directly accessible otherwise not since only the parameter name and number of such parameters is available to the users.
    • There is a particular algorithm for every Abstract Data Type for a specific task to be performed.


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.