Donald Knuth’s view on code reuse

Thursday, 1. May 2008

Donald Knuth, the advocate of literate programming, gave his opinion on code reuse from an interview by Andrew Binstock

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.

In my view, literately programmed code should be visible for every programmer through its evolution, so literate programming doesn’t cope with OCP well. I guess it is why he prefer “re-editable” code to reusable black box code. But I think benefits of information hiding can be sacrificed in no case.