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");
}
2. "if...else" Double-Selection Statement
int studentGrade = 70;
if (studentGrade >= 60)
{
Console.WriteLine("Passed");
}
else
{
Console.WriteLine("Failed");
}
3. "while" Iteration Statement
int product = 3;
while (product <= 100)
{
product = 3 * product;
}
4. "for" Iteration Statement
for (int counter = 1; counter <= 10; ++counter)
{
Console.Write($"{counter} ");
}
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.