1.7 Organization of the Pattern Language
Our pattern language consists of thirty-one patterns, organized into two broad categories: development patterns and structural patterns. Development patterns describe the characteristics of proven use case writing practices, and offer criteria for measuring the quality of the writing process. Structural patterns describe the basic components of use cases, explain how they should be organized, and offer criteria for judging their use. These two broad categories are further broken down into sub-categories of related patterns.
There are three subcategories of development patterns:
Team organizationpatterns for judging and improving the quality of how the use case team is organized
Processpatterns for judging and improving the quality of the methodology the team follows to create use cases
Editingpatterns for judging and improving the quality of the individual use cases as the underlying requirements change and the writer's knowledge grows
There are four subcategories of structural patterns:
Use case setspatterns for judging and improving the quality of a collection of use cases
Use casespatterns for judging and improving the quality of an individual use case
Scenarios and stepspatterns for judging and improving the quality of use case scenarios, and the steps within those scenarios
Use case relationshipspatterns for judging and improving the quality of the structuring relationships between the use cases in a collection
Each chapter in the remainder of the book addresses one subcategory.
Individuality and organizational cultures make it difficult to define a universal process for writing use cases. Instead, you have to do what "feels right" for your organization. But "feels right" is hard to quantify, as it depends on a host of variable factors. Although it is not the purpose of this book to recommend a specific use case writing process, we have identified several good characteristics of effective use case development. The development patterns in our language offer guidelines in several areas to help you improve your own process. These patterns cover three topics: (1) the composition of the teams writing use cases, (2) the techniques for creating a set of use cases, and (3) techniques for editing existing use cases into better ones.
Group dynamics is an important but often overlooked aspect of use case development. The personal interactions between the writers can affect the resulting use cases as much as the techniques that are used to identify and write them. This section of our book investigates the people issues associated with use case development, and outlines several techniques for optimizing writing teams, enabling them to produce better use cases.
Writing PreciseAndReadable (p. 138) use cases requires both a BalancedTeam (p. 39) (balanced skills and personalities) and a ParticipatingAudience (p. 35). The sponsors, developers, usage experts, and domain experts all contribute to the work and review it. However, too many writers soon spoil the plot, and so a SmallWritingTeam (p. 31) should be used for any one writing task.
Following a good process is critical to writing quality use cases. This process doesn't have to be elegant or "high powered," but it does need to cover all the bases. For developing use cases, good process means balancing discovery versus writing, and content versus need. You don't want to write use cases so quickly that you overwhelm the writers as they struggle to learn the system, nor do you want to be constantly rewriting or discarding your previous work. At the same time, you need to progress at a reasonably quick pace, so that your developers can begin building the system. You only want enough content to describe your system adequately; you don't want to waste time writing any more than that. This section of the book investigates process issues and offers some advice for improving yours.
Although we do not advocate any specific process for creating use cases, we find that effective groups work BreadthBeforeDepth (p. 48), naming many use cases before partially expanding some, and completing the main success scenario before investigating failure handling, achieving a SpiralDevelopment (p. 52) of the use case set.
The SmallWritingTeam (p. 31) integrates its work with a TwoTierReview (p. 64), where an inner circle of colleagues representing different specialties first reviews and adjusts the work before passing it to a large group with representatives from all stakeholders, including customers.
The effective team understands when it is QuittingTime (p. 68). Rather than getting bogged down in long arguments about cosmetic issues, team members allow a certain amount of WritersLicense (p. 73), recognizing that trying to enforce identical writing habits or petty standards soon stops adding economic value to the endeavor.
Not every project team needs the same volume of detail to accomplish its mission, and so we see the need for MultipleForms (p. 58) of use cases. Indeed, these forms may each find its appropriate moment on the same project!
Use cases can become prematurely outdated because the underlying requirements are highly unstable and subject to change. Use cases are highly dynamic, and will undergo metamorphosis as your understanding of the system evolves. Behavior that made sense at the start of the writing process may no longer make sense as you discover more about the system through research and talking to customers, resulting in a collection of obsolete or fragmented use cases. This section describes several common techniques for improving the quality of use cases.
During the writing process, team members will periodically find themselves with either large, complex, and hard-to-read use cases or lots of small, insignificant ones. They should RedistributeTheWealth (p. 204) of the large ones to smaller ones, and MergeDroplets (p. 209), folding the too-small ones into others. They may eventually discover that some are simply irrelevant; to deal with those, they can CleanHouse (p. 213).
We have identified four basic levels of use case structure: (1) sets of use cases, (2) use cases, (3) scenarios and steps, and (4) relationships. Use case sets describe the behavior of a system and consist of individual use cases, each of which describes some useful service an individual actor needs. Each use case is a collection of scenarios that, when taken together, describe all the different ways an actor can either reach or fail to reach a specific goal. Individual scenarios consist of steps, each describing an action that an actor or the system must take to move the primary actor closer to his or her (or its) goal.
Use cases often interact with other use cases in the same set. We have identified patterns for structuring some of these relationships. These relationship patterns describe techniques for handling repetitive or excessively complex behavior.
Use Case Sets
Use case sets are collections of use cases and related information, organized in a usable manner as a use case model. A set contains system-level information about a product, including its actors, its boundaries, and the relationships between its members. This level is primarily organizational, as it describes key characteristics of the collection rather than specific behavior. People working at this level often refer to individual use cases by name and ignore their contents.
The most important thing about use cases as a set is that they should reflect a SharedClearVision (p. 80) for a system with a clear and VisibleBoundary (p. 86). The use cases are collectively structured with higher-level use cases referencing lower-level use cases in an EverUnfoldingStory (p. 102) that shows a ClearCastOfCharacters (p. 90) interacting with the system to achieve their goals. While the goals that get described sit at various levels, the crucial and interesting ones describe UserValuedTransactions (p. 95), in which the primary actor accomplishes a goal that he views as a primary service of the system under discussion.
An individual use case illustrates how actors can use a system to meet a particular goal, showing all of the appropriate paths that they might take to get there, as well as those situations that could cause them to fail. This level is still organizational in nature, providing order and structure so that the reader is able easily to identify and follow the different paths through the use case as they trace the actor's progress toward his goal. It also serves as a focal point for related material.
Each use case contains a collection of successful and unsuccessful scenarios that describe the various situations that an actor is likely to encounter when attempting to achieve his goal. The failure cases are especially important, because they describe the various error conditions that can happen and the actions necessary to resolve them.
A single use case describes the pursuit of a CompleteSingleGoal (p. 118), and should have a descriptive VerbPhraseName (p. 122) that gives the reader an idea of its purpose. Each use case structures the multiple ways it can achieve or abandon its goal as a ScenarioPlusFragments (p. 125), with a collection of scenario fragments describing what happens under differing conditions. A complete use case considers ExhaustiveAlternatives (p. 129), so that the developers are not surprised with an unexpected situation late in development.
In order to satisfy the sponsor, the users, the developers, and the writers strive to make the use case PreciseAndReadable (p. 138), one of the arts of use case writing, and an achievable goal. One aspect of this is to remove performance requirements, data formats, and ideas for the user interface from the use case text, and document them separately as Adornments (p. 133). This practice keeps the use case robust with respect to shifting technologies and user interface designs, yet clean of unnecessary, confusing clutter.
Scenarios and Steps
Scenarios describe a single and complete sequence of events within a use case that an actor follows as she attempts to achieve a particular goal, and results in either success or failure. While scenarios describe behavior, they are still somewhat organizational in nature because they provide structure to a series of steps, which combine to form a coherent and purposeful description. This provides the reader with a systematic view of a particular action sequence.
Each scenario fragment after the main success scenario describes the behavior of the actors under some DetectableConditions (p. 148) (detectable to the system under discussion). Part of the readability of attractive use cases is LeveledSteps (p. 151), keeping all the steps at about the same level of detail.
Steps describe single actions within a scenario and detail the interchange between the system and actor as they act out a use case. Each step, depending on its goal level, adds some amount of clarity to its scenario, and represents a singular action that either the system or the actor takes as they interact.
Each step should make distinct ForwardProgress (p. 162) toward the goal. Since the user interface details and other design decisions appear as Adornments (p. 133), you can write each step in a TechnologyNeutral (p. 167) manner, to the greatest extent possible. Last, each step should make the ActorIntentAccomplished (p. 158), so that the readers always can tell who is doing what.
Use cases occasionally share some common behavior, and when they do, it is efficient to reuse existing text rather than repeat the same sequence of events each time they are needed. Ivar Jacobson defined the concepts of includes, generalizes, and extends to handle these situations. Unfortunately, everyone seems to have his or her own ideas as to what these terms mean. This section describes how people successfully use these concepts to improve their use cases.
People have developed a variety of overly complex mechanisms for using the includes, extends, and generalizes relationships. Some of these mechanisms work well; others just make a confusing situation worse. Simplicity seems to be the best course. The simplest and most natural relationship is to move the CommonSubBehavior (p. 176) to a subuse case referenced by the others via the includes relationship when a common set of actions recurs in several use cases. When a single event can interrupt the flow of a use case multiple times, then the writers should document those InterruptsAsExtensions (p. 182). If a given alternative begins to dominate the use case, then you should consider a PromotedAlternative (p. 190), promoting that alternative to an extension use case. While we have not seen enough examples of generalization to create a pattern, our colleague Dan Rawsthorne has contributed the pattern CapturedAbstraction (p. 198) which suggests when to use generalization.