A Canon of Code
Programming is a strange thing, in that it’s mostly utility but there can also be some art there too. In that respect, it’s a bit like pottery. Most of the pottery made, throughout history, has been for prosaic use. Yet if you look at the ceramics made for rulers or aristocrats, be it in the famous Chinese tradition or in Meissen, Germany, there has also been pottery who’s primary purpose was ornamental. Most people are currently developers because it pays well, but I think I was originally drawn to it because I’m more interested in the side of it that creates. Any like any self-respecting craftsman, I’d like my craft to be aesthetically pleasing, not just fulfill some need that someone has to do something.
To that end, I think I will compile a list of source programs that are elegant, aesthetically pleasing, and highly utilitarian. What does each of these mean in the context of computer programs? To be elegant is to come up with a novel way of implementing the logic that is demanded of a computer program. Elegance will probably be different depending on the programming language and libraries used. I find certain qualities to be aesthetically pleasing across all programming languages–conciseness, non-repetition, clarity of purpose, and a constrained API. Highly utilitarian means that the program or library solves a real problem for many people, or a very important problem for a few people.
Writers do not learn to write by reading writing manuals telling them how to write. They learn by reading. People don’t learn to speak by going to speaking classes, they learn by listening to people talk to them for years before they open their mouths. While does it seem like the way that people learn to program is primarily by reading instructional books? While programming is not as pure an art as storytelling, or as utilitarian as speaking, it would be helpful for those who aspire to craft elegant code to have at least read examples of good programs or libraries. Will we, in hundreds of years, have a canon of code as we do of literature? It’s something worth considering. It’s also worth discussing which programs you might include in such a canon, if you had the mighty powers to will one into existence.