The next major innovation in programming languages was the introduction of the idea of modules. A module is basically a mechanism that allows the programmer to encapsulate a collection of procedures and data, and supply both import and export statements to control the visibility of features from outside the module.

The module solved the problem of encapsulation. We could export the data structure access routines (push, pop and the like), while hiding the internal representation.

Parnas's principles, described on the next slide, were an effective set of guidelines for the creation and use of modules.

But, what would happen if your programming task required two or more instances of the same type of object, for example two or more stacks? Modules by themselves did not provide any solution to this problem.

[audio] 37 [real] 37 Text to accompany slide 37, in Chapter 1 of An Introduction to Object-Oriented Programming