​

DRAKON-Erlang: Visual Functional Programming

Home|Download

By Stepan Mitkin

Part 9 of 10

Previous|Contents|Next

Summary

Functional programming and DRAKON

The Böhm-Jacopini theorem states that any imaginable algorithm can be expressed with only 3 basic building blocks:

  1. A sequence of actions.
  2. Branching based on a boolean expression.
  3. A loop construct.

Functional programming throws away loops. Doing so makes programming conceptually easier:

  • All values can be made read only. Everything is passed by value.
  • Function composition becomes safe.
  • An algorithm receives an explicit input and output.

But functional programming has a problem. This problem is the tradition to use hard-to-read text-based notation. DRAKON-Erlang alleviates this issue by using graphics instead of text for flow control.

DRAKON-Erlang integrates two state-of-the-art technologies:

  • Erlang, a functional programming language with built-in support for concurrency.
  • DRAKON, an ergonomically aware graphical language for algorithms.

The rules of DRAKON

Line and icon rules:

  • No slanting or curved lines. Only straight lines with right angles.
  • No line intersections.
  • Icons are placed only on vertical lines.
  • Main verticals must not have turns.
  • Do not connect branches in a silhouette.
  • There must be exactly one "End" icon on a diagram.

Usability recommendations:

  • The further to the right ⎯ the worse.
  • Arrange "Case" icons in a consistent manner.
  • Use graphic formulas instead of text formulas to express boolean logic.

Silhouette recommendations:

  • Prefer silhouette over primitive when it makes sense.
  • The order of branches in a silhouette should be left-to-right.
  • If that does not break other rules, sort the "Address" icons of the same branch according to the order of the branches they point to.

Erlang-specific recommendations:

  • Don't use pattern matching for branching. Do use pattern matching for other purposes.
  • Mark recursive calls.

The principles of DRAKON

  • Clarity is above all. It is better to sacrifice space than readability.
  • No hidden paths. DRAKON makes all important things visible.
  • No redundant visual details.
  • An algorithm must look good.

Benefits of DRAKON-Erlang

  • DRAKON provides a switch from text to ergonomically optimized graphics.
  • Rule "The further to the right ⎯ the worse" adds an additional dimension to the algorithm.
  • The silhouette construct introduces hierarchy into the diagram.
  • Boolean expressions are not cryptic any more.
  • Branching is done in a simple, visible and consistent way.

Sources

  • http://learnyousomeerlang.com/
  • Erlang and OTP in Action. Martin Logan, Eric Merritt, and Richard Carlsson. Manning, 2010. ISBN: 1933988789.
  • Учись писать, читать и понимать алгоритмы. Паронджанов В.Д. ВМК Пресс, 2012. ISBN: 978-5-94074-800-7
  • DRAKON: The Human Revolution in Understanding Programs. Stepan Mitkin. 2011.
  • DRAKON Editor: http://drakon-editor.sourceforge.net/

Previous|Contents|Next


Contact: drakon.editor@gmail.com