Pages

Sunday 11 September 2011

Advantages of ADT

Some advantages of ADT over the conventional data structures are

  • ADT is reusable, robust, and is based on principles of Object Oriented Programming (OOP) and Software Engineering (SE)
  • An ADT can be re-used at several places and it reduces coding efforts
  • Encapsulation ensures that data cannot be corrupted
  • Working of various integrated operation cannot be tampered with by the application program
  • ADT ensures a robust data structure
ADT approach is based on the SE concepts of coupling and cohesion
Coupling property determines
  • How strongly two separate parts of programs are linked together
  • Extend to which changes made in one part impacts the other parts of a software module
Well designed software has a minimum coupling. An ADT promotes weak coupling.
Cohesion determines how well-integrated are components of software. An ADT inherently promotes maximum cohesion.

Abstract Data Types (2)


  • All built-in primitive data types are in fact abstrat data types
  • In floating point type, for example we cannot add a new operation, say, exponentiation
  • We cannot enhance or shrink the set of allowed values
  • ADT does not specify how the data structure would be coded
  • It does not describe whether data elements are stored in consecutive or disjoint locations
  • The implementation details are hidden from the application program
In software module, an ADT can be viewed as layer between application that uses it and a component that implements ADT.

Some high level languages provide support for ADT in different ways
  • C has built-in struct type
  • In C++, a class construct can be used
  • In Java, an ADT can be expressed as Interface

Saturday 10 September 2011

Abstract Data Types (1)

An Abstract data type (ADT) combines the description of data structure, and associated operations
ADT has following characteristics:
  1. Provides a description of element in terms of data types
  2. Defines relationship among individual elements
  3. Valid operations and parameters to be passed
  4. Error conditions associated with the operations

For Example an ADT stack can be defined by pakaging together the following operations
  • Push - Inserts an item into the stack stk
  • Pop - Returns a data item from stack stk
  • Peek() - Returns top most element with out removing it from the stack
  • Size() - Returns no of elements currently in the stack
  • isEmpty() - Returns true if stack is empty, and false otherwise
  • Set of operations associated with ADT is called interface
  • Elements of ADT data structure are manipulated through an interface
  • The figure shows how elements of ADT are accessed using interface
  • Implementation of operations and data items are hidden from the application program
 Abstract Data Types Part (2) Coming..