Saturday, August 01, 2009

Maintainability

Lots of noise on this subject - as far as I know, it started with this article by Patrick Smacchia that has apparently annoyed Ayende, who replied to it (and followed here). A few days later, Ayende replies to an article by Frans Bouma to explain what he means by maintainability - a definition that goes against what Patrick believes to be true.

Now that you're up to date, my opinion :)

An analogy from C. S. Lewis helps here. To claim that using toothpaste is good, he said, does not mean that if you find someone with bad teeth, but who uses toothpaste all the time, and someone who never used it, but has great teeth, you have disproved the statement. What matters is: given the same person, is he going to be better off by using toothpaste or not?

To apply the analogy: given the same person, whether an average developer from the street or Peter Norvig (or Ayende or Frans or Patrick), which application is he going to find more maintainable: one with - say - hundreds of cyclical references, or one layered as Patrick argues should be done?

In my opinion, this helps to nullify the inherent subjectivity of the issue: an application is more maintainable than another if, on average, more programmers would find it so. (I remember reading about someone who wrote code that would take into account the time it took to execute a piece of code and then read the next value from the disk — which was exactly what he needed at that point; he knew where the disk head would be given that precise timing. That was a maintainable application for him — less so for anyone else.)

Of course, my definition (if I can call it that) still depends on the idea that there are lots more competent programmers than Daily WTF candidates; I do not know if this is in fact the case :)

No comments: