Modularity: Packages

Learning outcomes

We will next focus on division of labour in programming from the viewpoint of the code. You will learn to understand the interface as a contract: our focus is on so called design by contract. You will learn to explain the roles of the responsibilities of the caller (precondition) and implementor (postcondition) and to use the invariant to find out when the object can be trusted to be in a sensible state. You will learn to use packages in your program and get to know Maven.

Let’s first refresh the role of the interface from the beginning of the course:

  • The interface tells the used how the service defined by the interface is meant to be used. It thus answers the question: “how is this used?”

  • For the implementor the interface defines how the interface should work. It asks the implementor the question: “does this work exactly as expected by the itnerface?”

As the implementation is not visible, and should not be visible, to the user, the documetation of the interface forms one othe the most important collaboration tool for software developers. The interface must be documented in a way that the services offered by the interface come across as well as how the interface should be used and what conditions there possibly are for the use. As the documentation of the interface is such an integral part of software development it is also integrated into the formalized commenting of code files. We will get to know the practical level next week but first, let’s focus on what needs to be documented from the interface in the first place.

Posting submission...