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

DRAKON Visual Language: Tutorial. Part 1

Embed Size (px)

DESCRIPTION

Getting started with DRAKON flowcharts

Citation preview

Page 1: DRAKON Visual Language: Tutorial. Part 1

DRAKON Visual Language

Tutorial. Part 1:How to draw DRAKON flowcharts

Page 2: DRAKON Visual Language: Tutorial. Part 1

Types of DRAKON diagrams

Primitive

Silhouette

Used for the most simplealgorithms

Recommended for allother algorithms

Page 3: DRAKON Visual Language: Tutorial. Part 1

Primitive

Page 4: DRAKON Visual Language: Tutorial. Part 1

What does a primitive consist of?

Page 5: DRAKON Visual Language: Tutorial. Part 1

What does a primitive consist of?

A vertical skewer

Page 6: DRAKON Visual Language: Tutorial. Part 1

What does a primitive consist of?

The header

Page 7: DRAKON Visual Language: Tutorial. Part 1

What does a primitive consist of?

The algorithm

Page 8: DRAKON Visual Language: Tutorial. Part 1

What does a primitive consist of?

The “End” icon

Page 9: DRAKON Visual Language: Tutorial. Part 1

“Action” icon

An “Action” icon

Page 10: DRAKON Visual Language: Tutorial. Part 1

“Action” icon

an order to do something

Page 11: DRAKON Visual Language: Tutorial. Part 1

The skewer must be vertical

Page 12: DRAKON Visual Language: Tutorial. Part 1

Wrong!

Page 13: DRAKON Visual Language: Tutorial. Part 1

Wrong again

● Use lines instead of arrows● Arrows create visual noise

In DRAKON,the next icon is always below

Page 14: DRAKON Visual Language: Tutorial. Part 1

Even worse● It is not allowed to break the skewer

Page 15: DRAKON Visual Language: Tutorial. Part 1

“Insertion” icon

It is a reference

to an algorithm

that is defined elsewhere

Page 16: DRAKON Visual Language: Tutorial. Part 1

“Insertion” icon

Page 17: DRAKON Visual Language: Tutorial. Part 1

“If” icon

Page 18: DRAKON Visual Language: Tutorial. Part 1

“If” icon

Contains a questionthat can be answered

“yes” or “no”

Page 19: DRAKON Visual Language: Tutorial. Part 1

The happy path goes straight

The happy pathis the most successful

and desirable route

Page 20: DRAKON Visual Language: Tutorial. Part 1

The unlucky scenario goes to the right

Page 21: DRAKON Visual Language: Tutorial. Part 1

The further to the right,the worse it is

Page 22: DRAKON Visual Language: Tutorial. Part 1

Good

Bad

Worst

Page 23: DRAKON Visual Language: Tutorial. Part 1

Wrong

The happy path

is broken

Page 24: DRAKON Visual Language: Tutorial. Part 1

Right

The happy path

is straight

Page 25: DRAKON Visual Language: Tutorial. Part 1

Visual noise is bad

Too many angles

Page 26: DRAKON Visual Language: Tutorial. Part 1

Horizontal joining

The problem is solved

Page 27: DRAKON Visual Language: Tutorial. Part 1

Repetition is bad

Page 28: DRAKON Visual Language: Tutorial. Part 1

Vertical joining

Removes repetition

Page 29: DRAKON Visual Language: Tutorial. Part 1

Line intersectionsare forbidden

Page 30: DRAKON Visual Language: Tutorial. Part 1

Intersections kill readability

Page 31: DRAKON Visual Language: Tutorial. Part 1

Silhouette

The recommended type of diagrams

Page 32: DRAKON Visual Language: Tutorial. Part 1

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: Tutorial. Part 1

What does a silhouette consist of?

Page 34: DRAKON Visual Language: Tutorial. Part 1

The header

Page 35: DRAKON Visual Language: Tutorial. Part 1

The branches

Page 36: DRAKON Visual Language: Tutorial. Part 1

What does a branch consist of?A header with

the branch name

Page 37: DRAKON Visual Language: Tutorial. Part 1

What does a branch consist of?

The algorithmof the branch

Page 38: DRAKON Visual Language: Tutorial. Part 1

What does a branch consist of?

The addressof the next branch

Page 39: DRAKON Visual Language: Tutorial. Part 1

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: Tutorial. Part 1

1. What is the name of the problem?

Page 41: DRAKON Visual Language: Tutorial. Part 1

2. How many problems does the problem have?

Page 42: DRAKON Visual Language: Tutorial. Part 1

3. What are the names of the parts?

Page 43: DRAKON Visual Language: Tutorial. Part 1

The leftmost branch is run first

Page 44: DRAKON Visual Language: Tutorial. Part 1

Then follow the other branches

Page 45: DRAKON Visual Language: Tutorial. Part 1

The rightmost branch goes last

Page 46: DRAKON Visual Language: Tutorial. Part 1

There can be only one“End” icon

on the DRAKON diagram

Page 47: DRAKON Visual Language: Tutorial. Part 1

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

Page 48: DRAKON Visual Language: Tutorial. Part 1

The branches should by sorted left-to-right

Page 49: DRAKON Visual Language: Tutorial. Part 1

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: Tutorial. Part 1

A branch can have several “Address” icons

The algorithm of such branchdecides which branch to run next

Page 51: DRAKON Visual Language: Tutorial. Part 1

A direct jump from one branch to another is forbidden

Page 52: DRAKON Visual Language: Tutorial. Part 1

Icon “Select”

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

Page 53: DRAKON Visual Language: Tutorial. Part 1

Icon “Select”

Page 54: DRAKON Visual Language: Tutorial. Part 1

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: Tutorial. Part 1

The further to the right, the larger it is

Page 56: DRAKON Visual Language: Tutorial. Part 1

Loops

Page 57: DRAKON Visual Language: Tutorial. Part 1

Lift the weight while not tired

Page 58: DRAKON Visual Language: Tutorial. Part 1

The body of this loopis run at least once

Page 59: DRAKON Visual Language: Tutorial. Part 1

Hungry?

If yes, theneat a hamburgerstart from the

beginning

If no, then leave

Page 60: DRAKON Visual Language: Tutorial. Part 1

This loop is skipped if the condition is not met

Page 61: DRAKON Visual Language: Tutorial. Part 1

The loop condition is inside the loop body

Page 62: DRAKON Visual Language: Tutorial. Part 1

“For each” loop

Page 63: DRAKON Visual Language: Tutorial. Part 1

There can be several exits from a loop

Page 64: DRAKON Visual Language: Tutorial. Part 1

There can be only ONE ENTRANCEinto a loop

Wrong!A second

entrance isnot allowed

Page 65: DRAKON Visual Language: Tutorial. Part 1

Silhouette loop: some branches are run several times

Page 66: DRAKON Visual Language: Tutorial. Part 1

Silhouette loop: some branches are run several times

Loop branches are markedwith black triangles

Page 67: DRAKON Visual Language: Tutorial. Part 1

“Select” loop

Page 68: DRAKON Visual Language: Tutorial. Part 1

Stepan Mitkin

[email protected]

The diagrams on the slides were made with DRAKON Editor

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

June 2013

End