DRAKON Visual Language: Tutorial. Part 1: How To Draw DRAKON Flowcharts

Download as pdf or txt
Download as pdf or txt
You are on page 1of 68

DRAKON Visual

Language
Tutorial. Part 1:
How to draw DRAKON flowcharts
Types of DRAKON diagrams

Used for the most simple


Primitive algorithms

Recommended for all


Silhouette other algorithms
Primitive
What does a primitive consist of?
What does a primitive consist of?

A vertical skewer
What does a primitive consist of?

The header
What does a primitive consist of?

The algorithm
What does a primitive consist of?

The “End” icon


“Action” icon

An “Action” icon
“Action” icon

an order to do
something
The skewer must be vertical
Wrong!
Wrong again


Use lines instead of arrows

Arrows create visual noise

In DRAKON,
the next icon is always below
Even worse

It is not allowed to break the skewer
“Insertion” icon

It is a reference
to an algorithm
that is defined elsewhere
“Insertion” icon
“If” icon
“If” icon

Contains a question
that can be answered
“yes” or “no”
The happy path goes straight

The happy path


is the most successful
and desirable route
The unlucky scenario goes to the right
The further to the right,
the worse it is
Bad
Worst

Good
Wrong

The happy path


is broken
Right

The happy path


is straight
Visual noise is bad

Too many angles


Horizontal joining

The problem is solved


Repetition is bad
Vertical joining
Removes repetition
Line intersections
are forbidden
Intersections kill readability
Silhouette

The recommended type of diagrams


What can silhouette do?

It can cleanly split the diagram into logical
parts

It can represent a finite automaton (state
machine)

It helps get rid of line intersections in complex
algorithms
What does a silhouette consist of?
The header
The branches
What does a branch consist of?
A header with
the branch name
What does a branch consist of?

The algorithm
of the branch
What does a branch consist of?

The address
of the next branch
Silhouette answers
the three questions of the king:

1. What is the name of the problem?


2. How many parts does the problem have?
3. What are the names of the parts?
1. What is the name of the problem?
2. How many problems does the problem have?
3. What are the names of the parts?
The leftmost branch is run first
Then follow the other branches
The rightmost branch goes last
There can be only one
“End” icon
on the DRAKON diagram
The order of branches is defined in the “Address” icons
The branches should by sorted left-to-right
When is it allowed to go to the left?

1. When some branches need to be repeated.


2. When the diagram represents a finite
automaton (state machine).
A branch can have several “Address” icons

The algorithm of such branch


decides which branch to run next
A direct jump from one branch to another is
forbidden
Icon “Select”

Contains a question:

that cannot be answered “yes” or “no”

that can have several answers
Icon “Select”
How to arrange the answers?

Following the principle “The further to the right, the
worse it is”
or

Following the principle “The further to the right, the
larger it is”
or

Following the principle “The further to the right, the
higher it is”
or...

The key thing is to sort the answers


The further to the right, the larger it is
Loops
Lift the weight while not tired
The body of this loop
is run at least once
Hungry?

If yes, then
eat a hamburger
start from the
beginning

If no, then leave


This loop is skipped if the condition is not met
The loop condition is inside the loop body
“For each” loop
There can be several exits from a loop
There can be only ONE ENTRANCE
into a loop

Wrong!
A second
entrance is
not allowed
Silhouette loop: some branches are run several times
Silhouette loop: some branches are run several times
Loop branches are marked
with black triangles
“Select” loop
End

Stepan Mitkin
stipan.mitkin@gmail.com

The diagrams on the slides were made with


DRAKON Editor
http://drakon-editor.sourceforge.net/

June 2013

You might also like