Channels ▼

Cameron and Tracey Hughes

Dr. Dobb's Bloggers

Flowcharts Lost and Regained

July 30, 2009

Do you remember flowcharts? Flowcharts were/are a crucial tool in developing the flow of the logic in a structured program, process, an algorithm, etc. I remember how excited I was when I bought my first green plastic flowchart template. Some of my flowcharts were pages long but the process of flowcharting always clarified my logic .

Those green templates can still be bought in office supply stores in the section with drafting tables and blue drafting engineering pencil sets.

Although we have drafting and flowcharting software, unfortunately, flowcharting (which was taught in every Programming 101 course years ago) is a lost art to many beginner programming students.

Now we have parallel algorithms and even more so we need that logic clarified. Well, the advantages of flowcharting is now regained in the UML activity diagram with new symbols, and more flow to accommodate concurrency. The activity diagram is a flowchart showing the sequential and concurrent actions or activities amongst objects used in a use case, a process or to reflect their state.

It is comprised of decision branches, starts, stops, and synchronization bars that join or fork several actions or activities. To represent an action or activity state, the UML uses the standard flowchart symbol used to show the enter and exit point of the flowchart. This symbol is used regardless of the type of action or activity occurring.

Like flowcharts, activity diagrams have a decision symbol. The outbound transitions are guarded conditions, simple boolean expressions, that determine the path of the flow of control. Unlike a flowchart, the UML defines a symbol that can be used to represent the instant where multiple flows of controls occur concurrently. A synchronization bar, a thick horizontal line, is used to show where a single path forks into parallel paths and where parallel paths join. There can be multiple outbound transitions (forking) or multiple inbound transitions (joining) where each transition represents a different path. Forking means multiple flows of control will occur and joining means multiple flows of control need to be synchronized.

Also, unlike flowcharts, the diagram can be divided into separate sections called swimlanes. Each swimlane represents a particular object, component, or use case and their actions or activities. Swimlanes are vertical lines that partition the diagram into sections. An action or activity can only occur in a single swimlane but transitions and synchronization bars can cross one or more swimlanes. Actions or activities in the same lane or different lanes but at the same level are concurrent.



Figure 2 courtesy "Professional Multicore Programming: Design and Implementation for C++ Developers" Hughes & Hughes 2008

The expression of concurrency seems sufficient for a manageable number of paths or threads. But what about massive parallelism, how would that be expressed? We will leave that to a future blog.

Flowcharts lost and regained for parallel activites may not rise to the level of the visualization of quantum theory but this technique and others that allow us to "visualize the model" gives us new insight and understanding of complicated processes and structures.

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video