Reflect the client's view

The client is the calling code that uses the services of a class: it calls the public interface. The benefits of object-oriented design come from making an interface reflect the client's view of a class rather than the implementer's view, and from introducing abstractions that simplify the client's work. The client interface should reflect precisely the information relevant to the client's problem domain, and no more. The easiest way to do this is to design classes that correspond to the natural abstractions of a domain. Learning to do this well is key to learning object-oriented design.

Remember that developers of derived classes are also clients, and you should design the interface to simplify their work. Martin Carroll expressed this principle in "Design of the USL Standard Components," C++ Report, June 1993: "Contrary to popular belief, it is rarely possible to take an arbitrary class and derive a new, useful, and correct subtype from it unless that subtype is of a specific kind anticipated by the designer of the base class. A given class can be made extensible only in certain directions."


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker