Advantages of Abstract Data Types

Abstract data types offer several advantages over concrete data types:

Example:

Java's standard libraries supply several different implementations of its Map data type. The TreeMap implementation might be more efficient when a total ordering on the keys can be computed quickly but a good hash value is hard to compute efficiently. The HashMap implementation might be more efficient when hash values can be computed quickly and there is no obvious ordering on keys. The part of a program that creates a Map can decide which implementation to use. The parts of a program that deal with a created Map don't have to know how it was implemented; once created, it's just a Map.

If it weren't for abstract data types, every part of the program that uses a Map would have to be written twice, with one version to deal with TreeMap implementations and another version to deal with HashMap implementations.

These advantages become more important in larger programs, so they often go under-appreciated by programmers with limited experience.