DevExpress Newsletter 22: Message from the CTO

ctodx
12 March 2010

Now that we’re doing my message from the CTO in the DevExpress newsletter as a video, I’ve had a couple of requests to make sure that I publish the text as a blog post. Here’s the Message from Newsletter 22 (the video is here):

Mend some broken windows

Back in 1982, The Atlantic published an article by Wilson and Kelling called Broken Windows, in which the authors promoted the idea that small problems, unless fixed promptly, would lead to more problems, and the problems themselves growing larger into full criminal acts.

The archetypal example is that of a building with a couple of broken windows. If they are not repaired, the tendency is for vandals to break a few more, and eventually to break into and perhaps squatters to occupy the building itself. Whereas, if the windows are repaired promptly, showing that there is someone who cares about how the building is perceived, the tendency is reversed and vandals would leave the building alone. Crime would be reduced as a whole by fixing the small things.

Later, Dave Hunt and Andy Thomas, in their book The Pragmatic Programmer, extended this concept to software. No software is perfectly written: it has bugs, it is possibly an expression of some bad design, it contains sub-optimal poorly-written code. Their viewpoint is that this is the equivalent of broken windows. If these aren't repaired promptly, it'll promote the view that no one cares about the software, and developers won't be as careful in testing and checking in new code as they should.

So, when you next check out some source code file to fix a bug and you notice some other issue with the code unrelated to your bug report, fix the other issue as well at the same time. Repair the broken windows as you discover them.

Note that this isn't an exhortation to go on a broken window hunt, try and find them all, and repair every one of them all at once. Or, worse, maybe break a couple yourself so that you can repair them and look good. No, this is the exact opposite. Fixing stuff as you notice it. A continual polishing process rather than a refurbishment.

Jeff, our videographer, wanted some examples of broken code to put into the video, so I mocked up these examples. The third came from a Daily WTF  post, but the first two I’ve certainly been guilty of at one stage or another in the past. Of course, I wouldn’t do them now, no sirree…

// free linked list
while (node != null) {
  free(node);
  node = node->next;
}


// remove dead items
for (int i = 0; i < list.Count; i++) {
  if (list[i].IsDead) 
    list.Remove(i);
}


// get opposite bool
private bool OppositeBool(bool inputBool) {
  if (inputBool == true)
    return false;
  return true;
}

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.