How To Make A Use Case Diagram With Visual Studio For Mac

There are two common misunderstanding about use case modeling or UMLuse case diagram. One is that, use case diagram is too simple, as it does not explain anything important and it is not worth drawing. Another misunderstanding is just opposite to the first one. Some people believe that use case diagram is so powerful that can represent many different aspects of a software, from describing system requirements to modeling the internal behaviors of the system. So what is use case? What is use case diagram and is use case modeling simple or powerful?

  1. How To Draw A Use Case Diagram
  2. Use Case Diagram Examples
  3. Sequence Diagram
  4. Class Diagram

Use case modeling is simply an answer to “What do the users (customers) want”. It allows you to visually represent the goals that users want to achieve through using the final end product, which can be a system, a software, a program, etc. Use case modeling is a useful technique in establishing a solid foundation for software developers to develop software system that meets with customers’ needs. While the notations applied in a use case diagram seem simple and do not express much detailed, the way how use cases are collected, organized and elaborated do significantly influence the direction of the software development lifecycle and thus the quality of the final software product. In this article, we will go through ten tips that can maximize the effect of drawing use case diagram. We are not going to explain what are use cases in detail but some of the key concepts regarding to UML modeling, use case diagram and requirements capturing will be covered.

A use case represents a user goal, which can be achieved by going through a series of steps. When exactly the same steps are found among use cases, you can optionally create a new use case for the common steps and connect it with the use cases that trigger the steps. If you’re using the Mac keyboard, you’ll want to change the function key behavior so the F1-F12 keys work correctly in Visual Studio. From System Preferences – Keyboard, make sure Use all F1, F2, etc. Keys as standard function keys; is checked. With this turned on, hold Fn to use the Mac functions (brightness, volume, etc.) on F1-F12. For more information about use case diagrams (and procedures for using Microsoft Visual Studio to create use case diagrams), go to UML Use Case Diagrams: Reference. On the File tab, point to New. Under Template Categories, click Software and Database. Easy to make UML sequence diagram, use case diagram, UML class diagram, UML activity diagram, UML deployment diagram and more. Edraw UML diagram software, which has already done greatly on Windows, finally released its Mac version, and many features have been advanced. Visual Studio 2015 has does not have Architecture Explorer path Architecture->Windows. So we are not able to generate the UML diagram from Existing Solution/Project code. Please let me know if any other ways to generate the UML diagram from existing code in Visual Studio 2015 Ultimate edition. After producing your initial visual list of use case actors and goals, we can take this list and create an initial use case grid which provides the basis for the use case index. Every use case will have various attributes relating both to the use case iteself and to the project. Design system with UML Class Diagram. Create a C# library project Map Viewer in Visual Studio. Right click on the project node in Solution Explorer, and select Open Visual Paradigm from the popup menu. In Diagram Navigator, right click on class diagram and select New Class Diagram from the popup menu. A new diagram is created.

1. Think from end user’s perspective

It is clear that you need to know users’ expectation in order to build a software system that works, and this principle is particular important in use case modeling. Many people has mistakenly treats use case modeling as a process to model system functions, which can be wrong. To be accurate, use case modeling is a way to model what the users want. Each of the use cases in a use case diagram should yield an observable goal through users’ interaction with the final software or system. Sometimes, a user goal is the same as a system function but this is not always true. For instance, “Login” is a system function but it is definitely not a user goal – No one will start a program, login and go away! So, the more system functions you draw in a use case diagram, the less effective the use case model can be used to express users’ real expectation throughout the entire software development process. Therefore, when you develop a use case model, try to express everything by first thinking from end user’s perspective.

2. Avoid long use case name

If you are reading a use case diagram prepared for an ATM system, which of the following use cases do you want to see in the diagram? “Withdraw Cash” and “Withdraw Cash and Update Balance in Account”. The second use case seems to be more descriptive, right? What about having 50+ different use cases with such a long name? You probably does not want to read the diagram anymore and perhaps your eyes will be in pain.

One of the reasons why we need modeling is that we want to understand a complex software system in an easy and simple manner. That’s why the UML has provided us with many different kinds of notations with each of them representing a specific perspective in describing a complete software system. This “spirit” applies to naming use cases as well. If we try to name use cases with detailed description, why don’t we just use a text file instead? In order to make a use case diagram easy to understand, it is important to keep the names of use cases short, yet remain descriptive. Keep the names short and leave the detailed description to the description part of use cases.

3. Actor is a role, not a real person

Actor is a role

Some people try to represent employees in an organization as actors in use case diagram, which end up having a diagram with Peter, Mary, Daisy, etc Remember, an actor represents a unique role that comprises of people, sub-system or whatever entities with unique characteristic and share the same goals and expectations.

4. Model common use case with <<include>> relationship

A use case represents a user goal, which can be achieved by going through a series of steps. When exactly the same steps are found among use cases, you can optionally create a new use case for the common steps and connect it with the use cases that trigger the steps. By using included use case, this makes it clear that the including use cases are indeed sharing the same set of steps as represented by the included use cases with no uncertainty.

5. Model exceptional behavior with <<extend>>

