Next: Techniques for Deriving
Up: A (Brief!) Catalog
Previous: A (Brief!) Catalog
Generalizing components is the heart of ``designing for reuse.'' To
make components more reusable in a wider range of contexts, one should
concentrate on ``undoing'' or backing out any design decisions that
are context specific, removing dependencies, and removing
commitments.
-
Identify design decisions that may be abstracted, parameterized,
or otherwise ``undone.''
-
Identify dependencies or commitments to remove.
-
Replace global context (hard-wired external dependencies on other
software components) by parametric context (user-definable,
parameterized dependencies).
-
Consider recasting ``large-effect'' operations as objects with a
well-defined set of ``small-effect'' operations.
Large-effect operations are ones that significantly change the
state of one or more objects in a single step (like
Sort()).
-
Write non-defensive basic components that have customizable
behavior for error conditions.
Defensive versions can be layered on top of these, so that clients
always have the choice of which one is more effective for their
situation.
-
Generalize from several instances, rather than just one. In other
words, look at two or more implementations of similar functional
interfaces used in different contexts before trying to create a
``generalized'' component to play that role.
Larry Latour
Sun Sep 17 21:09:35 EDT 1995