First the comic from xkcd

Academia vs. Business from xkcd.com
Academia vs. Business from xkcd.com

This is EXACTLY true.

I was working on this project over the summer and into the fall. Basically, this client had previously used another vendor to create a website for them with a TREMENDOUS amount of dev work involved. A fairly complex (in my book, anyway) site with a lot of pieces that tied together in funny ways. Ultimately, they failed with several bugs not-fixed, decreasing customer support, outrageous prices, etc, etc. So they asked me to take over.

This vendor did a really nice job in some places, did an OK job in some places, a half-ass job some places, and a downright ‘tarded job in some places. It was a really intriguing mix of code. I got the impression that several programmers of varying skill levels and experience worked on it.

So this one particular snippet of code that ran a report was really really ‘tarded. It was essentially like this:

  • Get initial info from database
    • Get more info based on first set
    • Get some more info based on first set
    • Get some more info based on first set
    • Get some more info based on first set
    • Get some more info based on first set
    • Repeat for each piece in the initial set
  • Compile all that data

This may not sound like much, but a typical monthly report would take upwards of 45-60 secs on a dedicated server. That’s a long time to wait. The code was about 500 lines long (no kidding).

So over the course of several days I re-wrote this from scratch and I got this down to about 70 lines. Yes, that’s right. From 500 lines down to 70 lines. And now the longest it takes to process is about 3 seconds. It takes less than a second if the data has been cached.

Did I even get a cookie? No.

What I got was “Great. Took you long enough. How long until the rest of it is done?”

Maybe I should work in academia?