On Good Enough Code

Reading There’s no shame in code that is simply “good enough” (and the discussion on hacker news), I find myself strongly agreeing. I have this system I built about 3 years ago at craigslist. Since then it has been extended in various ways and now runs on about four times the hardware it did back then. And it handles far, far more data.

In other words, I’m still evolving it (in small steps) and helping it to grow and change to suit our needs. But every now and then, while reading through the code, I get the urge to “improve” it in some way. Often that means adding a new abstraction “just in case” I need in the future. Or there’s that one script that runs from cron, which is written in bash. I’d love to re-write in Perl. But that’d be more work for virtually no benefit.

Why do I not just make these changes? Two reasons:

  1. the stuff works and is stable
  2. every time you change something you may also break something

The fact that I can look back on code I wrote a few years ago and identify ways that I’d do it better is good. It means I’m still learning. But the fact that I can successfully resist the urge to change the code is even better.

The quest for perfection is tricky. You can spend a lot of time chasing it and there’s no telling if you’ll every actually get there. And even if you do, what other things did you put aside in the process?

I think this mentality can apply to a of things in life. One of my hopes for 2012 is that I can better see that.

About Jeremy Zawodny

I'm a software engineer and pilot. I work at craigslist by day, hacking on various bits of back-end software and data systems. As a pilot, I fly Glastar N97BM, Just AirCraft SuperSTOL N119AM, Bonanza N200TE, and high performance gliders in the northern California and Nevada area. I'm also the original author of "High Performance MySQL" published by O'Reilly Media. I still speak at conferences and user groups on occasion.
This entry was posted in Uncategorized. Bookmark the permalink.

11 Responses to On Good Enough Code

  1. Fabien Penso says:

    Breaking something is good, it allows to add another spec and it improves the whole thing 😉

    • In this case, breaking something means the on-duty sysadmin is paged awake at 3am and spends 20 minutes trying to figure out where my code went wrong before ultimately paging me to fix it. Then I spend the next day or two cursing myself for doing something stupid.

  2. Matt says:

    Hi Jeremy – you’ve got two spelling errors in the anchor text in your link to the article that completely obscure its meaning. Share should be shame and simple should be simply. If it did not change the meaning I wouldn’t nitpick.

  3. Pingback: | Blog | Stuff The Internet Says On Scalability For January 6, 2012

  4. Pingback: Stuff The Internet Says On Scalability For January 6, 2012 | Krantenkoppen Tech

  5. Catalin says:

    Upgrading might be a good advice. For example I am using Sphinx because it’s fast, no crashes and you can start from 0 in less than 2 hours, but I am still waiting for a stable release in order to delete an item on demand (now I have to reindex the data).

  6. Alderin says:

    The short version of this concept is, “Done is better than perfect.” I’m still trying to resist those perfection itches, though. 🙂

  7. hehehay says:

    Good enough? Good enough.

  8. Pls,it i national in god, i national on he that created heaven and above worldwide,ask romans nig

  9. Zane Dyer says:

    This wass a lovely blog post

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s