In the recent interview with InformIT, Donald Knuth said:
I also must confess to a strong bias against the fashion for reusable code. To me, “re-editable code” is much, much better than an untouchable black box or toolkit. I could go on and on about this. If you’re totally convinced that reusable code is wonderful, I probably won’t be able to sway you anyway, but you’ll never convince me that reusable code isn’t mostly a menace.
I have tried in vain to locate any place where he talks about this topic at greater length. Does anyone have a link?
I must admit that this part of the interview struck me too. He’s definitely pretty much alone on this one. However, I see his point…
I’m having trouble seeing his point. I can come up with so many arguments for reusable code. But this is from Knuth, which means I want to at least understand his argument.
Well, never used glibc in any code? This is reusable code as any other library. And you don’t fiddle with all the libraries you use, or do you?
I know glibc is reusable. What’s your point?
My guess is that the reusable code menace refers to shrouded/black-box libraries. Note the earlier part of the interview on the open-source movement.
The harmful aspect of such so-called “reusability” is that you are asked to submit on faith that whatever code you’re reusing, typically via function/API calls, does what it’s supposed to. From the viewpoint of purists, this act of unsubstantiated belief has no place in good programming.
You could even elevate such a discussion to encompass for e.g., what it means to live in a society where so many thingumajigs we take for granted are opaque devices sent down from heaven, as they were. It used to be that the average joe generally understood and could self-repair the gadgets he owned.
Well these days, “ownership” has taken a whole different meaning now, hasn’t it? Just like “reusability.”