Open In App

Need for Abstract Data Type and ADT Model

Last Updated : 13 Jun, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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.

Abstract Data type :

    An abstract data type is also known as ADT. It means providing only necessary details by hiding internal details. 
In short abstract data, types have only data not how to use or implement it. Also, it can be created at the level.
An object like list, set graphs with operations like 

  1. Insert 
  2. Locate
  3. Retrieve
  4. Delete
  5. MAKENULL()
  6. Print()

Considered as an abstract data type.

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

Advantage :

  1. Used to create a fast algorithm in less time.
  2. Help to manage and organize the data.
  3. It makes code clean and easy to understand.
  4. It makes the execution program fast.
  5. Consume less time.

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. 

Working :

abstract data type model is considered as a combination of abstraction and encapsulation.
abstract data type model  at level first encapsulation is performed then at second level abstraction is performed on the data structure.

but what is abstraction and encapsulation?

Abstraction
Abstraction means hiding internal details and showing only functionality.

Encapsulation
Combining the data and the member function in a single unit is considered encapsulation.

  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.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads