Too Good To Miss: The Role Of ASCII Art In Code
Written by Mike James   
Monday, 30 December 2019

There are some news items from the past year that deserve a second chance. Here we have one such - a picture is worth a thousand words - and this is why ASCII art turns up in code more often than you might expect.

(2019-02-23)

Are you one of those people who spend a month of coding days perfecting your info box at the start of your program? You know what I mean:

           |------------------------------|  
|  this is my program     |
|  open source except for this |
| ASCII art box which I put |
| more effort into than the |
| program.... |
| change it at your peril |
|------------------------------|            

Personally I'm a minimalist when it comes to comments or identity boxes in my code. I usually accept what the template has and don't always remember to change the date or other defaults. At the other extreme a colleague decorates his code with lots of time consuming ASCII art:

  a=a-a;
\\ ¯\_(ツ)_/¯

In fact much more time consuming that the infamous shrug...

John Regehr's well known blog, Embedded in Academia, has a new post where he confesses his love for ASCII art found in code listings. Specifically ASCII art that helps explain what the program is doing - ASCII art Comments I suppose you could call them. A while ago he asked on Twitter for examples and was surprised to find that the response was so large.

You can see some of them in the blog post and all of them in the Twitter thread. Here are two of my favourites:

Attitude control in the Apollo Guidance Computer:

asciiart

Now I can see that there might be an excuse for this one - ASCII was mostly all that they had.

What excuse the Racket programmers had is another story, but at least the art is executable - shades of Mondrian:

asciiart2

I like looking at ASCII art, but I hate trying to create it. The reason is that it is so brittle. Make a small change and all of the lines that did line up don't anymore. Its an exercise in putting spaces in and taking them out. Then the whole idea has been spoiled by Unicode and emojis. I asked my colleague why not use a Unicode or emoji shrug?

emojishrug

The answer was "what?".

It is true that most code editors make it hard to enter Unicode if they do it at all. Is it true that most programmers think that they are working with ASCII even if it is just the first 128 Unicode characters in UTF-8. Most programs aren't even paged, but flow on like a long stream of consciousness. At least when we had to print them out you could page them for readability.

The notebook metaphor used in Jupyter and similar systems works well for many programs, allowing static text, graphics and code to be freely mixed, but it isn't right for everything. Do we need code editors to be more sophisticated?

Until we can find a better way to code in the 21st century - ASCII art rules:

asciiicon

More Information

Explaining Code using ASCII Art

Related Articles

AsciiDots - A Language Like A Racetrack

IEEE Milestone for ASCII

How To Draw Einstein's Face Parametrically

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


OpenAI Library For .NET Exits Beta
19/11/2024

A few months ago the OpenAI .NET library was released as a beta. It has now reached version 2.0.0 and the time has come to leave beta and, with a few amendments enter production readiness.



Wasmer 5 Adds iOS Support
12/11/2024

The Wasmer team has released Wasmer 5.0. The WebAssembly runtime adds experimental support for more back ends including V8, Wasmi and WAMR. It also now has iOS support, and upgraded compilers includin [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 30 December 2019 )