Some other points from the linked-to article that back up that the criticism here is a bit ridiculous:
1) This was in 1986. That's about 4 lifetimes ago in computer programming.
2) This was an article specifically to demonstrate literate programming. It wasn't supposed to be "the most efficient way" possible. It's approximately the same argument as "why should I write a program to sort data in an interview; I'm not going to get paid to write sorting functions".
Re:The Word Count Problem
by zacharyvoase on Saturday July 28, 2012 @05:52AM
(#4305184)
1) I'd like to see you say the same about differential calculus, which actually was several lifetimes ago.
2) I have made the same argument, in interviews, many times. It's a good argument to make.
The point, imho, is to illustrate literate programming, a technique designed to write easily understandable code. And the rebuttal is, that with high level tools and a good documentation you can build as easily understandable code in about 20 lines including comments. (To be fair, one would need to understand all the tools used for comparison to Knuths program).
Is the point to illustrate that Knuth is unaware of elementary concepts such as code reuse....
In fact, Knuth considers reusable code to be a "menace."
> To me, "re-editable code" is much, much better than an untouchable black box or toolkit. (Knuth)
Probably Knuth misunderstood the concept
He didn't misunderstand the concept. He emphasized the needs for source access to libraries
Yes, that's true. However, code reuse is somehow opposed to source access to libraries, which should not be necessary true.
I would argue that more code is a better solution in this case. The purpose was not to write short, clear code, but to illustrate a certain programming style. How am I supposed to "get" the style in 5 lines? A short solution would have been a failure.
If you had asked Knuth to solve this problem using any means in the whole world and do it within 10 minutes, I don't think he would have any trouble doing it.
And honestly, if the lesson is to teach us some really basic lesson of code reuse, not reinventing the wheel, or some such like that, I think this was a pretty convoluted way to deliver sort of a common sense lesson.