A use case diagram is the highest level of
abstraction available in UML. Use cases are collections of related
activities that work toward a particular goal.
They're part of the requirements gathering process
rather than the design process itself, and can be as detailed or as
generic as is necessary to communicate system requirements.
The challenge here is often to make the requirements accessible and
useful to both the design team and the domain experts involved in the
project. Depending on need, the size of the team and the preferences
of those leading the development a project might have two or three
use cases, or dozens, or even more, although there is generally a
point at which the sheer volume of use cases grows unmanageable.
A "Buy Groceries" use case, for
example, could consist of selecting food, checking out, processing a
credit card, and bagging groceries. The use case can also incorporate
internal variations, such as a declined credit card.
Use cases incorporate multiple
actors
, which may be humans or systems. The
actors in the Buy Groceries use case could be the shopper, the
checkout person, the grocery bagger, the inventory system, and the
credit processor.
Like any UML diagram, use cases exist to convey information. A use
case diagram can be a valuable communication tool, and the process of
creating the use cases themselves almost invariably leads to better
software and greater accountability. In addition to ensuring user
needs are met, use cases help determine where a system is likely to
need extension in the immediate future—information that can
play a valuable part in the design process.
The ultimate consumer of the use case diagram is a human being; as a
result, the diagram's goal is clarity, rather than
precision. Some developers don't like using use case
diagrams at all, preferring text, and some mix-and-match according to
the needs of the current project. Use case diagrams at a high level
are often used to quickly communicate the scope of a more detailed
and nuanced textual discussion. In fact, UML use case diagrams alone
are almost, but not quite, useless without the full textual use case
sitting behind them.