Uml Use Case To Objects
Uml Use Case To Objects
Abstract
One of the main motivations for essential use cases was the context of user
interface design. We, however, have been exploring the application of essential use
cases in general object-oriented system development. Our experience has been ve ry
positive, and we found advantages to essential use cases that assist in both analysis
and in design. This paper outlines two techniques involving essential use cases: use
of role -play in requirements analysis, and distribution of system requirements fro m
essential use cases to objects.
ADDITIONAL RESOURCES
(Click items below for more information.)
Training in usage-centered design.
forUSE 2002 Conference Proceedings.
forUSE Newsletter.
Articles and papers.
http://www.forUse.com.
Reprinted from L. Constantine (ed.), forUSE 2002 Proceedings, (Ampersand Press, 2002).
Published by Ampersand Press, an imprint of Constantine & Lockwood, Ltd., 58 Kathleen Circle,
Rowley, MA 01969; tel: 1 (978) 948 5012; fax: 1 (978) 948 5036;
email: info @foruse.com © 2002, Constantine & Lockwood, Ltd.
forUSE2002
[M22]
Abstract
One of the main motivations for essential use cases was the context of
user interface design. We, however, have been exploring the application of
essential use cases in general object-oriented system development. Our
experience has been very positive, and we found advantages to essential
use cases that assist in both analysis and in design. This paper outlines
two techniques involving essential use cases: use of role-play in
requirements analysis, and distribution of system requirements from
essential use cases to objects.
Introduction
Identification and employment of use cases is now common practice in
software development, and the use case is now a recognized concept in
modeling languages and in development processes. Essential use cases
were introduced as a refinement of the general concept, originally
proposed to address needs for technology independence in user interface
design. We feel that essential use cases deserve a wider role, and have
Figure 2 – An essential use case for getting cash from an automatic teller
machine [Constantine and Lockwood, 1999].
Example: Sokoban
In this section, we present a small detailed example of working from a set
of essential use cases toward a workable object-oriented design via
distribution of system responsibilities. The example is a program to play
the game “Sokoban”. In this paper we just present this example to support
the discussion above. More details on this particular design exercise are
available elsewhere [Biddle et al., 2002b].
StartingGame
USER INTENTION SYSTEM RESPONSIBILITY
Provide name
OpeningLevel
PRE-CONDITIONS: Level specification must be valid.
Specify level
MovingWorker
PRE-CONDITIONS: Specified direction must be valid
Specify direction
ShowingHallofFame
USER INTENTION SYSTEM RESPONSIBILITY
System Object
SO1 If all the boxes in the Level are on a shelf, then load the next Level
SO2 If the Location adjacent to the Worker in the direction specified is empty, or it
contains a Box and the Location adjacent to it in the specified direction is
either empty or contains an empty shelf, then move the Worker in the
direction specified, and if there is a box, move it as well
SO3 If the current Level is the last one, and the player is eligible for the Hall of
Fame, then record the player's name in the Hall of Fame
SO4 If the current level is any level other than the first one, record that the player
cannot enter the Hall of Fame
SO5 List all players in the Hall of Fame
SO6 Read the description of the specified Level
SO7 Record player's name
Sokoban
SO1 If all the boxes in the Level are on a shelf, then load the next Level (partially
delegated to LEV1)
SO2.1 Given a direction, move the Worker in that direction (replaces S O 2 , partially
delegated to LEV4)
SO3 If the current Level is the last one, and the player is eligible for the Hall of
Fame, then record the player's name in the Hall of Fame
SO4 If the current level is any level other than the first one, record that the player
cannot enter the Hall of Fame
SO5 List all players in the Hall of Fame
SO7 Record player's name
SO8 Request the player's name
SO9 Set the current Level to be the first Level
S O 1 0 Set the current Level to be the specified Level
S O 1 1 Set the current Level to its initial configuration (partially delegated to L E V 2 )
S O 1 2 Show the current Level (partially delegated to L E V 3 )
Collaborators: Level
Level
LEV1 Report whether all the boxes in the Level on a shelf
LEV2 Set to initial configuration
LEV3 Show all the details of the Level
LEV4 Given a direction, if the Location adjacent to the Worker in that direction is
empty, or it contains a Box and the Location adjacent to it in that direction is
either empty or contains an empty shelf, then move the Worker in the
direction specified, and if there is a box, move it as well
LEV5 Read description and create
In this case, we intend the Level class in this design to deal with all
aspects of what has happened and can happen in a particular level. This
includes tracking where the Worker is, and where Locations are with
respect to each other. This being the case, it seems reasonable to
delegate large parts of S O 2 to this class.
Iteration 3
This iteration focuses on the Level class. Its repeated use of the term
location suggests that a L o c a t i o n class would be useful. This has the
following impact on the design (SS o k o b a n is unchanged).
Location
L O C 0 Given position and contents, be created
L O C 1 Show details (render representation according to contents) at position
L O C 2 Indicate contents (empty, B o x,
x empty S h e l f , full S h e l f , W o r k e r,
r Wall)
L O C 3 Move Worker in or out (as specified)
Level
LEV1 Report whether all the boxes in the Level on a shelf (partially delegated to
LOC2)
LEV2.1 Read description of current level and from that create locations and assign
positions and contents (replaces L E V 2 , partially delegated to L O C 0 )
LEV3.1 Have each location show its details (replaces L E V 3 , partially delegated to
LOC1)
LEV4 Given a direction, if the Location adjacent to the Worker in that direction is
empty, or it contains a Box and the Location adjacent to it in that direction is
either empty or contains an empty shelf, then move the Worker in the
direction specified, and if there is a box, move it as well (partially delegated
to L O C 2 , L O C 3 , and L O C 4 )
LEV5.1 Given level identification, read description of specified level and from that
create locations and assign positions and contents (replaces L E V 5 , partially
delegated to L O C 0 )
Collaborators: Location
Iteration 4
Returning to the S o k o b a n class, we note the need for maintaining details
about the player, suggesting a P l a y e r class.
Player
P1 Request and record name, and make eligible for the Hall of Fame
P2 Make ineligible for Hall of Fame
P3 Report name
SO2.1 Given a direction, move the Worker in that direction. (partially delegated to
LEV4)
SO3 If the current Level is the last one, and the player is eligible for the Hall of
Fame, then record the player's name in the Hall of Fame (partially delegated
to P 3 and P 4 )
SO4 If the current level is any level other than the first one, record that the player
cannot enter the Hall of Fame (partially delegated to P 2 )
SO5 List all players in the Hall of Fame
SO9 Set the current L e v e l to be the first L e v e l
Iteration 5
Finally, we create a H a l l O f F a m e class, which takes over more of the
responsibilities of the S o k o b a n class. This is the final design in our case
study. While other iterations may be possible, what we have is quite a
good start; it is a design that we are quite confident satisfies the
requirements and the responsibilities seem fairly well distributed. We
could use this as a starting point for application of other techniques, such
as responsibility-driven design.
HallOfFame
HOF1 Read names of players (from S O 3 , S O 5 )
HOF2 Add name of player (from S O 3 )
HOF3 Write names of players (from S O 3 )
Conclusions
Use cases are seen as beneficial in many aspects of system development,
and the refinement of essential use cases was originally made to address
needs in user interface design. We have been exploring the application of
essential use cases in general system design.
Our initial motivation concerned straightforward aspects of essential
use cases. Essential use cases support role play well, because of the use
of dialogue. They are brief, and can be developed quickly, because they
avoid unnecessary debate about implementation details. We also found
deeper advantages that relate to many aspects of system development.
Most importantly, the abstraction of essential use cases comes from
identifying user intentions and system responsibilities, and these both act
as heuristics that benefit software development.
Some of the advantages flow from the heritage that essential use
cases have from user interface design. In requirements analysis,
therefore, they emphasize the dialogue of interaction, and emphasize a
focus on users, or actors, to inspire reasonable interaction. In this way
essential use cases can provide an effect similar to the early development
References
Beck, K. and Cunningham, W. (1989) A laboratory for teaching object-
oriented thinking. Proc. of OOPSLA-89: ACM Conference on Object-
Oriented Programming Systems Languages and Applications. pp. 1-6.
ACM Press.
Bellin, D. and Suchman Simone, S. (1997) The CRC Card Book. Reading,
MA: Addison-Wesley.
Biddle, R., Noble, J. and Tempero, E. (2001) Role-play and use case cards
for requirements review. In D. Cecez-Kecmanovic, B. Lo and G. Pervan
(eds), Proceedings of the Australasian Conference on Information
Systems (ACIS2001). Coff's Harbor, NSW, Australia.
Biddle, R., Noble, J. and Tempero, E. (2002a) Essential use cases and
responsibility in object-oriented development. In M. Oudshoorn (ed.),
Proceedings of the Australasian Computer Science Conference
(ACSC2002). Melbourne, Australia: Australian Computer Society.
Biddle, R., Noble, J. and Tempero, E. (2002b) Sokoban: A system object
case study. In J. Noble and J. Potter (eds), Proceedings of Technology
of Object-Oriented Languages and Systems (TOOLS-Pacific). Sydney,
Australia: Australian Computer Society.
Biddle, R., Noble, J. and Tempero, E. (2002c) Supporting reusable use
cases. In C. Gacek (ed.) Software Reuse: Methods, Techniques, and
Tools, 7th International Conference, ICSR-7, Austin, TX, USA, April 15-
19, 2002, Proceedings, Vol. 2319 of Lecture Notes in Computer
Science. Springer.
ORDER FORM
forUSE 2002 1st Int’l Conference on Usage-Centered Design
Complete Post-Conference Package
Shipping Address:
Telephone (required):
Email (required):
Signature: ___________________________________