VCE IT Lecture Notes by Mark Kelly, McKinnon Secondary College
Unified Modelling Language (UML)and Use Case Diagrams (UCDs) |
|
|
A stable and common visual design language that can be used to develop and build computer applications. They're like blueprints for programmers and system engineers. |
|
UMLLast century (1997) there was a need for a unifying language enabling IT professionals to model computer applications. At the beginning there were competing methods like OMT, OOSE, and Booch, but their authors eventually joined forces and brought about an open standard: UML. It is programming-language independent, so it can be used with C++, Visual Basic, Java, Python: anything. It provides several types of diagrams that make it easier to understand an application under development. The most useful, standard UML diagrams are:
In VCE SD, we only need to know about the UCD.
|
|
|
|
Use-case diagrams (UCD)UCD is created during system analysis phase of Problem Solving Methodology to plan the system's functional requirements: what it should be capable of doing. Use case diagrams describe what a system does from the standpoint of an external observer. The main purpose of the use-case diagram is to help development teams visualize the functional requirements of a system. The emphasis is on what a system does rather than how. How is worked out later in the design phase. The Use Case Model is not intended to be an exhaustive definition of system functionality. It rather serves to scope the system's high-level functionality by defining what functions will or will not be performed by the system in sufficient detail that we can be sure we haven't missed anything important. A use case (the oval shape shown below) illustrates a unit of functionality provided by the system. Use case diagrams are helpful in:
The main purpose of the UCD is to help development teams visualize the functional requirements of a system, including the relationship of actors to essential processes, as well as the relationships among different use cases.
|
|
ACTORS
Actors are drawn as stick figures. Cos stick figures are cool. Like ninjas, but without swords. An actor is a person, organisation, or external system that plays a role in one or more interactions with your system.An actor is who or what initiates or participates in the events involved in that task. Remember: an actor can be software or a company - it does not have to be a person! An actor is always outside the system being modelled. Anything that is part of the system we are defining is not an actor. So don't put the 'database that stores customer information' as an actor on the UCD. It is part of the system and so cannot be an actor. Primary actors are those that require assistance or service from the system. They initiate a use case. Secondary actors are those from whom the system requires assistance. They respond to a use case. |
|
USE CASESTo show a use case on a UCD, draw an oval in the middle of the diagram and put the name of the use case in or below the oval. Draw a stick person to the left or right of your diagram. Use solid lines to depict associations between actors and use cases. Association lines can have an optional arrowhead on one end of the line. The arrowhead is often used to indicate which actor invoked (initiated) the relationship. That actor is called the primary actor within the use case. Note: The arrowheads do not show data flow (like DFDs). They indicate the actor who initiates a use case.
So, use cases capture who (the actor) does what (the interaction) with the system, for what purpose (goal), without dealing with system internals. A complete set of use cases specifies all the different ways to use the system, and therefore defines all behavior required of the system. This defines the scope of the system.
|
|
Tip: You should be able to translate a case study into a UCD (needed for Unit 3 Outcome 1) and re-recreate a case study (tell the story of what can happen in the system) by reading the UCD. Tip: You will find differences of opinion in how UCDs are to be drawn, especially when they get complex. There is no 100% agreed-on set of instructions of how to do them; a degree of personal style and craftsmanship is involved. Just try to make your UCDs as unambiguous and meaningful as possible. |
|
Example 1 (source)Here is a scenario for a medical clinic.
Below is a UCD describing the processes used in the medical clinic's system.
We've put Make Appointment as part of a diagram with four actors and four use cases. Notice that a single use case can have multiple actors.
Reading this UCD
Notice how use case names always start with an active verb ('pay', 'make', 'request' etc) Tip: As you do in DFDs, don't combine sentences with commas or 'and'. This implies that interactions have been combined. Note: don't repeat actors or use cases on the same diagram! This can lead to a lot of artistic rearrangement of the UCD, which makes them a nightmare to draw by hand. Using the right software (like Dia, gliffy.com, a Google Docs Drawing or MS Visio) lets you drag around actors (for example) and have their attached associations move with them. Note the lack of clarity in the UCD above:
Here's a variation of the UCD with more information provided:
This makes things clearer. Only the patient can make or cancel an appointment. It's the clerk who is responsible for getting bill payment procedures underway. By thinking through the use of arrows like this, it makes developers and clients really concentrate on the desired behaviour of the system. For example, having added arrows above, they might realise it's vital that the scheduler can cancel an appointment (e.g. an emergency case arrives so a scheduled appointment becomes impossible.) In such a case, a new arrow is NOT added to the line from the scheduler's side! The existing arrowhead attached to the top use case must be removed. You cannot have two or more associations with arrowheads leading to the same use case!
|
|
IMPORTANT TO KEEP IN MIND - Actors are roles, not people.
Mr Southerby as CEO needs access to management information. Fred Smith as Order Entry Clerk needs to enter orders.
Sometimes Mr Southerby may need to enter an order when Fred isn't there.
NO! That doesn't mean that we draw an arrow between Mr Southerby and the Enter Order use case. Entering orders is not the role of either Mr Southerby nor the CEO - it's the role of the clerk. Mr Southerby may be CEO but when he enters an order, he's taken on the role of Clerk.
Notice above, only the clerk enters orders: whether it's Fred or Mr Southerby is not relevant. When naming actors we need to think of the role that a person takes on rather than their name or job title. Most job titles involve the putting on of a number of different hats in different situations. So name the actor with the role rather than the job title if there is any confusion. Think hats! (Thanks to http://www.cragsystems.co.uk for that tip)
|
|
Practice reading a UCD
Quiz 1.Which actor initiates the entering of an order?
2.Which actor responds to an order being entered?
3.Is the Accounts System actor a human?
4.Who starts off the getting of an address?
5.Can the Accounts System cancel an order?
6.During order entry, does the accounts system send information to the order entry clerk?
7.Who is the passive actor during order entry?
8.Who is the primary actor during order entry?
Answers (click and drag over the white space below to see the answers)
|
|
ScenariosA scenario represents a single path through the use case. Thus, one may construct a scenario for the main flow through the use case, and other scenarios for each possible variation of flow through the use case (e.g., triggered by options, error conditions, security breaches, etc.).
|
|
Includes and Extends<<includes>> denotes the inclusion of behaviour described by another use case. Think of it like a subprogram. They are always called, unlike extends which are conditionally called. Imagine it as bolting on another set of actions that have already been defined somewhere else – it saves repetition and wasted space. In the UCD below, both the Manage Customer Details and Enter Order use cases include the Find Customer Record use case.
Like a conditional <<include>>.A use case that extends another use case (the ‘base’ use case) when circumstances require it. When the extending use case’s activities are finished, the base use case’s activities continue. In other words, it can indicate conditional branches in activities.
http://en.wikipedia.org/wiki/File:Use_case_restaurant_model.svg Note: Solid lines or arrows between use cases are not allowed. The only way to link use cases is with includes or extends. |
|
READING A UCDUse-case diagrams generally show groups of use cases.
Reading the UCD above you can easily tell the functions that the system provides.
In addition, the absence of use cases in this diagram shows what the system doesn't do. For example, it does not provide a way for a band manager to listen to songs from the different albums on the Billboard — i.e. we see no reference to a use case called Listen to Songs from Billboard 200. This absence is not a trivial matter. With clear and simple use-case descriptions provided on such a diagram, people can easily see if needed functionality is present or missing in the system. (Thanks to IBM for that info)
|
|
Creating UCDsThere are different styles...
OR
Use case diagrams often start as text outlines of processes like this:
This textual description can then be converted into a matching UCD...
|
|
System BoundariesYou can draw a rectangle – the system boundary - around use cases to indicate the scope of the system. They are not often used. An example of their use is to mark off functional components that will be rolled out in different major releases of a system...
From http://www.agilemodeling.com/artifacts/useCaseDiagram.htm Note: the arrow indicates that the actor starts the interaction between the actor and the use case |
|
Example 2 (source)
Reading the example above, students are enrolling in courses with the potential help of registrars.
Notes
Notes
|
|
Example 4 (source)
|
|
Example 5 (source) - more advanced
|
|
MASTERCLASS How much detail in a use case?How big does a process need to be to get its own use case? It's a matter of judgement. Consider the following situation: |
|
Some revision examples
|
|
PRACTICE
Describe what this UCD is telling us. Answers are here. |
|
And in their free time, ninja Use-case diagram actors go wild...
|
|
Drawing UCDs:
A related UCD topic that is outside the scope of VCE Software Development assessment, but still useful, is generalisation. |
|
Appendix - from VCAA Bulletin No. 85 November 2010 Supplement 2, page 5 6. What is the appropriate depth of treatment for use case diagrams?In Unit 3, Software development, Area of Study 1, students are required to use tools and techniques for depicting the interfaces between solutions, users and networks. One mandated technique is use cases created through tools such as Unified Modelling Language (UML). Use cases diagrams identify the interactions between distinct business functions and business users within information systems to achieve a goal. Students are not required to have a detailed knowledge of use cases diagrams [my italics], but to gain any real meaning from the technique they need to have knowledge of each of the following elements and how they are symbolically represented. The elements include:
|
|
| Thanks to http://www.bredemeyer.com/use_cases.htm for a nice overview of use cases. |
Back to the IT Lecture Notes index
Back to the last page you visited
Created 10 Sep 2010
Last changed: December 20, 2011 10:21 AM
VCE IT Lecture notes copyright © Mark Kelly 2001-