• July 18, 2015
  • Dx5a0141 sq 1500 def maxǝʞɹǝᴉɟ; end
  • Life, Programming

Good code is something I think all developers, at one time or another, think they have written, only to look back 2 weeks, 6 months, or two years later and exercise a move I like to call the "shocked & embarrassed facepalm". It goes a little something like this.

Oh, hey. This is an old project...
jeez...
[facepalm]
What the FUCK?

There's a simple reason for this. If you're a good developer, you're constantly learning. You learn with every line of code you write, every new solution to a problem. This is a good thing. This is what experience is.

I think there are very few developers in the world who have written truly good code that stands the test of time - not that the test of time is necessarily a good indicator. Still, everyone has their programming "heroes" who seem to be infallible. One of mine is John Carmack.

But I'm sure, even John Carmack has written bad code. In fact, I'm positive.

As developers, we like to think we're building things. We like to think we're creating structures. We like to think we're creating something solid like the pyramids.

Unfortunately, good code is often fleeting. It's often good code for the present. Good code until it's truly put to the test. Good code until that new feature needs to be added, and there isn't time for a refactor, so it gets haphazardly shoved in.

You're lucky if you're in a situation where you get that chance to refine your code - a chance to sand the edges, and iron out the wrinkles. Unfortunately, if you do a lot of project-based, deadline-based work, as many of us do, you don't always get that opportunity. After that deadline comes, you might never touch that code again. That's it.

For many of us, the code we build is a lot more like a relationship. We put a lot of time into it. We nurture it. If we're lucky, it doesn't fall apart when it's put to the test. If we're lucky and are given time to put into it, it doesn't fall into neglect. And if we're really lucky, that code is strong enough and flexible enough to endure, despite some faults, and you're left with a solid piece of software. Unfortunately, more often than not (as with relationships), something eventually happens and it just doesn't work out. We start from the beginning, we pick ourselves back up, and we rewrite. And we hope things work out better the next time.

Because good code is a moving target. And good code is a constant struggle. And the moment you give that up, is the moment you've lost.

π Powered by Resumis. A cool thing by Max Fierke.