The conference was a typical mix of blindingly brilliant and creakingly dull. I didn’t get what I’d expected out of it (networking and a chance to show off Feedwhip’s blender framework), but I’m pleased with what I learned: that I’ve been a Bad Engineer.

Because my primary responsibility is taking care of my daughter, I’m left with just a few hours each week to work on Feedwhip. As a result, I’ve been in a rush. Each day when nap time rolls around I rush to get through my email and take care of some features and try to get something exciting out for the users. Feedwhip is an internet app, after all, and I’m working on internet time. Everything needs to be done yesterday.

But as a result, I’ve been cutting corners — especially when it comes to testing. Feedwhip is actually quite stable, more or less, but getting the testing done takes forever because I don’t have any good test suites written. After all, they take time and I don’t have enough of it. But not having test suites means my overall development is way less efficient. I can’t just type one command in and get a report on my latest changes — I need to test them all by hand.

The keynote by Rasmus Lerdorf (PHP’s inventor) was particularly interesting. He walked through a round of profiling on a sample app, showing the tricks and tools he’d use to gain a 500-fold increase in performance.

Profiling! Test suites! This is pretty basic stuff. Without either I don’t really have a good idea of what’s working well, and what should be fixed — especially with performance being such a big issue with Feedwhip right now.

For example, I’ve got some code that converts HTML into a simplified, extra-marked-up form that Feedwhip uses internally. By using profiling, I was able to figure out that this code was one of the big bottlenecks for the walkers.

As part of this code, I look up the current html tag in an array to see if it should be processed, dropped, etc. I was using the php in_array() function to do this. Well, it turns out that this function was taking up 25% of the execution time in this one function. Changing the structure of the array (so that I could search by key instead of by value) and combining several arrays into one (just a good idea) cut the execution time in half! Without profiling, there’s no way I’d have known to even look at the in_array() function.

So, I’ve come back from the conference with a new perspective on my engineering processes. Instead of new Feedwhip features on my to-do lists, it’s things like “unit tests”, “continuous integration”, and “benchmarking”. Once I get all these important foundations in place, I’ll be able to churn out new features more quickly and with more confidence.

Advertisements