I recently came across a very interesting article that highlighted that, until the invention of Arabic numbers, multiplication using roman numerals was difficult. The Arabic positional number system made it much easier. It is the same for software. Programming software is difficult. Until someone comes up with the equivalent of Arabic numbers for programming, it will remain so.
This made me think profoundly. What makes it that programming software is difficult? Is it that programming languages are cryptic? Too many APIs? Complicated build tools? Not close enough to assembly language? Or too far away? But what if it's abstraction itself that is difficult?
I am a big fan of the idea of Coda that mixes spreadsheets with word-like documents and makes it possible to create text that appears based on conditions, for example. It is very nice to have a domain-specific language for computing cells as in any spreadsheets, and to be able to insert cells into a document.
However, in many office-like tools, I still miss a way to create reusable abstractions. Google Spreadsheet and Microsoft Excel give access to APIs and offer abstractions as macros, but they are no longer part of the visible document, and cannot be edited with the same nice visual interface.
Let us imagine what if, in a mocked word processor interface named MikoWord, we had access to a direct command to abstract.
Can it also be a good candidate for visually developing software?
Parts in this style can be skipped.
Welcome to MikoWord!
MikoWord is a word processor for webpages which will satisfy both programmers and non-programmers. MikoWord features a simple but powerful tool to abstract. In this tutorial aimed at beginners, we will explain how to use this tool by walking through several examples. We will create a rich and dynamic help page for an application named MySoft. In this tutorial, you will learn:
No coding skills are required. Let’s start!
MikoWord displays a blank page, in which you can immediately write something. Go ahead, write and apply styles to obtain:
In a regular document, every time you update MySoft’s version, you would have to update it manually everywhere. In MikoWord, it is easier. Select "MySoft 1.0", and abstract it.
Abstracting is giving a name to something concrete. If you hover over the "MySoft 1.0" that has a stripes background, in the title, you will now see that it has been assigned the name mysoft. This special style indicates that you can double-click it to reveal the formula behind it — or touch it for one second on mobile. The portion to the right of mysoft is called its content and is also like a document, meaning you can further abstract inside, e.g. the name and the version.
Note that all declarations like mysoft will be hidden when you print, publish or export it, and the background under "MySoft 1.0" will disappear. If you prefer a style other than stripes, go to Settings > Styles > Reused content and change the style.
By opening the context menu over mysoft, you could also specify to display abstractions only when they are needed during editing, depending on where your caret is. For this tutorial, we will always display them.
Now copy "MySoft 1.0" from the title, and paste it to replace "MySoft 1.0" in the document body. You obtain something like:
Note that the second occurrence of "MySoft 1.0" is now highlighted with stripes as well. This means that this occurrence is linked. Now, rename "1.0" to "1.1". You can rename it in any of the three places, and you'll obtain:
Similar to spreadsheets, you can double-click on "MySoft 1.1" to display and modify the underlying formula "mysoft".
You could even further abstract mysoft's content, e.g. to extract the version number under a separate name, using the same abstract command:
Let us imagine that, in your document, you want to describe a set of keyboard shortcuts as cards, and then some sample scenarios on how to use them. Let us start by creating a sample shortcut table. Create a 3x2 table, remove the borders inside it, and fill it as follow:
Command name: | Context menu |
Keyboard shortcut: | Right-click or ALT+M |
When to use: | When caret blinks in doc |
Command name: | Context menu |
Keyboard shortcut: | Right-click or ALT+M |
When to use: | When caret blinks in doc |
Command name: | Context menu |
Keyboard shortcut: | Right-click or ALT+M |
When to use: | When caret blinks in doc |
Command name: | Context menu |
Keyboard shortcut: | Right-click or ALT+M |
When to use: | When caret blinks in doc |
Command name: | B1 |
Keyboard shortcut: | Right-click or ALT+M |
When to use: | When caret blinks in doc |
Command name: | Context menu |
Keyboard shortcut: | Right-click or ALT+M |
When to use: | When caret blinks in doc |
Command name: | Context menu |
Keyboard shortcut: | Right-click or ALT+M |
When to use: | When caret blinks in doc |
Command name: | B1 |
Keyboard shortcut: | Right-click or ALT+M |
When to use: | When caret blinks in doc |
Command name: | Context menu |
Keyboard shortcut: | Right-click or ALT+M |
When to use: | When caret blinks in doc |
Command name: | Save |
Keyboard shortcut: | Right-click or ALT+M |
When to use: | When caret blinks in doc |
Command name: | B1 |
Keyboard shortcut: | B2 |
When to use: | B3 |
Command name: | Context menu |
Keyboard shortcut: | Right-click or ALT+M |
When to use: | When caret blinks in doc |
Command name: | Save |
Keyboard shortcut: | CTRL+S |
When to use: | When file is not saved yet |
In the previous section, we saw how to define cards for shortcuts. We want to use these shortcut definitions to augment simple tutorials, by displaying a hint on every command that a tutorial uses. That way, users would not have to remember all these commands or look them up themselves.
Select the last two tables, and abstract them. Instead of inserting one more name, MikoWord detects that there is a repetition and instead suggest merging these calls (). Accept. You will then see the following result:
Command name: | command |
Keyboard shortcut: | shortcut |
When to use: | context |
Command name: | Context menu |
Keyboard shortcut: | Right-click or ALT+M |
When to use: | When caret blinks in doc |
Command name: | Save |
Keyboard shortcut: | CTRL+S |
When to use: | When file is not saved yet |
The vlookup procedure takes a table, a value to look into, an two column numbers: the first column in which to search the value, the second column the value to return to return. Once you will be more familiar with the language, you will be able to enter these formulas yourself (abstract, then choose "formula" from ).
Let us add another command in the document similar to Save. Continue to write "Open the " in the document. Copy "Save" with its tooltip, paste it after what you just wrote, and replace the command name by Context menu. The tooltip is automatically updated. If you make a mistake (unknown command), you'll see a local error:
On click | Insert under caret:: TODO |
On click | Insert under caret: TODO |
On click | Insert under caret: TODO |
On click |
currentdate =
|
On click |
currentdate =
|
In case you wonder, I did not write this tutorial using even an alpha version of a "MikoWord".
However, I used a tool that I am developing: Editor. Editor is a local HTTP server that enables the viewer of the page to modify it, even if the page was dynamically generated. All screenshots have been dynamically generated based on a mix of document and formulas.
I generated the html content of this document using Hyde, a reversible file-to-file converter that I also maintain.
Editor and Hyde are based on my research on bidirectional programming. Together, Editor and Hyde made the development of this page straightforward.
Would MikoWord be possible? I think so. MikoWord features the idea of displaying the tree of a program as an HTML tree, after a partial and forgiving evaluator ran on it. If you are interested by this project, follow me on Twitter. If you are interested to contribute, send me an email.
This work was supported by Swiss National Science Foundation Early Postdoc.Mobility Fellowship No. 175041