ADT: Abstract Data Type
The description of a data type is distinct from
its computer implementation
An abstract data type defines a data type in
terms of a type and a set of operations on the type
- details of implementation are hidden
(encapsulation)
- a data structure is the physical implementation of the ADT
Data at 3 different Levels
Application (or user) level: modeling real-life data in
a specific context.
Logical (or ADT) level: abstract view of the domain and
operations. ...WHAT
Implementation level: specific representation of the structure
to hold the data items, and the coding for operations. .......HOW
|
Abstract Data Type
- Implementation Independent
- High-Level Description of the data
and Operations that Manipulate
them.
- In OOP: e.g. UML class diagram
|
Data Structure
- Implmentation of an ADT
- specifically how we represent the data,
and through algorihtms how
we manipulate them.
- In OOP: the actual coded class with variables
and methods.
|
Understanding ADTs is understanding how to manage complexity through
abstraction
Example: A library
- Application (or user) level: Library of Congress, or
Baltimore County Public Library.
- Logical (or ADT) level: domain is a collection of books;
operations include: check book out, check book in, pay fine, reserve
a book.
- Implementation level: representation of the structure
to hold the “books”, and the coding for operations.
|
ADT Operator Categories
|
Constructors
creates a new instance of the ADT
|
Transformers/ Mutators
alters the state of one or more of the data values associated
with the ADT
|
Observers
obtains information about the state of one or more data balues.
- predicates - tests if a certain property is true
- accessor/selector - returns a copy of an item
- summary - returns info about the ADT as a whole.
|
Iterators
process all components in a data structure in some sequence.
|
|