Flowchart Format
By convention flowcharts use stadia, diamonds and rectangles to respectively represent start/temination points, decision boxes and process boxes. However as it is difficult to pack much text into the diamond shape, Dissemino uses elongated hexagons instead. Flowcharts begin and terminate with stadia and have downward lines of execution, shown as arrowed lines known as connectors. The start stadium and each process box, have a single outgoing connector to the shape representing the next step. Decision boxes have two, one marked Y (TRUE), the other N (FALSE). The FALSE connector continues the current line of execution while TRUE branches to form a separate line of execution. Branches either terminate, loop back to a point before the decision box, or rejoin the current line of execution beyond the action applied by the FALSE connector.
This highly prescribed format makes flowcharts easy to specify. Shape dimensions are determined by text content and as connectors are implied, they are automatically generated. The tags used to create flowcharts are discussed below. Those familiar with C/C++ will recognize the influence, but this should not concern the unfamiliar as flowcharts use psudo code. The flowchart tags fall into three groups as follows:-
1: Action Statements
<step> This has a compulsory 'act' attribute to supply the psudo case step. <step> manifests as a process box with the step as test. <bloc> This tag merges multiple process steps, each provided as a <step> subtag, into a single process box. Arguably <bloc> is redundant as the same effect can be provided by including newlines (written as \n), in the act attribute of a <step> tag. However for internal reasons, <bloc> tags are generated by HadronZoo::CodeEnforcer so Dissemino is required to support them. They are generally considered a neater approach than a multiline <step> tag. <label> This has a compulsory 'name' attribute to supply a marker name which must be unique within the flowchart. <label> has no manifestation. <goto> This will manifest only as a connector, from the last shape drawn, to the point marked by a <label> tag. <break> This is only legal within either a loop or a swtich (see below). <continue> This is only legal within either a loop or a swtich (see below). <return> This terminates the line of execution. It is manifest as a connector from the last shape drawn to a new shape, a terminating stadium. <exit> Same as <return> except that it is intended to be used where termination is the result of a catastrophic error.
2: Conditional Branches
<if> This has a compulsory 'cond' attribute to supply the condition. <if> manifests as a decision box with the condition as text. The action to be taken in the event the condition is true, is described by subtags. <if> always results in a TRUE connector but not always in action shapes. If the action contains only a <break>, <continue>, or <goto>, there are no action shapes. Where there are shapes in respect of the action, these appear as a branch to the right with the TRUE connector to the first one. The FALSE connector is always to the next shape in the current line of execution. <elseif> This is only legal if the previous tag at the applicable level is an <if> or an <elseif>. Other than this, <elseif> is the same as <if> and manifests in the same way. <else> Like <elseif>, this is only legal if the previous tag at the applicable level is an <if> or an <elseif> tag. Unlike <elseif> however, no decision box or other shape is created in respect of the <else> tag. Instead <switch> Developers familiar with C/C++ will recognize this one. It is special form of if/else-if/else series (see note below).
3: Loops
<while> Loop in which the loop action is executed for as long as the controlling condition is TRUE. <while> manifests as a decision box with the TRUE connector to the shapes for the loop action on the right. The FALSE connector is to the next execution step in the current line. <dowhile> Loop in which the steps of the loop action are executed BEFORE the controlling condition is tested. This means the loop action is executed at least once, and is part of the applicable line of execution rather than a branch from it. <dowhile> manifests as the steps of the action with the decision box at the bottom. The TRUE connector of the decision box, loops back to the first step of the loop action. <for> This is like <while> but has two optional additional actions: The first executes once before the condition is tested, the second executes every time the loop completes but before the controlling condition is re-tested.
As an ilustration, consider the following flowchart:-
Writing this flowchart as a diagram would require the following tags:-
<xdiagram id="fig1" font="10px Arial" bgcolor="C0C0FF" height="320" width="280" linecolor="0"> <shapes fillcolor="F1C1B1"> <stadium id="1" top="30" bot="60" lft="20" rht="120"/> <rect id="2" top="140" bot="180" lft="20" rht="120"/> <diamond id="3" top="110" bot="210" lft="160" rht="260"/> <stadium id="4" top="250" bot="280" lft="160" rht="260"/> </shapes> <line y1="70" x1="60" y2="70" x2="140"/> <line y1="120" x1="160" y2="160" x2="160"/> <line y1="210" x1="210" y2="210" x2="250"/> <line y1="210" x1="110" y2="210" x2="80"/> <line y1="210" x1="80" y2="90" x2="80"/> <line y1="90" x1="80" y2="90" x2="140"/> <text align="center" ypos="140" xpos="15" str="Iterative Software Development Cycle"/> <text align="center" ypos="140" xpos="315" str="Courtesy of HadronZoo"/> <text ypos="40" xpos="40" str="Start"/> <text ypos="40" xpos="160" str="Do an Iteration"/> <text ypos="180" xpos="160" str="Does it Work?"/> <text ypos="215" xpos="100" str="N"/> <text ypos="215" xpos="220" str="Y"/> <text ypos="180" xpos="270" str="Deliver"/> </xdiagram>
Writing this directly as a flowchart is a lot simpler as follows:-
<xflowchart id="Fig 1" header="Iterative Software Development Cycle" footer="Courtesy of HadronZoo"> <dowhile obj="Does it work?"> <step obj="Do an iteration"/> </dowhile> <step obj="Deliver"/> </xflowchart>