Object Oriented Libraries

Code reuse is often the most effective way to enhance productivity. Libraries are repositories of reusable code and often are one of the most important ingredient in a programming environment. While libraries have existed for a long time, this section examines how they evolved with the advent of newer programming techniques, including object oriented programming.

Reporting cleanly errors, encountered deep in a library, to the calling program has been a challenging problem in library design. With exceptions, it is much easier to construct simple to use libraries with good error handling and reporting facilities.

Similarly, generic modules help build general, easily reusable, library modules. In the past, libraries used techniques such as macro pre-processing or blind type conversions to achieve similar benefits. These techniques, however, were inconvenient and often inefficient or error-prone.

An increased emphasis on encapsulation, through well defined public interfaces, helps reduce the effort required to understand how to use a library module. Furthermore, it reduces greatly the dependence of the calling programs on the internal composition of library data structures. The resulting libraries have a simpler interface which does not change, even when the internal data structures are modified as newer versions are released.

Objects and inheritance may help reduce the number of procedures required in a library to achive a given functionality. Indeed, some procedures may operate at a high level in the inheritance hierarchy and thus be shared by a large number of child classes.



Copyright 1995 Michel Dagenais, dagenais@vlsi.polymtl.ca, Wed Mar 8 14:41:03 EST 1995