DRAKON Visual Language · In DRAKON, the next icon is always below. Even worse It is not allowed to...

68
DRAKON Visual Language Tutorial. Part 1: How to draw DRAKON flowcharts

Transcript of DRAKON Visual Language · In DRAKON, the next icon is always below. Even worse It is not allowed to...

Page 1: DRAKON Visual Language · 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

DRAKON Visual Language

Tutorial. Part 1:How to draw DRAKON flowcharts

Page 2: DRAKON Visual Language · 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

Types of DRAKON diagrams

Primitive

Silhouette

Used for the most simplealgorithms

Recommended for allother algorithms

Page 3: DRAKON Visual Language · 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

Primitive

Page 4: DRAKON Visual Language · 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

What does a primitive consist of?

Page 5: DRAKON Visual Language · 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

What does a primitive consist of?

A vertical skewer

Page 6: DRAKON Visual Language · 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

What does a primitive consist of?

The header

Page 7: DRAKON Visual Language · 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

What does a primitive consist of?

The algorithm

Page 8: DRAKON Visual Language · 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

What does a primitive consist of?

The “End” icon

Page 9: DRAKON Visual Language · 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

“Action” icon

An “Action” icon

Page 10: DRAKON Visual Language · 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

“Action” icon

an order to do something

Page 11: DRAKON Visual Language · 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

The skewer must be vertical

Page 12: DRAKON Visual Language · 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

Wrong!

Page 13: DRAKON Visual Language · 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

Wrong again

● Use lines instead of arrows● Arrows create visual noise

In DRAKON,the next icon is always below

Page 14: DRAKON Visual Language · 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

Even worse● It is not allowed to break the skewer

Page 15: DRAKON Visual Language · 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

“Insertion” icon

It is a reference

to an algorithm

that is defined elsewhere

Page 16: DRAKON Visual Language · 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

“Insertion” icon

Page 17: DRAKON Visual Language · 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

“If” icon

Page 18: DRAKON Visual Language · 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

“If” icon

Contains a questionthat can be answered

“yes” or “no”

Page 19: DRAKON Visual Language · 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

The happy path goes straight

The happy pathis the most successful

and desirable route

Page 20: DRAKON Visual Language · 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

The unlucky scenario goes to the right

Page 21: DRAKON Visual Language · 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

The further to the right,the worse it is

Page 22: DRAKON Visual Language · 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

Good

Bad

Worst

Page 23: DRAKON Visual Language · 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

Wrong

The happy path

is broken

Page 24: DRAKON Visual Language · 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

Right

The happy path

is straight

Page 25: DRAKON Visual Language · 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

Visual noise is bad

Too many angles

Page 26: DRAKON Visual Language · 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

Horizontal joining

The problem is solved

Page 27: DRAKON Visual Language · 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

Repetition is bad

Page 28: DRAKON Visual Language · 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

Vertical joining

Removes repetition

Page 29: DRAKON Visual Language · 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

Line intersectionsare forbidden

Page 30: DRAKON Visual Language · 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

Intersections kill readability

Page 31: DRAKON Visual Language · 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

Silhouette

The recommended type of diagrams

Page 32: DRAKON Visual Language · 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

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

Page 33: DRAKON Visual Language · 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

What does a silhouette consist of?

Page 34: DRAKON Visual Language · 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

The header

Page 35: DRAKON Visual Language · 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

The branches

Page 36: DRAKON Visual Language · 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

What does a branch consist of?A header with

the branch name

Page 37: DRAKON Visual Language · 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

What does a branch consist of?

The algorithmof the branch

Page 38: DRAKON Visual Language · 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

What does a branch consist of?

The addressof the next branch

Page 39: DRAKON Visual Language · 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

Silhouette answersthe 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?

Page 40: DRAKON Visual Language · 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

1. What is the name of the problem?

Page 41: DRAKON Visual Language · 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

2. How many problems does the problem have?

Page 42: DRAKON Visual Language · 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

3. What are the names of the parts?

Page 43: DRAKON Visual Language · 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

The leftmost branch is run first

Page 44: DRAKON Visual Language · 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

Then follow the other branches

Page 45: DRAKON Visual Language · 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

The rightmost branch goes last

Page 46: DRAKON Visual Language · 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

There can be only one“End” icon

on the DRAKON diagram

Page 47: DRAKON Visual Language · 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

The order of branches is defined in the “Address” icons

Page 48: DRAKON Visual Language · 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

The branches should by sorted left-to-right

Page 49: DRAKON Visual Language · 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

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).

Page 50: DRAKON Visual Language · 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

A branch can have several “Address” icons

The algorithm of such branchdecides which branch to run next

Page 51: DRAKON Visual Language · 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

A direct jump from one branch to another is forbidden

Page 52: DRAKON Visual Language · 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

Icon “Select”

Contains a question:● that cannot be answered “yes” or “no”● that can have several answers

Page 53: DRAKON Visual Language · 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

Icon “Select”

Page 54: DRAKON Visual Language · 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

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

Page 55: DRAKON Visual Language · 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

The further to the right, the larger it is

Page 56: DRAKON Visual Language · 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

Loops

Page 57: DRAKON Visual Language · 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

Lift the weight while not tired

Page 58: DRAKON Visual Language · 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

The body of this loopis run at least once

Page 59: DRAKON Visual Language · 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

Hungry?

If yes, theneat a hamburgerstart from the

beginning

If no, then leave

Page 60: DRAKON Visual Language · 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

This loop is skipped if the condition is not met

Page 61: DRAKON Visual Language · 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

The loop condition is inside the loop body

Page 62: DRAKON Visual Language · 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

“For each” loop

Page 63: DRAKON Visual Language · 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

There can be several exits from a loop

Page 64: DRAKON Visual Language · 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

There can be only ONE ENTRANCEinto a loop

Wrong!A second

entrance isnot allowed

Page 65: DRAKON Visual Language · 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

Silhouette loop: some branches are run several times

Page 66: DRAKON Visual Language · 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

Silhouette loop: some branches are run several times

Loop branches are markedwith black triangles

Page 67: DRAKON Visual Language · 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

“Select” loop

Page 68: DRAKON Visual Language · 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

Stepan Mitkin

[email protected]

The diagrams on the slides were made with DRAKON Editor

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

June 2013

End