next up previous
Next: Techniques for Deriving Up: A (Brief!) Catalog Previous: A (Brief!) Catalog

Techniques for Generalizing Components

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.

  1. Identify design decisions that may be abstracted, parameterized, or otherwise ``undone.''
  2. Identify dependencies or commitments to remove.
  3. Replace global context (hard-wired external dependencies on other software components) by parametric context (user-definable, parameterized dependencies).
  4. 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()).
  5. 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.
  6. 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