If you're learning programming, you might aspire to write beautiful, clean and concise code. The truth is that's a lot harder than you might think. Programmer and author Peter Welch explains why all code is bad, but we think you shouldn't let that discourage you.
In his fantastic rant post, Welch describes "Good Code", the kind everyone probably wishes they could write:
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.
Unfortunately, this "perfect little snowflake" is impossible to keep creating because of the pressures of churning out code, which ends up being a mish-mash of many people's flawed work:
Every programmer starts out writing some perfect little snowflake like this. Then they're told on Friday they need to have six hundred snowflakes written by Tuesday, so they cheat a bit here and there and maybe copy a few snowflakes and try to stick them together or they have to ask a coworker to work on one who melts it and then all the programmers' snowflakes get dumped together in some inscrutable shape and somebody leans a Picasso on it because nobody wants to see the cat urine soaking into all your broken snowflakes melting in the light of day. Next week, everybody shovels more snow on it to keep the Picasso from falling over.
Standards don't help either, Welch says, when they're all worked on (and reworked) by people with varying personal preferences:
no collection of code has ever made it into the real world without doing a few dozen identical things a few dozen not even remotely similar ways. The first few weeks of any job are just figuring out how a program works even if you're familiar with every single language, framework, and standard that's involved, because standards are unicorns.
This is why programs are so easily broken, why coding is often so frustrating, and why your programmer friends are a little nuts. If you're learning to code, the good news is you don't have to worry (too much) if your code is bad. All you can do is get better, and sucking is the first step to becoming good at anything.
For a humorous look at the life of a programmer, check out Welch's post below.
Programming Sucks [Still Drinking]