Using MagicDraw to Create UML Use Case diagrams
UML Use Cases using Magicdraw
Robin Beaumont
Tuesday, 04 October 2011
Contents
1Required Resources
2Revision
3Our problem
4Setting the perspective you will use in MagicDraw
5Creating a new project
6Creating a new Diagram
7The project window and diagram toolbar - moving around and Zooming
8Removing the grid on the drawing canvas
9Creating an Actor
10Creating individual use cases and associations
11Tidying the lines
12Adding notes
13Saving your project and diagram
14Displaying diagram information
15Include, Extend and Inheritance
16Finding out properties
17Learning more about Use Case diagrams
18A common interface
1Required Resources
You need the following resources to work through this document:
The “Scenarios for practicing modelling techniques” handout available
from
MagicDraw software, this depends on who you are:Students at The Royal College of Surgeons (Edin.) will be provided with the software along with the academic licence.All others can obtain the software by visiting and registering at: for the free community edition. An alternative with a similar interface is Visual Paradigm (VP-UML).
The purpose of this practical chapter is to provide you with the skills to draw Use Case diagrams in Magicdraw.Other documents explain what Use case diagrams are and where they fit into the modelling process.
2Revision
You should possess knowledge of what Use case diagrams are before working through this practical chapter.
You should have preferably worked through the document; Dynamic modelling and UML part 12 - Use cases and sequence diagrams at:
Alternatively An excellent introduction, along with a general introduction to UML, can be found at: a good book chapter on Use Cases can be found at;
3Our problem
In this practical chapter we are going to produce a UML Use Case diagram from a narrative description.I assume you have worked through the material explaining what a Use Case diagram is and how you derive the required information from a narrative description.
To find out about the descriptionsopen the document ''Scenarios for practicing modelling techniques”from read through the Local Community Radio Station narrative.
Mytentative list of Actors and Use cases from the narrative are:
Use CaseCreate item
Create programme
Present Programme
Maintain feedback log
Monitor
Book studio
Maintain equipment
Actor
Hospitals
Schools
Manager
Administrator
Recording engineer
Editor
Presenter
Secretary
Volunteer
Now let's see how we use the above information to create a UML Use Case diagram in MagicDraw.
If you have used MagicDraw before you can move to section 5.
4Setting the perspective you will use in MagicDraw
The first time you open MagicDraw after installing it you are asked to specify what type of user you are ('user perspective'). Set the options as shown in the screen shot below.
The first screen is rather cluttered, to say the least, so the first thing I suggest you do is close the Welcome window
Although the screen appears very complex you can think of it as consisting of 4 main areas:
Menu
Toolbars
Browser window
Drawing Canvas
5Creating a new project
We are now ready to create a new project which will include our Use case diagram. To do this click on the menu option File -> new project.
Selecting this menu option brings up a dialogue box asking a name for the project and a place to save it. The screen shot below tells you which options to choose in each dialogue box.
6Creating a new Diagram
We now have a relatively empty screen, let's review some interesting aspects of it before moving on. Along the toolbar at the top of the screen there are a series of icons which allow you to easily create new UML diagrams of various types. Along the left hand side of the screen there is a panel with four tabs along the top of it clicking on the third one 'diagrams' provides us with a graphical display of the diagrams we might have in the project, as we would expect this is empty at the moment. Finally notice that the middle of the tool bar provides you with details of the actual project filename 'radio station.mdzip' along with where it is on the hard drive.
Besides clicking on the appropriate icon on the toolbar to create a new diagram is it possible to do it the old fashioned way by using the menu option Diagrams -> Use Case Diagrams.
Once you choose this the Use case diagrams dialogue box appears which is empty at the moment, click the 'Add' button and follow the instructions in the screen shotbelow.
Robin D:\web_sites_mine\HIcourseweb new\chap11\case_tool_tuts\magicdraw\use_case_2007.docx Page 1 of 12
Using MagicDraw to Create UML Use Case diagrams
7The project window and diagram toolbar - moving around and Zooming
Robin D:\web_sites_mine\HIcourseweb new\chap11\case_tool_tuts\magicdraw\use_case_2007.docx Page 1 of 12
Using MagicDraw to Create UML Use Case diagrams
8Removing the grid on the drawing canvas
One thing I find annoying is the grid on the drawing canvas, follow the details below to remove it.
9Creating an Actor
The panel on the immediate leftof the drawing canvas provides a easy way of creating various UML elements onto the drawing canvasby dragging them across.
Exercise 1:
Follow the instructions above to create the project Radio Station and a UML use case diagram called Overview.
Exercise 2:
Add the following actors to your use case diagram:
10Creating individual use cases and associations
To create individual Use Cases you select the use case icon on the left hand panel and drag it onto the drawing canvas. To name it you just start to type immediately.
Actors in Use Case diagrams communicate with Use cases via associations.
Important:the term association here does not have the same meaning as an association in UML Class diagrams I tend to think of these as messages.
The diagram on the right shows you how to create an association. The pop up menu appears when the Use case is selected.
11Tidying the lines
Once you start to add a number of associations the diagram will become to look rather messy. One easy way of tidying it up is to change the style of the lines. I would recommend that you usually keep the same line style for all the lines within a particular diagram.
12Adding notes
The Use case diagram we are creating is just an overview of the system we are beginning to model, one of the main purposes of a Use Case diagram is to encourage discussion between all the stakeholders therefore an initial diagram will contain many questions that will need clarifying in drawn out meetings.
To create a note click on the note icon and then click the drawing canvas.
Exercise 3:
Modify your Use Case diagram to resemble the one below:
13Saving your project and diagram
Always remember to save your project. This will include all the diagrams etc.
If you wish to make copies with different names use the Save Project As . . option.
14Displaying diagram information
It is possible to display a table showing such things as the diagram name, author, and creation, modification dates.
While in the drawing canvas right mouse click in an empty part of the diagram you want to add the information table to. A properties menu appears which you just need to click on the 'Show diagram info' option.
Once you have done this a information table will appear in the diagram.
You can move the table by clicking on it and dragging it around the diagram.
You can also change its contents, look and feel by selecting it and then right clicking, selecting Customize, which brings up its own project options box. To change the text size font etc just use the menu options along the top of the drawing canvas after selecting the information table.
15Include, Extend and Inheritance
You use the same technique as described above to add other diagram elements such as include, extend and inheritance associations. In the example below I have indicated that the process of creating a programme involves creating items.
16Finding out properties
It is easy to find out what characteristics of a particular element (e.g. actor, Use case, association etc) you can edit. You can either select the element by left mouse clicking on it then once selected RIGHT mouse click which brings up a menu. Alternatively you can constantly see the characteristics of the currently selected element by moving to the properties tab of the browser window.
Rather than selecting the element you want on the actual diagram you can go to the containment tab of the browser window and select what you want there.
17Learning more about Use Case diagrams
MagicDraw comes with two case studies, the Inventory control system and a Library system. The Inventory control system has a simple Use case diagram while the Library system contains a much more complex one. I personally feel that the Inventory control system's Use case diagram reflects the spirit of the Use case diagram more accurately. See what you think.
18A common interface
You might be interested to know that superficially the screen layout of MagicDraw is very similar to a number of other Case tools so once you have learnt it you should have little difficulty moving to several others. It is important to realise that while each Case tool may look initially very similar, in fact most offer very different features.
The screen shot opposite is that of another UML case tool VP-UML.
End of document
Robin D:\web_sites_mine\HIcourseweb new\chap11\case_tool_tuts\magicdraw\use_case_2007.docx Page 1 of 12