问题
I'm confused about a book I'm reading.
I always thought use cases where some kind of diagram with actors and bubbles like this one from wikipedia :
But in Head First Object-Oriented Analysis and Design - O'Reilly, what are called "use cases" are just listings with main/happy paths and alternate paths.
O'Reilly provides a sample from this book here (you can scroll to page 71 of the pdf, which is page 123 in the book) and these listings look like:
Main Path
1. Fido barks to be let out.
2. The bark recognizer “hears” a bark.
3. The bark recognizer sends a request to the door to open.
4. The dog door opens.
5. Fido goes outside.
6. Fido does his business.
6.1. The door shuts automatically.
6.2. Fido barks to be let back inside.
6.3. The bark recognizer “hears” a bark (again).
6.4. The bark recognizer sends a request to the door to open.
6.5. The dog door opens (again).
7. Fido goes back inside.
8. The door shuts automatically
Which is the official "use case", the listing or the diagram?
I guess the diagram can be converted to a few listings, but I don't see how the listing can be converted to a use case diagram. Are they even related?
Which one is wrong? Wikipedia, this book or, most probably, me? (and why?)
回答1:
A use case can be represented in two different ways:
graphically it is usually drawn as an oval, and contains a short description of what the use case is supposed to deliver. Many use cases together form the use case diagram
The details of each use case are described by writing down each path through the use case. These paths can also be called listings or scenario's.
So, you are both right: a use-case can be described as a set of listings/scenario's/paths, or by an oval in a use-case diagram. They are both the same.
So, in your example, try to describe the "serve food" use case by writing down all the steps the waiter needs to perform to actually get the food from the kitchen to the right table, and you will have your list of steps.
回答2:
Use cases ARE NOT some kind of a diagram. UML use case diagrams are some tools to help to comprehend overall mix of use cases, actors, extension points etc.
UML diagram can not capture the use case, what it is and all the details needed to negotiate if it really describes the problem that needs to be solved (with customer) and the various aspects that need to be weighted in order to implement it's support in the designed system (follow-up design, architecture, coding)
Respected authority in defining what is a use case and how to capture it is software engineer (or computer scientist)
- Alistair Cockburn
- especially his book "Writing Effective Use Cases", now available online on his site
- along with other use-case related resources at http://alistair.cockburn.us/Use+Cases.
So use cases are not diagrams, use cases are ARE NOT simple listings,
use cases ARE results of the fine art of capturing software requirements
回答3:
I recommend to download and study UML superstructure from OMG. You can read find there an exact definition of UseCase without any "independed authors" interpretation or additions !
UML Superstructure web page
来源:https://stackoverflow.com/questions/23811378/uml-use-case-listing-vs-diagram