The Extend relationship

The extend relationship can be used to specify when and how the behavior of a use case may be triggered by another use case. Extension takes place at extension points defined in extended use case. The extending use case defines the steps that may be executed by the extended use case under specific conditions.

6. Model scenario with flow of events, not directly on diagram

A use case represents a user goal, which can be achieved by going through a sequence of steps. Some people try to model the steps directly on use case diagram, by connecting actor and use case with many many associations, pretending to be the steps, which is definitely wrong. Instead, the steps of use case can be well described in the use case flow of events editor.

Mac

The flow of events editor is in tabular form, with each row representing a step of use case. You can write down the steps there, with or without conditional flow. You can also apply formatting to text for emphasizing key ideas.

7. Make good use of stereotype for categorization

Use cases with stereotype applied

Stereotype is a mechanism that allows you to introduce domain specific notation in addition to those standard ones. A stereotype is shown within a pair of guillemets, on top of the name of shape when the stereotype is applied. The proper use of stereotype helps readers to realize the differences of use cases on easier.

8. Model detailed system flow with sequence diagram

Sequence diagram allows you to model the system behavior by representing the communication and interchange of messages between objects over time. But where to begin with? Instead of guessing what interaction to model, you can start by referring to what the user needs, which is exactly what a use case model aimed to present.

We know that every single use case represents a unique user goal. To draw sequence diagram from a use case implies that you are going to model what the computer system should do to fulfill the user. Ideally, there will not be any redundant design as all the sequence diagrams are created from use cases, which represent what the user wants.

9. Apply same width on use cases when appropriate

Since the names of use cases are different in length, it is normal to have the use cases in different width. To make the diagram prettier and easier to read, it would be nice to resize them to the same width.

10 Position actors and use cases in a meaningful way

A use case diagram with randomly placed actors and use cases is definitely a nightmare for readers. One has to examine the diagram carefully in order to find out the information he want from the scattered actors and use cases. It would be nice to place shapes in a discipline manner. You may also group use cases with package shapes if necessary.

Related Articles

Designing a new feature? Trying to figure out someone else’s code? Got a class diagram completed and need to start coding? Take advantage of the modelling features in Visual Studio to save yourself some time!

Using an agile methodology doesn’t mean you never document or design anything. The class diagram is still a great tool to help you design a new application or to visualize an existing application so you can plan a new feature. Using Visual Studios architecture features can save you time on documentation or digging through files so you can focus on the design and implementation.

In this post we will look at how you can use Visual Studio 2013 to

  • Create a new Class Diagram
  • Create a class diagram from existing code
  • Generate code from a class diagram

Note: The architecture features described in this post are only available in Visual Studio Ultimate. If you are you a student in a technical program check if your department has DreamSpark Premium which gives you access to Visual Studio Ultimate.

In Visual Studio choose File | New Project | Modeling project. The Modeling project is only available in Visual Studio Ultimate.

Go to Solution Explorer, right click in the project and choose Add New Item and select UML Class Diagram.

As you can see from the screenshot below you are not limited to class diagrams, you can also create Sequence, Use Case, Activity Diagrams and more.

Once you create a class diagram, you will see the modelling objects in the Toolbox. Drag and drop the classes, associations and inheritance diagram elements to your class diagram. If you need it, here is the documentation for How to Edit UML Models and Diagrams

Open a C# project (this feature is not supported for all programming languages at the moment)

From the menu choose Architecture | New Diagram. If you can’t find Architecture in the menu, your version of Visual Studio may not support this feature, this feature is only available in Visual Studio Ultimate.

Select the diagram you want to create, e.g. UML Class Diagram, UML Sequence Diagram. You will be prompted to provide a name for the diagram and a modelling project to contain your diagrams.

How To Draw A Use Case Diagram

You will see a blank Class Diagram

Use Case Diagram Examples

Because we want to add existing code to our model instead of drawing new objects manually, go back to the menu and select Architecture | Windows | Architecture Explorer. This will open a new window where you can see all the namespaces in your project. We will use this window to select the elements we want included in our class diagram.

In Architecture Explorer, expand the Namespace that contains the classes you want to add to your diagram. Select the elements you want to include in the diagram and then select the Create a new graph from selected nodes button in the top left corner of the Architecture Explorer Window

Visual Studio will reverse engineer the code and create a class diagram for the selected elements.

I am not going to go into all the details of how you navigate the architecture explorer window and select individual elements, I just want you to be aware of the capability to create class diagrams from your code. For more complete documentation visit Create UML Class Diagrams from Code.

When you have a class diagram you can use the Generate Code command to create C# for your classes.

Open your modelling project with the class diagram and select the class or classes you want to create as code. Right click the selected element or elements and select Generate Code from the pop-up menu.

By default you will get a single file created for each class

Sequence Diagram

Here you can see the code generated for the Carnivore class

Class Diagram

It is possible to Customize the Generate Code Command to change the default code generation settings. You can find more complete documentation at Generate Code from UML Class Diagrams

As you can see Visual Studio 2013 Ultimate has a number of features to make it easier to work with Class Diagrams whether you are starting a new project, or working with existing code.