Experiment with Literate Programming Didn’t Work Out

About a year and a half ago, I tried doing some “literate programming” for one of our internal scripts. Well, I have just converted those scripts back to the normal, un-literate (illiterate?) style. It just wasn’t working out.

Continue reading “Experiment with Literate Programming Didn’t Work Out”

3 Steps to Understanding Ungrokkable Legacy Code

On Friday I was faced with making some changes to some old code that nobody really understood. Nobody liked to go into this code, so nobody was familiar with it. I too dreaded to make changes to it, and only dipped my toes in it as little as possible to understand what I needed to know.

Well now I needed to understand it better in order to make a bug fix. It turned out to be a good opportunity to learn what this code was doing and make it easier to understand.

Continue reading “3 Steps to Understanding Ungrokkable Legacy Code”

PHP Tip: The identity function I()

Here’s a tip I picked up from another PHP programmer. It’s called the identity function, and it simply returns its argument:

function I($subject) {
    return $subject;

Now what so great about that, you ask? One cool thing is that it allows you to instantiate an object and call a method on it, in a single statement:

I(new Foo())->bar();

Continue reading “PHP Tip: The identity function I()”

Atlas – define a template for systems

We have pretty good systems automation at Ning, but we’d like a better solution for bringing up new instances of our system and keeping various instances in sync. In addition to our live production environment, we have multiple development and testing instances of our system, and frequently need short lived instances for experiments.

These system instances tend to get out of sync quickly, and bringing them back into sync, getting changes promoted correctly, and just managing them gets difficult.

Continue reading “Atlas – define a template for systems”

Code Reviews at Ning

At Ning we use a code-review system called ReviewBoard. This is a web application that shows you a commit diff and lets you click on lines to comment on them. The committer gets an email notification, and can leave a followup comment, etc.

We’ve set it up so that whenever anyone makes a commit, a review is sent to a couple of random developers, who may or may not be on your team. I’ve found this to be a good way to learn about what other teams are doing.

Continue reading “Code Reviews at Ning”

The Joys of the JavaDoc Style Guide

When I need to do maintenance on code that has been JavaDoc’d, my heart sings. There’s something about code that’s been JavaDoc’d that makes it so much more pleasant to work with. Look at the source code for any class in the JDK.

There is some wonderful top-level doc for the class, explaining its purpose, and also rewarding the reader with some finer points about the implementation. Then each method (even private methods) has some doc explaining the intent, descriptions of the parameters, and any gotchas.

Continue reading “The Joys of the JavaDoc Style Guide”