<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>drakon &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/drakon/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Thu, 04 Sep 2025 20:53:08 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>drakon &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Why aren't there more visual programming languages? (An ode to DRAKON)]]></title>
		<link>https://shkspr.mobi/blog/2023/04/why-arent-there-more-visual-programming-languages-an-ode-to-drakon/</link>
					<comments>https://shkspr.mobi/blog/2023/04/why-arent-there-more-visual-programming-languages-an-ode-to-drakon/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Wed, 26 Apr 2023 11:34:46 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[drakon]]></category>
		<category><![CDATA[programming]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=45606</guid>

					<description><![CDATA[I think the computer programming industry is about to reach a reckoning. No, not because ChatGPT can poorly plagiarise buggy code - but because a whole generation of kids have grown up with Scratch. And they&#039;ll want professional tools which have Scratch&#039;s level of usability.  Hand-coding YAML files is a mug&#039;s game; one wrong whitespace and everything is broken. Left a semi-colon off the end of a…]]></description>
										<content:encoded><![CDATA[<p>I think the computer programming industry is about to reach a reckoning. No, not because ChatGPT can poorly plagiarise buggy code - but because a whole generation of kids have grown up with Scratch. And they'll want professional tools which have Scratch's level of usability.</p>

<p>Hand-coding YAML files is a mug's game; one wrong whitespace and everything is broken. Left a semi-colon off the end of a line of code; watch the compiler moan. Mixed up your ints, floats, and strings; the computer has a conniption.</p>

<p>This, frankly, is bollocks. And it isn't solved by having a better IDE gently putting <span style="text-decoration-line: underline; text-decoration-style: wavy; text-decoration-color: red;">danger lines</span> under errant code.</p>

<p>It's solved by having tools which don't let you make that kind of mistake. For example, Scratch lets you drag and drop elements and makes it <em>really</em> hard to have a syntax error - even in complex code:
<img src="https://shkspr.mobi/blog/wp-content/uploads/2023/04/MD5-Scratch.png" alt="Part of the MD5 algorithm expressed in colourful Lego blocks." width="1024" height="854" class="aligncenter size-full wp-image-45607">
(Snippet of <a href="https://scratch.mit.edu/projects/202543793/">MD5 in Scratch</a>)</p>

<p>Scratch isn't perfect. It doesn't prevent you from making logical mistakes - but it makes it much easier to visualise and debug what the computer is doing.</p>

<p>I've long been a fan of the <a href="https://shkspr.mobi/blog/2013/04/use-drakon-to-generate-code-from-flowcharts/">DRAKON programming language</a>. It lets you draw a flow chart and then generate code from that chart. Sadly, the desktop software is rather flakey. But, there's <a href="https://drakon.tech/">a new interactive web editor</a>. It lets you draw flow charts and immediately compile them into JavaScript.</p>

<p>Here's an excerpt from their demo Tetris game:</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2023/04/Drakon-Tetris-colourful.png" alt="A colourful state machine diagram." width="1024" height="537" class="aligncenter size-full wp-image-45609">

<p>It takes seconds to design a flow chart and, after a single click, have it spit out relatively optimised JavaScript.</p>

<p>I think you should give <a href="https://drakon.tech/"></a><a href="https://drakon.tech/">https://drakon.tech/</a> a try. It isn't quite as slick as Scratch in terms of having a strictly defined set of "blocks" to use - but it is a <em>much</em> easier tool for creating conditional statements compared to hand-creating a bunch of nested if-else statements which branch off in a twisted mess.</p>

<p>Are there any other tools which let programmers visually design their algorithms?</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=45606&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2023/04/why-arent-there-more-visual-programming-languages-an-ode-to-drakon/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Use DRAKON to Generate Code from Flowcharts]]></title>
		<link>https://shkspr.mobi/blog/2013/04/use-drakon-to-generate-code-from-flowcharts/</link>
					<comments>https://shkspr.mobi/blog/2013/04/use-drakon-to-generate-code-from-flowcharts/#respond</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Fri, 05 Apr 2013 11:04:08 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[drakon]]></category>
		<category><![CDATA[flowcharts]]></category>
		<category><![CDATA[programming]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=7943</guid>

					<description><![CDATA[It&#039;s 1986.  You&#039;re working on the Russian&#039;s Buran space programme - trying to create a re-usable space vehicle which will exceed the capabilities of the American&#039;s &#34;Space Shuttle&#34;.  There&#039;s a problem.  You have very complicated real-time algorithms which you need to review, improve, optimise, and then turn into code.  How do you do it?  Obviously, you invent DRAKON!  ДРАКОН, &#34;dragon&#34; Backronym for…]]></description>
										<content:encoded><![CDATA[<p>It's 1986.  You're working on the Russian's Buran space programme - trying to create a re-usable space vehicle which will exceed the capabilities of the American's "Space Shuttle".</p>

<p>There's a problem.  You have very complicated real-time algorithms which you need to review, improve, optimise, and then turn into code.  How do you do it?</p>

<p>Obviously, you invent <strong>DRAKON</strong>!</p>

<blockquote><p>ДРАКОН, "dragon"
</p><p>Backronym for "Дружелюбный Русский Алгоритмический язык, Который Обеспечивает Наглядность."
</p><p>Translation: "Friendly Russian algorithmic language that guarantees clarity."
</p><p><a href="http://en.wikipedia.org/wiki/DRAKON">Drakon on Wikipedia</a></p></blockquote>

<p>Drakon allows you to transform this:
<a href="https://shkspr.mobi/blog/wp-content/uploads/2013/04/Drakon-Demo-Flowchart-fs8.png"><img src="https://shkspr.mobi/blog/wp-content/uploads/2013/04/Drakon-Demo-Flowchart-fs8-1024x416.png" alt="Drakon Demo Flowchart-fs8" width="1024" height="416" class="alignnone size-large wp-image-7939"></a></p>

<p>Into This:
<img src="https://shkspr.mobi/blog/wp-content/uploads/2013/04/Drakon-Generate-JavaScript-fs8.png" alt="Drakon Generate JavaScript-fs8" width="535" height="693" class="alignnone size-full wp-image-7938"></p>

<p>Frankly, it's a little bit like magic.</p>

<h2 id="why-use-drakon"><a href="https://shkspr.mobi/blog/2013/04/use-drakon-to-generate-code-from-flowcharts/#why-use-drakon">Why Use Drakon?</a></h2>

<p>I've only just started exploring the possibilities of Drakon - so I have a convert's zeal and a neophyte's experience - but here's the elevator pitch.</p>

<blockquote><p>Human eyes and brains are optimised for looking at shapes and patterns - not lines and lines of text.  Drakon allows you to spot errors in your algorithms before you commit them to code.

Once you have drawn out the code using the visual editor, it can automatically produce clean and efficient code in Java, C#, C/C++, Python, Tcl, Javascript, Lua and Erlang.</p></blockquote>

<p>It really is amazing when you start to use it.  If you have a complex process, a knotty algorithm, or any large scale information that you want to convey to an audience - Drakon is perfect.</p>

<p>Let's take, for example, <a href="http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm">Dijkstra's algorithm</a>.  When expressed in Python, it takes a savant to intuitively understand what the algorithm does - even if it is well commented.</p>

<p>It takes someone with a lot of experience to spot inefficiencies or problems.</p>

<p>Here's the algorithm expressed in Python.</p>

<pre lang="python">from priodict import priorityDictionary

def Dijkstra(G,start,end=None):

    D = {}  # dictionary of final distances
    P = {}  # dictionary of predecessors
    Q = priorityDictionary()   # est.dist. of non-final vert.
    Q[start] = 0

    for v in Q:
        D[v] = Q[v]
        if v == end: break

        for w in G[v]:
            vwLength = D[v] + G[v][w]
            if w in D:
                if vwLength &lt; D[w]:
                    raise ValueError,
  "Dijkstra: found better path to already-final vertex"
            elif w not in Q or vwLength &lt; Q[w]:
                Q[w] = vwLength
                P[w] = v

    return (D,P)

def shortestPath(G,start,end):
    D,P = Dijkstra(G,start,end)
    Path = []
    while 1:
        Path.append(end)
        if end == start: break
        end = P[end]
    Path.reverse()
    return Path
</pre>

<p>Now, let's take a look at how that would be constructed in Drakon.</p>

<iframe title="DRAKON Editor and Dijkstra's algorithm" width="620" height="349" src="https://www.youtube.com/embed/5IJ8Kf7mwDY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe>

<p>With almost zero knowledge you can quickly and easily see where your mistakes are.  Drakon flowcharts can be exported as images, blown up on projectors, or simply emailed around.</p>

<p>Once you're happy with the diagram, you click a button and it spits out JavaScript, Java, C#, C/C++, Python, Tcl, Lua or Erlang.</p>

<h2 id="what-have-i-used-it-for"><a href="https://shkspr.mobi/blog/2013/04/use-drakon-to-generate-code-from-flowcharts/#what-have-i-used-it-for">What Have I Used It For?</a></h2>

<p>My dad wants some help building an app. Like the dutiful son I am, I agreed and asked him to send over what he had so far.  This is what I got.
<img src="https://shkspr.mobi/blog/wp-content/uploads/2013/04/Flow-Chart-Hand-Written.jpg" alt="Flow Chart Hand Written" width="400" height="266" class="alignnone size-full wp-image-7950">
Not exactly the easiest of things to work from, dad!</p>

<p>So, I began transcribing the algorithm by hand into JavaScript.  It quickly became a mess of if...else, nested conditions, and general spaghetti code - I think I even threw in a GOTO statement :-)
None of which was made easier by the fact that there were some obvious errors in the original flow chart.  "Yes" where "no" was meant, lines which criss-crossed each other, etc.</p>

<p>After an hour or so of using Drakon for the first time, I'd transformed the pen and ink drawing into this:
<img src="https://shkspr.mobi/blog/wp-content/uploads/2013/04/Flow-Chart-from-Drakon.png" alt="Flow Chart from Drakon" width="600" height="372" class="alignnone size-full wp-image-7951"></p>

<p>Perhaps not the finest flowchart known to man, but a lot easier to understand.  I was able to make changes, see where the errors were, optimise the flow.  My father - who has no knowledge of JavaScript - was able to look at the chart and verify that it was correct.</p>

<p>Most importantly, I clicked a button and it generated the sort of intricately nested JavaScript which would have taken me all day to write by hand.</p>

<p>Finally, <a href="http://drakon-editor.sourceforge.net/instant_save.html">there's no save button</a>!  Every action is automatically saved without the need for any user interaction. Stepan Mitkin, the Russian developer behind the current open source Drakon project, says:</p>

<blockquote><p>The "Save" button is obsolete. Pressing "Save" is boring and stressful work. Boring work must be done by the machine.</p></blockquote>

<p>Writing algorithms is boring, stressful, repetative, error-prone work.  Let Drakon do it for you.</p>

<h2 id="getting-started"><a href="https://shkspr.mobi/blog/2013/04/use-drakon-to-generate-code-from-flowcharts/#getting-started">Getting Started</a></h2>

<p><a href="http://drakon-editor.sourceforge.net/">Download Drakon for Linux, Mac, Windows</a>.</p>

<p>On Linux, you'll need to install a few dependencies.
</p>

<pre>sudo apt-get install tk tcl libsqlite3-tcl tcllib libtk-img</pre>

<p>To run, open the command line, navigate to where you unzipped the files and run:</p>

<pre>tclsh drakon_editor.tcl</pre>

<p>or, simply:</p>

<pre>./drakon_editor.tcl</pre>

<p><a href="http://drakon-editor.sourceforge.net/file_format.html">Drakon files are SQLite 3.6 databases</a> - so you are not locked in to a proprietary file format.</p>

<h2 id="bonus"><a href="https://shkspr.mobi/blog/2013/04/use-drakon-to-generate-code-from-flowcharts/#bonus">BONUS!</a></h2>

<p>Several years ago, the <i lang="de">Technikmuseum Speyer</i> in Germany purchased Buran Analog BST-02 - one of the craft used for test flights in the Soviet Buran programme.  I was in Düsseldorf at the time and got to watch it being sailed down the Rhine.  Magical!</p>

<iframe title="OK-GLI Russian Space Shuttle Sailing Along the Rhine (2008)" width="620" height="465" src="https://www.youtube.com/embed/kUrcCLEVmqo?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=7943&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2013/04/use-drakon-to-generate-code-from-flowcharts/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
