(ref.doc)Coggins
Next OOSC
Prev: Coplien-psi
Up: Top
[Coggins]
Designing C++ Libraries
in Usenix C++ Conference Proceedings, 1990
James M. Coggins
Newton said he saw farther because he stood on the shoulders of
giants. Computer programmers stand on each others' toes.
...one of the main reasons for adopting object-oriented design:
organizing the name space.
A name space makes a poor database. This is exactly why conventional
libraries with flat name space are difficult to use as the library
grows larger.
Computer people are a friendly, cooperative folk until we enter the
arena of user interface design. On this topic, programmers are
passionate, interested, parochial, bigoted, and deeply ignorant. And
the situation is not getting better. The appeal of user interface
design is clear: the immediate, visible results and the unlimited
potential for midnight hacking are powerful aphrodisiacs in this
community.
Design criterion: separation of concerns
1. Data structure encapsulations
2. Process encapsulations
3. Device encapsulations
4. Interface encapsulations
Process encapsulations (I also call these "enzymes") embody processes
or modes of interaction between objects of other classes. [...]
Process encapsulations accept an object and some kind of "go" signal
and produce as output a new object. The operation of the process
encapsulation might be adjusted by parameters settable using member
functions of the process encapsulation or by parameters to
constructors.
[...]
When a procedure should be implemented as an enzyme class rather than
as a member function? If the procedure is general enough to interact
with several existing classes, it should be an enzyme. If the
procedure is compute-intensive and could be optimized for speed by
precomputing data in the constructor, then it should be an enzyme. If
the procedure is experimental and therefore is subject to frequent or
drastic change, then it should be implemented as an enzyme in order to
isolate the changes from the rest of the library. If the operation of
the procedure depends on the setting of a group of parameters, it
might be implemented as an enzyme to keep the client free of the
clutter of the parameters and the member functions to manipulate them.
automatically generated by info2www version 1.2.2.8