However, as your project takes shapes, there could be changes made to the data structures during the process. Such changes would make your references in the flows of events outdated, knowingly or unknowingly. If it does come to your attention, a remedy might be to search all the outdated entries and update them. Again, manually. In addition to the time you would have to spend, there is also accuracy issue that comes with high volume of manual input. Or what if you missed one of the flows of events in your collection of use case diagrams?
Only if there's a way to synch the changes automatically... and yes, there is.
What will we do in this tutorial?
In this tutorial, we will show you how to add classes and attributes to a flow of events such that the flow of events will stay up-to-date with any changes made to the data structures being referenced.
We will be using a simple use case diagram example below.
Software We'll Be Using
As for the software tool, we will be using Visual Paradigm. You are welcome to download a free 30-day evaluation copy of Visual Paradigm to walk through the example below. No registration, email address or obligation is required.
Steps to Create a Class Diagram
We will now create a class diagram to document our data structure that elaborates the use case Process Order.
In the use case diagram, select the use case Process Order and click the Sub Diagrams icon.
Select Add > Other Diagrams > UML Diagrams > Class Diagram.
- In the new class diagram, click on any white space and you will see that the diagram is initially named Process Order after the use case. If you like, you can change it to something else. For now, we will just leave it as it is.
- From the Diagram Toolbar, drag Class over to the diagram. Name it Customer.
- To add an attribute, right-click Customer and select Add > Attribute.
Name it name. Press ENTER.
When you press ENTER after entering the attribute's name, a new row is inserted below your current row for the next attribute. If you do not need it, you can hit the ESC key to delete it. The focus will go back to the previous row in dark red. If you click on the diagram background, the highlight will go away.
- Add another attribute named address.
- Add another attribute named tel.
- We will now create a relationship between Customer to a new class. Click Customer and drag the Association -> Class icon over to the right. At where you want to draw the new class, release your mouse button.
- Add an attribute called orderNumber.
- Add an attribute called remarks.
A customer may place more than one order. To depict that, we will make the relationship one-to-many. Place your mouse pointer on the right end of the association (near the Order class) and right click on the bubble. Select Multiplicity and then * (the asterisk).
An asterisk will be displayed to depict the multiplicity.
Steps to Create a Flow of Event
We will now create a flow of events to document user flows for the use case Process Order.
- Right-click on the use case Process Order.
- In the Process Order Details window opened, select the Flow of Events tab.
Click on the first row (in white space). Type in Login to the System. Press ENTER.
Type in Click new Order. Press ENTER.
Type in Select customer. Press ENTER.
- To further elaborate step 3, we will now indent the fourth row which will become step 3.1. Click Increase Indent.
- Type in Search customer by (leave a space at the end after 'by').
- At the mouse cursor shown above, right-click and select Add Class...
A dialog box will open displaying associated classes. Expand to Ordering System > Process Order > Customer. Select name under Customer. Click OK.
Upon clicking OK, the attribute's name will then appear in the flow of events.
- Type in ' or ' after the newly added attribute name. Similarly, add another attribute address.
What happens if we change the data structure?
In the Customer class, let's say we want to change the attribute name to customerName. In the class diagram, double click on name and rename it to customerName.
If you go back to the flow of events, you will see that the attribute change has already been reflected automatically.