By Stepan Mitkin
Part 6 of 10
DRAKON has two types of diagrams:
Silhouette is the recommended way of drawing diagrams with DRAKON.
Silhouette combines several simple diagrams to build a complex one. The goal is to partition a big algorithm into logical parts. These parts are called "branches".
Each branch has a name. A branch ends with an "Address" icon that points to the next branch. The rightmost branch has an "End" icon instead of an "Address" at the bottom. There can be only one "End" in an algorithm.
Silhouette answers the three questions of the king:
The "Header" icon contains the name of the diagram and answers the first question.
The branches answer the second question.
The headers of the branches give the answer to the third question.
The diagram name is always located in the upper-left corner of the diagram. The branch headers are just under the diagram name. They are aligned to form a horizontal line.
This convention allows the reader to grasp the general ideas of the algorithm without delving into the details.
Theoretically, the branches could follow each other in any order. The next branch to execute is determined by the name inside the "Address" icon of the previous branch.
Nevertheless, DRAKON rules recommend to arrange the branches left-to-right. The leftmost branch should be the first one. The rightmost branch should be the last one. The branches in between should be sorted in such a way that the next branch should always be to the right from the current one. Some branches can be skipped.
In procedural languages, it is possible to jump back to a branch which is to the left from the current branch. This is especially convenient for programming of finite automata.
DRAKON's silhouette is a very good way of representing a state machine:
But functional languages usually do not have loops. Therefore jumping left on a DRAKON-Erlang silhouette is not allowed.
When a branch has several "Address" icons, it is recommended to sort them so that they appear in the same order as the branches they point to. This guideline should not apply when such ordering breaks "The further to the right ⎯ the worse" rule. Routing the happy path through the main vertical and moving the error handling to the right is more important.
A silhouette that implements the quicksort algorithm:
The main verticals of the branches constitute the happy path of the whole silhouette. The reader may follow only the main verticals if he is not interested in the processing of error situations.
Rule: never connect two branches of a silhouette.
The lines and the arrow that surround the branches in a silhouette are technically not necessary. But their presense gives the diagram a connected and finished look. The diagram is perceived not as a disjoint set of parts, but as a whole picture that has a meaning.
Contact: drakon.editor@gmail.com