Originally posted on my medium page: https://medium.com/@otarutunde
Abstract Datatype (ADT)
What exactly is an ADT?
An ADT is a mathematical model for data types, where a data type is defined by its behavior (semantics) from the point of view of a user of the data, specifically in terms of possible values, possible operations on data of this type, and the behavior of these operations. This contrasts with data structures, which are concrete representations of data, and are the point of view of an implementer, not a user.
Formally, an ADT may be defined as a “class of objects whose logical behaviour is defined by a set of values and a set of operations”
We might have heard Abstract data types and Data structures being used interchangeably, but what exactly is the difference between these two:
To put is simply, ADT is a logical description and data-structure is concrete.
Following the definition above, ADT is implementation independent for example, an abstract data type List consists data and what operations can be performed on the data but it has no information about how the List is actually implemented whereas data structure is implementation dependent, it is about how the List was implemented using Arrays or LinkedLists. Ultimately, a data structure is an implementation of a datatype.
Don’t worry if you are confused at this stage with some of the names we have mentioned above (Arrays, LinkedLists etc..). We will talk more about them later in subsequent series, you can always refer back to this article when you need to.
This separation of concerns is good because it enables computer theoreticians to come up with more Abstract Data Types and leave the implementation details to be decided by the language/programmer.