Learning materials

Data Abstraction in Java

On this page

Abstract Data Type

  • Definition and Purpose of ADTs
    • Abstract Data Types (ADTs) are high-level data structures that encapsulate data and operations on that data. They provide a way to abstract and model real-world concepts or entities in software.
    • ADTs focus on the behavior and functionality of data rather than its implementation details, allowing programmers to work with data structures at a higher level of abstraction.
  • Benefits of Using ADTs
    • Modularity: ADTs promote modular design by encapsulating data and operations, making it easier to manage and maintain complex systems.
    • Code Reusability: ADTs can be reused across multiple projects or modules, saving development time and effort.
    • Security and Reliability: ADTs enforce data integrity and encapsulation, reducing the risk of errors and ensuring reliable and secure data manipulation.
    • Abstraction: ADTs provide a higher-level abstraction, allowing programmers to focus on the problem domain rather than low-level implementation details.

ADT in Java

  • Defined as Java interfaces
    • Not all interfaces are ADTs
  • Collection of public interfaces are often known as a Java API (Application Programming Interface)
  • Implemented as Java class that implements the interface
  • Used in Java client classes
  • Complicated inheritance hierarchy of ADTs may occur
    • Interface inheritance
    • Implementation inheritance

Relationship to Data structures

  • ADTs are a high-level abstraction of data structures
  • Data structures are a low-level implementation of ADTs
  • In Java
    • ADTs are defined as interfaces
    • Data structures are defined as classes that implement the ADT interfaces