Code archaeology

programming Estimated reading time: 3 minutes

Something interesting happened today. For a couple of years, myself and colleagues had mulled over a certain 'killer feature' that we wished our networking layer had, as it would have made our time implementing gameplay features much easier. Today, while doing some long awaited R+D work on said layer, I found that feature. The sheer size of the codebase meant that what we'd wanted for years had lain dormant and undiscovered all that time.

In actual fact, its only call site was commented out with a note saying that it was too slow to use in practice, but I have a feeling that it could have been easily optimised and saved us man-months of work.

Why hadn't we found this before? Well, it's a very large code-base and most of the people who originally developed it are long gone. Unfortunately there was obviously not much time for (or interest in) documentation back when it was written, and we're too busy making actual games to be able to invest time in checking all these low level components which already work.

I see a couple of lessons in this:

There are interesting implications for team size, too. To reduce the risk from lost code knowledge, you ideally want a lot of coders, and to rotate them round several subject areas. This way, knowledge is spread out redundantly and the loss of any one coder should not impact the general understanding of the system. On the other hand, large teams start to incur prohibitive communication costs, where documenting and explaining your modules can end up taking longer than creating them. And rotating people around areas of the code tends to reduce code quality, both through making people less concerned about defects in their code (since they may never have to touch it again), and through not being able to become an expert in a certain area.

You need enough programmers to be able to develop the required system in the timescale available, but too many and you're going to have dark corners of your code base that few will understand and they can actually cost you time. It may be that there is an optimal number of programmers that can work on any given software project. Does it vary according to the programming language in use? Or maybe according to the type of software being developed?