The challenge is how to describe the abstract semantics in its full generality: just how widely is the component adaptable? This often requires creativity, and several tries--you might not realize how general the component is until you attempt to describe it carefully. Entirely new ways to use it may be suggested. Also you may have to define new concepts, by means of sets of requirements, in order to organize your descriptions coherently. The remaining discussion in this section will emphasize techniques for describing a component in its full generality and avoiding descriptions that would unnecessarily exclude certain uses. Once again, we look at examples of user-level generic component documentation from the SGI Web pages on STL. There are a few places where the SGI documentation does not describe
components in their full generality, such as the Specifying conceptsThe following definitions briefly summarize the terminology used in documenting generic software using concepts.
Specifying functionsConsider the STL generic merge function. Do you see how it can it be used more generally than the SGI description implies? An effective way to describe the input-output relation computed by a function is in terms of preconditions, postconditions, and effects.
When it may be necessary to explain design decisionsSometimes, if some aspect of a component interface design is different from what is usually described in textbooks or seen in other libraries, it is helpful to the user to explain it. For example, the SGI documentation of the STL queue adaptor takes the trouble to explain why the pop member function has a void return type. TipsFinally, you can help the user by including tips for use of components. Tips go beyond how to use a component to describe how to use it well. Example: in the SGI description of the STL vector component, see the tips relating to storage management given in the notes at the end of the page. |