Iconic Programming
Iconic programming involves writing programs that resemble what they do, through the prominent use of icons – a kind of “resemblance-oriented programming”, if you will.
Fact
In semiotics, a distinction is made between icons and symbols. Symbols signify what they reference through convention, while icons signify through resemblance.
This distinction is associated with the American philosopher Charles Sanders Peirce.
Symbols and icons
Unlike icons, symbols are abstract. They don’t necessarily resemble any concrete thing. Their meaning emerges through convention, as in the everyday rules of a language.
There is nothing about the following set of symbols that immediately suggest a circle. If we are familiar with some conventions in geometry, English and JavaScript then we can nonetheless interpret that drawBigCircle(3)
will draw a circle of radius 9
.
Pointers are pointy
In a letter to his wife from 18701, Peirce used simple illustrations to convey what he encountered in his European travels, including Mount Etna, the craters of which are themselves small mountains.
The ^
in Peirce’s drawings is iconic. It resembles the wide base, steep sides and narrow peak of a mountain.
Icons can also bear a resemblance to a non-physical concept.
The Odin language uses ^
for its pointers:
pointer_to_int: ^int
In C, *
is instead used:
int *
The Odin documentation states as justification:
Odin borrows the ^ syntax for pointers from the Pascal family, because it is pointy […]
– my italics
The syntax for pointer in Odin and Pascal resembles the concept of what a pointer does: it is pointy because it points2.
Neither language is fully iconic, as they use combinations of both symbols and icons. The mnemonic and expressive benefits if icons can be leveraged without a wholesale adoption of an iconic language.
Sand falls down
Icons can be used to write programs where the input resembles the output. The following syntax is from SPLAT:
@ => _
_ @
It is a rule: if a particle is above empty space it will fall into that space. The @
is a particle and the _
is empty space.
In the more accessible SpaceTode – a “spatial programming language” inspired by SPLAT – this rule yields a visual output: particles that fall.
Taken together, the set of characters is itself iconic: the rule resembles the causal event that it generates
The creators of SPLAT (Dave Ackley) and SpaceTode (Lu Wilson) rightly emphasise the spatial aspect of their work, but I also think resemblance is a salient characteristic.
Comments illuminate
In APL, comments are prefixed with the ⍝
or “lamp” symbol:
⍝ this is a comment
The intention is that comments illuminate the code. Comments should resemble a (metaphorical) illumination, rather than — for example — a mere recapitulation. This icon is a reminder to the programmer, but not a guarantee of illumination.
Like Odin and Pascal, APL is not strictly iconic, as it contains a mixture of icons and more abstract symbols, often borrowed from mathematics. If you find APL code inscrutable, it’s probably not solely owing to its use of icons.
⍝ for illumination: https://xpqz.github.io/learnapl/aplway.html
⍉2∘⊥⍣¯1⍳2*3
Iconic programming and visual programming
Visual programming is often contrasted with conventional, text-based programming. Visual programs typically rely on graphical elements (boxes, nodes, blocks), which can be dragged and connected. These interfaces can be more convenient for specific users or for particular use-cases.
In semiotic terms, icons resemble what they represent, yet the concept of “resemblance” is not only visual.
Mary resembles her father in her temperament
The stimulatory effects of coffee resemble that of tea
All games share a family resemblance with each other
The dog-owner’s hand gesture resembles the action he expects of the dog
Consider also that:
Programming visually/graphically does not require any icons. The most common building blocks are
nodes
andedges
, which are fundamentally abstract.Programming with icons does not require a graphical user interface. I can type or write
^ ^ ^
to represent a mountain range without a GUI.Programming with icons does not require a spatial interpretation. Prefixing a comment with
⍝
is a subtle reminder that its effect should resemble a process of illumination.
Here are some icons that I can type, and how they might be interpreted in a given domain:
^
pointer!
filter()
container(())
nested containero
loop#
grid/
gradient@
atom
Why icons?
I might like to program with icons because they have an immediate conceptual similarity to what I am trying to make. I might like to leverage this similarity while still using a keyboard and plain text. Whether such a language is readable or effective depends on the language design.
A needless multiplication of symbols does not need to necessarily result. One difficulty would be in selecting a finite set of icons for highly generalisable ideas. Ideas like parthood, connection and enclosure are highly general, span many contexts and can be combined in many ways.
A language does not need to be fully iconic, but can leverage icons to make abstract concepts more concrete. An excellent example here is the use of the pointy ^
for pointers in Odin and Pascal.
Important
Just as pointers can be pointy, pipes can be…pipey.
In Unix, the
|
or “pipe” is used to compose a pipeline of commands.| | |
The
|
seems to resemble a pipe, although I could not find any evidence of this being a reason for its original selection.
There is something powerful about the idea of “resemblance”. How can programs be made to look and feel more like what they do? What important non-visual resemblances exist and how can they be represented?
References
- Future of Coding episode 72: podcast about Pygmalion, a prototype for a programming environment that uses “icons”, although the original author does not use the term in the strict, semiotic sense.
- Ivan Reese’s visual programming Codex: organised collection of visual programming tools, concepts and discussions.
- Dave Ackley’s SPLAT: Spatial Programming Language, ASCII Text, which I think has some iconic aspects.
- Lu Wilson’s SpaceTode: a spatial programming language, which I think has some iconic aspects.