menu
Menu
Drakon.Tech logo
Drakon.Tech
Get started
Drakon.Tech documentationProgramming in DRAKONThe basics of programming with Drakon.TechAdvanced programming methodsGame examplesThe source codeLegacy tutorials (JavaScript 0.2)Tutorial 1. Hello world!Tutorial 2. Variables and functionsTutorial 3. Basic flow controlTutorial 4. ChoiceTutorial 5. For each loopTutorial 6. The arrow loopTutorial 7. SilhouetteTutorial 8. Lambdas and exceptionsTutorial 9. ModulesTutorial 10. Concurrent programming with scenariosExamplesLibraries

Tutorial 7. Silhouette

Silhouette helps the reader understand complex logic

If you ask me about the most remarkable feature of the DRAKON language, I will say "silhouette." With silhouette, long processes become easy to understand.

Flowcharts in Drakon.Tech have the type primitive by default. The "Silhouette/primitive" button on the toolbox toggles the diagram type between primitive and silhouette.

A silhouette contains several smaller flowcharts that are called "silhouette branches." Each silhouette branch has a header at the top, a body, and one or more Address icons at the bottom.

The purpose of a silhouette is to divide a large flowchart into manageable chunks.

Silhouette

Flow direction on a silhouette flowchart

The flow starts with the leftmost branch. We go all the way to the bottom to an Address icon. The Address icon points to the next branch to run. We go through all the branches until we reach the final branch, which is always the rightmost branch. The convention is to arrange the branches so that they follow from left to right.

Flow direction on a silhouette flowchart

The silhouette loop

It is possible to connect a path from a Question or a Case icon to an Address icon, thus grounding the flow on the "floor" of the silhouette. This way, a silhouette branch can get more than one Address icon. When an Address icon points to its own branch or a previous branch, we have a silhouette loop. Drakon.Tech marks silhouette loops with triangles to make cycles apparent.

The silhouette loop

The three questions of the king

One silhouette diagram is more convenient than many disconnected smaller flowcharts. A silhouette breaks up a complex algorithm into logical parts, and yet these parts remain on the same visual scene.

Silhouette diagrams give the reader a quick overview of the algorithm. The layout of a 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?
The three questions of the king

The Header icon answers the first question. The branch headers answer the two other questions without delay because they are always at the top of the diagram, and they are aligned on a horizontal line.

close
Close
Drakon.Tech logo
Drakon.Tech home
Programming in DRAKONThe basics of programming with Drakon.TechAdvanced programming methodsThe source codeLegacy tutorials (JavaScript 0.2)