Almost five years ago Peter Welch wrote his epic and sad-but-true essay Programming Sucks. I really love his writing and I find the article very interesting and mostly true, but it also contains what I consider a pretty common misconception:
Every programmer occasionally, when nobody’s home, turns off the lights, pours a glass of scotch, puts on some light German electronica, and opens up a file on their computer. It’s a different file for every programmer. Sometimes they wrote it, sometimes they found it and knew they had to save it. They read over the lines, and weep at their beauty, then the tears turn bitter as they remember the rest of the files and the inevitable collapse of all that is good and true in the world.
This file is Good Code. It has sensible and consistent names for functions and variables. It’s concise. It doesn’t do anything obviously stupid. It has never had to live in the wild, or answer to a sales team. It does exactly one, mundane, specific thing, and it does it well. It was written by a single person, and never touched by another. It reads like poetry written by someone over thirty.
I used to share that idealistic vision of our job: code can be something beautiful and poetic, and can take us to other worlds of perfection and simplicity, like a symphony that makes objects dance and magic happen by directing a choreography of data flowing along the methods.
But nobody really cares.
Even if it’s beautiful in the theory.
A program has to solve a problem, a real one if possible, just like books are meant to be read, roads are meant to be driven on, or board games are meant to be played.
And all of that has to happen in the cruel, unglamorous, and unpoetic reality.
Books are made of paper and ink. They have to be printed by noisy machines, distributed by polluting trucks, and sold by people who work for money. The number of pages has to be a multiple of 4, the cover can’t be made of marble, and the ink should be black, or dark at the very least.
Let’s say you write a book and in your mind yellow ink represents pure perfection. To you, using plain old-fashioned black ink means bowing down to the market’s ruthlessness. Well, tough luck. You still have to use black ink. It has to be printed and it has to be read by someone. It has to be in touch with reality.