Our interviews revealed the single most important, and perhaps also the most obvious nature of ASCII diagrams: they are simultaneously text and visual. ASCII diagrams are text and, therefore, can live freely in the entire infrastructure developed to support text-based programming; they are also visuals and, therefore, can be leveraged to assist in explaining and communicating complex visual concepts hidden in the textual code. We elaborate on the diagrams’ dual textual and visual natures in turn.
3.3.1 ASCII Diagrams are Text: They Live Naturally in the Media of Code.
Text is the “lowest common denominator” (P1) in programming tools, and as text, ASCII diagrams live in situ within the programming tools already in use. Diagram authoring is thus easy—it uses the tools at hand—but can still be tedious. Programming tools, optimized for code, occasionally mangle the display of ASCII diagrams. Nevertheless, the benefits of the media at hand caused participants to create the diagrams in ASCII instead of e.g. leaving a link in the comments to a richer document.
P1, P2, P5, and P9 all noted the universality of ASCII diagrams textual nature. ASCII diagrams can be rendered in any context featuring a monospace font, including text editors, version control commit messages, bug tracking tools, and terminal interfaces, regardless of the programming language being used, “the raw file is the view” (P2). No special tools are needed to make them—these diagrams appropriate the tools already in use: “all you need is a text editor with a monospace font and the spacebar” (P9). This integration makes them a natural form of visual expression in codebases:
“I didn’t even consider [making a rich external graphical image and linking to it] because I felt like ASCII diagrams are just very, very natural...it starts within the comments and with all the tools that you already have with monospace, slashes and stuff.” (P5)
ASCII diagrams exist in places where images cannot, in situ with the developer’s workflow:
“Most of my world is in a text editor through the terminal, so, to have a picture wouldn’t be useful to me because I would then have to have a browser open to point at that or some, you know, heavier program.” (P8)
The appropriation of text means that ASCII diagrams are simultaneously easy and hard to author. They are easy to author in that the same set of text-editing tools that developers use in their everyday work can be used to make these diagrams (P5, P7, P8), one can “just copy paste it basically...copy paste it down, edit the next line...there’s so many things that are hard to do. I feel like ASCII art isn’t necessarily one of them.” (P8).
But diagrams are also
hard to author in that editing them can be tedious (P2, P3, P6, P8). Maintaining spatial alignment is a manual process:
“Especially with aligning all the borders, I think that’s very time-consuming to make sure everything is aligned” (P6). For this reason, P6, for example, preferred to draw their diagrams without borders (
i.e. just arrows pointing at text). The brittle monospace structure also makes diagrams a poor fit for parts of the codebase that change often:
“I think is really useful for places where you’re documenting something that’s going to be fairly static. ASCII art is really terrible at documenting something that’s living because ASCII art diagrams are not friendly to update” (P2).
Although 7 of the 9 participants used only their normal text editor to make their diagram, P2 and P7 leveraged special tools to mitigate the tedium of editing. P2 gladly paid $10 for Monodraw, a diagram editor specifically for ASCII. It allowed them to edit the diagram after-the-fact, provided they had saved the Monodraw file, which proved helpful in a codebase where many contributors were authoring these diagrams: “the best $10 I could ever spend was having Monodraw...if I want to like enlarge a box, I can enlarge a box, I can move things around...I usually keep the Monodraw files sitting around so that if someone’s gonna come along and ‘Oh I’m gonna have to update this diagram.”’ Meanwhile, P7 used Org Mode for Emacs which allows structured editing of ASCII tables.
Ordinary textual tools in software development are optimized for code and may mess up the display of diagrams. Autoformatters may re-indent text (P5) and some tools show commit messages in non-monospace font: “I’ve never put [an ASCII diagram] in commit messages myself...it’s probably a product of the tools that I use, I don’t think commit messages are an ideal place to put them because a lot of commit messages end up getting rendered in non-monospace fonts” (P2). Change diffs of wide ASCII diagrams can be difficult to make sense of, “if the ASCII diagrams are too broad...they’re gonna wrap the lines and then it’s gonna look awful” (P5).
As an alternative to ASCII, both P1 and P2 mentioned Mermaid [
61], a simple textual language for describing and rendering diagrams. The popular code collaboration site GitHub renders Mermaid automatically, so P1 now uses it instead of ASCII art when writing README files. P2’s team also uses Mermaid regularly on GitHub, particularly for charts that are updated often, as updating ASCII is tedious. Nevertheless, P2 remarked that code diffs of Mermaid were hard to understand and P1 still used ASCII in tools that didn’t support Mermaid (
e.g. terminals and text editors).
To elucidate benefits and drawbacks of the textual medium, we asked the diagram authors why they didn’t instead make their diagram in a richer medium (e.g. a Google doc) and leave a URL in the code pointing to the richer visualization. Participants were generally negative about this idea for their diagram in question: external diagrams would be not worth the complication (P4, P5) particularly for simpler concepts (P6, P7), harder to share, e.g. the need to setup permissions (P3, P4, P6, P9), at risk of going out of sync with the code (P2, P8, P9), harder to author (P8, P9), and incompatible with the tools they already use (P1, P8). These responses suggest they used ASCII for the opposite reasons: in situ text was simpler, easier to share, and less likely to rot compared to external documentation.
3.3.2 ASCII Diagrams are Visual: Adept for Explanations and Overviews.
Due to their textual nature, the dual characteristic of ASCII diagrams is that they are visual. Compared to natural language or code alone, the visual nature of diagrams makes them a better vehicle to convey certain programming ideas, and to summarize code.
P1, P2, P4–9 reported that diagrams were more direct representations for their problem domain than natural language or code: “It helps visualize what this test is for, because when I try to explain it in words, it was really complicated and I thought that this is an easier way for me to convey what I wanted to do with these tests” (P4). Diagrams better portray the author’s mental model so that readers can see the same view as the author of the code—the diagram should “record the mental model I used when I created this” (P1).
For example, Figure
2 shows a diagram of Wi-Fi bands that P9 helped author. It shows a
“critical part of how an expert would have a mental picture...physically it’s a little more complex, but that’s sort of the mental image you would have” (P9). P8 and P4 also specifically mentioned how visualizations clarify their problem domain:
“Especially in my area, memory management, we want to explain race conditions...columns and spacing is used to show the ordering in which something could go awry, and having that spacing and the columns really helps in the race condition explanation. Often people write it and it is very difficult to follow if done correctly and impossible to understand otherwise.” (P8)
“I’m really referring to these blocks because I’m seeing them as blocks and how they lay in memory.” (P4)
Code itself is not a suitable representation for some concepts, for example P6, looking at a program graph as a diagram makes it
“pretty clear to me how the graph looks like. I mean if I look at the code I can figure it out, but it would be much more time consuming.” Similarly, P1 said
“if you look at the code [under the diagram], it looks pretty horrible...it is not very palatable”, thus they drew out the network topology diagram shown in Figure
3. Different kinds of code may be more suitable for diagrams:
“there’s certain areas of the codebase that definitely benefit from having small diagrams embedded in the code. Especially like when we look at things like...optimizations that manipulate the control flow graph or manipulate the SSA instruction graphs and these are all just graphs” (P2).
Despite its flexibility, ASCII is not a full-featured graphical medium. For example, P5 wished to show overlapping shapes, where “some color would actually help in understanding what’s happening to be able to distinguish the two polytopes” (P5), but ASCII lacks color.
Another theme that emerged was that diagrams do not convey the same level of detail as code, but this also makes them ideal for helping orient the reader with needed higher-level context. P1, P4–9 reported that diagrams are more inviting and accessible than code. They help convey the gist and act as a sort of thumbnail for the code. For example, P4, who documented a series of test cases shown in Figure
4, wanted each test case in the file to be approachable:
“This [diagram] is also for understanding the big picture...this is the first impression that allows you to dig deeper...I wanted people just to scroll and see ‘Okay. So this is this scenario’, or maybe that one. So, instead of reading through a paragraph of text, people can just look and see ‘Okay, that’s that.’ ” (P4)
Similarly, P8 drew their diagram because they did not want future readers to have to scrutinize all the code to understand its functionality. The diagram was small in comparison to the code:
“So instead of [other people] having to read through large amounts of code to to try and piece together what’s going on, I wanted to have just a small diagram.” (P8)
Diagrams serve as “simplified versions” (P4) that help readers orient.