Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Friday May 02, 2008
10:51 AM

Donald Knuth Eats Sacred Cows

[ #36316 ]

In an interesting interview, Donald Knuth disses unit tests.

[The] idea of immediate compilation and "unit tests" appeals to me only rarely, when I’m feeling my way in a totally unknown environment and need feedback about what works and what doesn’t. Otherwise, lots of time is wasted on activities that I simply never need to perform or even think about. Nothing needs to be "mocked up."

He's also not fond of XP:

Let me just say that almost everything I’ve ever heard associated with the term "extreme programming" sounds like exactly the wrong way to go...with one exception. The exception is the idea of working in teams and reading each other’s code. That idea is crucial, and it might even mask out all the terrible aspects of extreme programming that alarm me.

Oh, and reusable code is also something he takes a swipe at:

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.

So, let's see. He doesn't like unit tests, XP, or reusable code. These are three things that I suspect many reading this might be in favor of. In fact, if it were just about anyone else saying this, the dogs would be unleashed. To be fair, there's not a lot of context in the interview, so it's not really clear why he has these viewpoints, but he has them nonetheless.

Here's my take: for Knuth, these ideas may be counter-productive. With literate programming (a nifty idea), specialist needs, a deep knowledge of computer science and a life in academia, not business, he has unique needs. All of those things suggest, to me, that even many of the best-known and respected people in our field are unlikely to be in a similar position, and thus have similar needs. But the situation is even worse with the masses.

I'll clarify the last point. A couple of times I've been to conferences I've sat around with core Perl developers, people who do extensive testing work and others in similarly "high skilled" positions and sometimes we complain about the sad state of programming. But I point out to that group that they are far from being the norm. When they complain about others "not getting it", the reality is that it's not fair to expect your typical 9-to-5 programmer to all of a sudden understand OO programming, the importance of loose coupling, or even basic organization of software. And those are simple things. Head over the Perl 6 language list and you can join in our fun discussions about type theory (I'm rather in over my head there). As those conference groups tends to be to the '9-to-5' programmers, so Donald Knuth is to those groups.

I've worked in shops where I'm one of the better programmers (not saying that much, to be fair), but I've found I can't convince others to "step up" when they quite reasonably prefer hanging out at a pub, spending time with their partner, looking after their kids or just enjoying their "non-computer" hobbies. Why shouldn't they enjoy their lives and find more pleasure in the real world? There's nothing wrong with that. We can't just get rid of them because that would pretty much shut down the world's information processing capabilities. So the reality is, we need to accept that different skills sets have different needs.

I guess what I'm saying is that Knuth may be right, but I'm not convinced he's right for the programming masses. Compared to Knuth, I clearly am one of the masses. My math isn't there and my needs aren't there. For example, I can only recall once where I needed to do something as trivial as finding the least common multiples of two numbers. It was in a job interview. I also cannot recall a single time, in my entire programming career, where I've been told a project must be bug free. Nope. Not once. We have deadlines. We have piles of work. We have vague and flexible specs and we're often exploring problem spaces that even our customers don't fully understand and we have to change them quickly, not perfectly.

Far be it from me to take Donald Knuth to task, but it almost sounds like he's generalizing his needs to those of others.

Update: I've been sufficiently impressed with the idea of literate programming that I've been thinking about write a literate programming engine. If I start it, it reads the current project and whenever a file is saved or updated, it would automatically run tangle and weave and also store the index in a database. Go to a literate tag and you can see instantly if it's been implemented, automatically jump back to it, automatically see all of the places which use that tag, etc. It's an idle thought and perhaps not a good one, but who knows?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • It's refreshing to highlight another perspective on program.

    I'm curious what you mean by "step up", though. You describe it like it's the same as working overtime, but also the key to be being a better programmer.
  • ...even geniuses become old koots, set in their way.

    Maybe that should be especially geniuses.

  • The book Elements of Programming with Perl [] uses a literate programming approach.

    There is a short paper about the tangler in the source code tarball at that link.


  • I think this was really well written and thought out, thanks for taking the time.

    I think your point about the layers (like the Perl onion) of skill, interest, time, experience and commitments of programmers are especially on the mark. Many folks do have life (gasp!) outside of coding and technology. It doesn't make them too bad ;)

  • Leading Computer Scientists Agree... You're Doing It Completely Wrong [].
    • I am no leading computer scientist, but I mostly agree with Knuth. Unit tests, mostly a waste of time. Reusable code is good, depending on the context. XP? Kill me now.
      • Yeah, but you eat sacred cows every day, so it's not exactly newsworthy when you say it. :)

        J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
        • Yeah, but you eat sacred cows every day, so it's not exactly newsworthy when you say it. :)

          Well, so does Knuth. The real difference is that he is Knuth, and I am not. :-)
          • It's also usually more entertaining when you do it.

            J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
  • He also said Beware of bugs in the above code; I have only proved it correct, not tried it.

    So I would have thought he would be sympathetic to testing. Either the reason is as you say, he is a high-flying academic, or perhaps I didn't understand what he was trying to say in the saying.

    Perhaps he is like the haskellers who feel getting it to compile is the evidence they need that it works. And that any uncertainty you have you have to live with.

    Perhaps the way he understands bugs is different.