Hitting the Wall

I was trying to explain to someone the other day why a small hack to add a feature to a program just wasn’t worth it. If you push a piece of software too far without going back and revisiting your design, there always comes a point when everything just starts to fall apart. That’s when you hit the wall.

Every piece of software has its wall. When you hit that wall, the cost of further changes and maintenance suddenly increases exponentially. Until that point, as you add features and hacks and fixes, you move ever closer to the wall. Some changes use up a lot of that space, others only a little. But the little changes matter, because any one of them could be that last step closer which forces the next big change to hit the wall.

In fact, the wall isn’t a property of the system, it’s a product of the human mind. The human mind can only encompass so many things and so many relationships. As a system grows, the number and complexity of these relationships increases geometrically, and at some point, they simply exceed the capacity of a single human to comprehend. Some people are talented programmers and can fit more, others can fit less, but in the end the limit is always there. That human limit is the wall.

The only way to move back from the wall is to refactor: if you can hive off one piece of the system from the rest, then you can treat it in isolation. This is how we build big software. As these pieces grow, they in turn must be refactored, and so on. Each piece must always be kept small enough for one person to understand. I think this is why Frederick Brooks says in The Mythical Man Month that you can only have as many programmers as components in your system. If you exceed this limit, the project will actually take longer. If two people are working on the same thing, then almost by definition neither one can keep the system in their head at the same time1. In effect, they’ve deliberately slammed into the wall.


1 Perhaps this is why pair programming can work in XP – you have two minds together on the same component; maybe there’s a little more space in their brains and hence a bit more leeway before they hit the wall. (I haven’t tried pair programming, so I can’t comment on whether this is true.)