One way to help achieve (2) (which helps with (1)) is to use abstract data types, or ADTs. The idea of an ADT is to separate the notions of specification (what kind of thing we're working with and what operations can be performed on it) and implementation (how the thing and its operations are actually implemented).
The benefits of using ADTs include:
Fortunately for us, object-oriented programming languages (like Java) make it easy for programmers to use ADTs: each ADT corresponds to a class (or Java interface - more on this later) and the operations on the ADT are the class/interface's public methods. The user, or client, of the ADT only needs to know about the method interfaces (the names of the methods, the types of the parameters, what the methods do, and what, if any, values they return), not the actual implementation (how the methods are implemented, the private data members, private methods, etc.).
There are two parts to each ADT:
In general, there are many possible operations that could be defined for each ADT; however, they often fall into these categories:
In this class, we will study a number of different abstract data types, different ways to implement them, and different ways to use them. Our first ADT (coming up in the next set of notes) is the List.