Yo-Yo Code Quality and Architects as Personal Trainers

I exercise regularly. This is for a number of reasons, which I won’t go into and you don’t care about. However what I’ve noticed about exercise and trying to keep fit is that it’s self-reinforcing.

The more you exercise the easier it is. You begin to get more enjoyment from it and therefore want to do it more often.

The reverse is also the case. The less you exercise the harder it is to both get started and keep going and before you know it the emergency services have cut a hole in the side of your house and they’re lifting you out with a forklift.

The point is that it is easier to keep fit than it is to get fit.

The same could be said for software projects.

Over time while the team is concentrating on delivery, the code will get a little flabby. I’m not talking about the code base getting bigger, that’s expected, but some duplication appears, some things are hacked in or some part of the system simply aren’t written or tested very well.

At this stage you’re saying, “Hey, genius, we already know this. You’ve just described ‘technical debt’ using some stupid exercise analogy”. Of course you are right.

My point is that I think it’s easier to keep your code-base clean and tidy with constant refactoring and maintenance (keeping it fit) than it is to let it deteriorate and try to clean it up later all at once (getting it fit).

In the same way that yo-yo dieting doesn’t work in the long term in keeping weight off, big-bang refactorings don’t seem to work as well at keeping a code-base clean as performing a number of smaller done day-to-day as part of your normal development process. This doesn’t mean that you shouldn’t send your project to fat camp by doing a major refactoring or rewrite if it needs it. But perhaps you should consider a lifestyle change.

If you’re getting sick of the fitness analogy please head off to Facebook as it’s only going to get worse.

When people are struggling to get fit they sometime hire a personal trainer to help them get started and / or to keep going and I was thinking that this is a role that could be useful on a software development team.

What if architects were more like personal trainers?

I asked myself, what are some of the attributes I look for in an architect?

  1. They should be writing code (or at least looking at it) most days so that I have some confidence that they know what they’re talking about. In the same way that I wouldn’t choose a fat personal trainer, I want an architect to practice what they preach.
  2. They should be there to keep the developers on their toes and stop them from slacking off. I know some people have personal trainers just to force them to go to the gym at least on those days they have an appointment. That’s fine, some people aren’t that good at self-motivation. Perhaps architects should schedule regular pairing sessions with each of the developers to monitor their progress and the progress of the project as a whole.
  3. They should keep an eye on the bigger picture of the project as a whole and provide solutions where possible. In the same way a trainer might look at a client and mention (discreetly) that their arms are a bit flabby and suggest the best exercise to lose those ‘bingo wings’ an architect might notice a particularly bad area of the code and suggest a fix.
  4. They should monitor and measure stuff. For example, why has the test coverage suddenly dropped, why has the performance of the system suddenly degraded? This is like the personal trainer measuring their client’s weight or how much they can bench press to ensure they are making progress.

This may not sound like the typical architect role that most projects have, it might be more like the team lead. Call it what you like but a personal trainer type has to be more useful than the ‘Ivory Tower’ architects we typically get.

(For the record I do not use a personal trainer).