Code is not Prose
or even poetry!
Once a month or so, this idea comes rambling out of the programming community1:
Software is prose. It is written to communicate ideas to others, it has the interesting side effect that it can be transformed into something a computer can execute.
- Chet Hendrickson
This sounds nice on paper. It makes for a good conference talk about how to structure software, how to design programming languages, and how to collaborate. I agree with what I think is the intent: write software so that other people can understand it and change it as they need to.
But it is dead wrong.
Software is for:
- putting people on the moon
- safely deploying airbags
- making my bank account add up
- making sure Mom gets my texts
- video editing and animation
- drawing in 10 million colors
- ebikes
Software is not primarily for communicating with people. It is for creating tools to accomplish things. That can be tools for people to use, tools for other software to use, or tools that just produce things for the hell of it. That’s not a side effect, it’s the whole deal.
Does that mean code can’t be beautiful? Can’t communicate more than the program that it generates? No, of course not. Consider the famous brainfuck hello world:
>++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.>>++++++[<+++++++>-]<+
+.------------.>++++++[<+++++++++>-]<+.<.+++.------.--------.>>>++++[<++++++++>-
]<+.
That’s art. It communicates the abstract and arbitrary nature of communication via the code. It’s interesting to note that the code itself is the tool, but it’s not prose. It’s a puzzle.
You read software more than you write it, so make it readable. But don’t get caught up in the idea that you’re writing or editing a novel.
-
I know that Chet has done more for software development than I’m ever likely to, but sometimes Agile drives you into absurdity. ↩︎