There Is No Such Thing as Perfect Code

The title alone may offend some folks that read this post, but, please, hear me out before you close the browser window and go away muttering “this guy has no idea what he’s talking about”. I was talking to a developer friend of mine today and he made the statement “there is no such thing as perfect code”. The statement kind of took me by surprise but as we talked through it, I came to see his particular point.

How many times have you written an application or feature that solved a particular problem and then gone back to look at it later and thought to yourself “this is some really crappy code that I wrote–I wish I could redo this and do it ‘right’”? I know I have had that thought countless times looking at things I’ve written over the last 11 years of my professional development career. Did we think the code was “crappy” when we launched the application?  Chances are the answer at that time was no. So, what changed?

The answer is “everything”. Tools changed, programming methodologies changed, we developers changed (through our experiences since the code release). All this change leads to a moving target for the definition of “perfect code”.  What we think is nearly perfect today may look outdated in just a few short months and positively horrible a year or two from now.

Does this mean that we should haphazardly throw together something that will just barely solve the problem at hand because we can never write perfect code? ABSOLUTELY NOT!!! We developers should strive to do as great a job that we can with the tools and experience we have available to us at the time. All the while, however, we need to keep in mind that the final judgement of a programming endeavor is “does it work and solve the problem it’s supposed to solve” not “did I use the right design patterns and include all the current development buzzwords”.

Once you’ve delivered the application to the best of your ability, upgrade your abilities! Upgrading your abilities could mean learning a complimentary technology like jQuery or Flex, doing a proof-of-concept application using a development framework that you’ve not used before, or even brushing up on concepts within the languages you’ve been using (reading up on different ways to use CFCs, Custom Tags, etc or diving deeper into the SQL language to make your database interactions more efficient). Then, if time/budget permits, go back and look at the code that you’ve delivered through the “new eyes” that you’ve gained through this learning process. Most likely the level represented by “the best of your ability” has just gone up–and that’s a GOOD thing!

Scott Stroz posted an entry on Alagad’s blog today that talks about the value of continuously learning new technologies and techniques to grow yourself as a developer.  One phrase in his article stuck out for me so much that, with his permission, I may print it and put it on the wall above my desk at home.

“…if you ever stop learning, well, then the job has passed you by.”

Sober words indeed, but, in my opinion, absolutely 100% true. So, as much to myself as anyone, I say, “stay hungry” for learning opportunities that make you a better developer and allow you to deliver better applications for your clients.

Leave a Comment