Python Notes

Thursday, January 27, 2005

Reinventing the wheel

We coders have a strange standing on reinventing the wheel. Most of the time, a programmer will agree that he should reuse code. It's plain logical. So when we see someone baking his own library we say, 'why don't you use library X'? It usually leads to a heated argument as the programmer in question can't justify his reasons to write a new library instead of reusing something that works (at least in our opinion). On the other hand, when it comes the time for ourselves to make the same choice, we frequently do the same: bake our own code.

There are a few possible explanations for this behavior. A few people don't like to rely on code written by someone else, independent of anything else. But many programmers are quite reasonable in this respect, but even so end up rewriting stuff. I believe that the main problem is a mismatch in the mental model, worsened by the lack of documentation.

In Python land, there are several competing Web frameworks. It's interesting to see how many of them are badly documented, or not documented at all. But even projects that have a good volume of documentation still fail to address the mental model problem. A manual that touches only on practical issues -- mainly, API specs -- is close to useless in this regard.

I would like to see more effort spent on documenting the architectural issues of a framework. Not only 'how do I call this method', but 'how do I structure my app'. That's the really difficult question, and the lack of a satisfactory answer to it is often a good reason to write yet another framework.


Post a Comment

<< Home