Use UML Instead Of Flowcharts

Published February 16, 2019
Advertisement

Updated: 2/15/2019
- added "if...else" Double Selection Statement

Visual Studio Enterprise 2015 has build in tool for creating UML Activity Diagrams. We can use this tool for creating flowcharts for describing algorithms.

Creating UML Activity Diagram:

  • Select: "File" -> "New" -> "Project..." -> "Modeling Projects"
  • Write a name, for example: UseUMLInsteadOfFlowcharts_ModelingProject
  • Press "OK" button
  • Right Click on a name of the project
  • Select: "Add" -> "New Item..." -> "UML Activity Diagram"
  • Write a name, for example: UseUMLInsteadOfFlowcharts.activitydiagram
  • Press "Add" button
  • To add new items, drag them from the "Toolbox"

I get these examples from the book:

1. "if" Single-Selection Statement


int studentGrade = 70;

if (studentGrade >= 60)
{
    Console.WriteLine("Passed");
}

if_SingleSelectionStatement.png.75d0b047a711c89ad1b96d90801283f8.png

2. "if...else" Double-Selection Statement


int studentGrade = 70;

if (studentGrade >= 60)
{
    Console.WriteLine("Passed");
}
else
{
    Console.WriteLine("Failed");
}

if...else_DoubleSelectionStatement.png.07bf7f48647fb1e62e8b9236fbf9ede8.png

3. "while" Iteration Statement


int product = 3;

while (product <= 100)
{
    product = 3 * product;
}

while_IterationStatement.png.3ba12f59638326abb4219db959822fe0.png

4. "for" Iteration Statement


for (int counter = 1; counter <= 10; ++counter)
{
    Console.Write($"{counter} ");
}

for_IterationStatement.png.56989d585f057a902c91d9a6921cdd0c.png

1 likes 1 comments

Comments

nick5454

I much prefer Enterprise Architect for UML or design documents in general. Not only is it graphical but it has document templates to generate it for you. I think they have about 100 different diagram templates. Enterprise Architect . For shops that insist of Visio ( as limited as it is ) EA can translate back and forth. They have tons of tutorials on the pages and their site to help you get up to speed quickly.

Not insulting MS and VS which I use daily. Just i've been doing both for 10+ years and always go back to EA because it saves so much time.

February 14, 2019 08:54 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement