Donald Knuth Rips On Unit Tests and More
eldavojohn writes "You may be familiar with Donald Knuth from his famous Art of Computer Programming books but he's also the father of TeX and, arguably, one of the founders of open source. There's an interesting interview where he says a lot of stuff I wouldn't have predicted. One of the first surprises to me was that he didn't seem to be a huge proponent of unit tests. I use JUnit to test parts of my projects maybe 200 times a day but Knuth calls that kind of practice a 'waste of time' and claims 'nothing needs to be "mocked up."' He also states that methods to write software to take advantage of parallel programming hardware (like multi-core systems that we've discussed) are too difficult for him to tackle due to ever-changing hardware. He even goes so far as to vent about his unhappiness toward chipmakers for forcing us into the multicore realm. He pitches his idea of 'literate programming' which I must admit I've never heard of but find it intriguing. At the end, he even remarks on his adage that young people shouldn't do things just because they're trendy. Whether you love him or hate him, he sure has some interesting/flame-bait things to say."
I misread the headline. I was looking forward to a good Fart story from Donald "Structured Programming" Knuth. Oh well...
What's a cow-orker? A misspelled description of somebody who irritates cows?
"I've only proven that it works, I haven't tested it" - Knuth
and their unit test. in my days, if you needed a language, you wrote your own assembly. and when you couldn't document it, you wrote your own mark up language.... and your own fonts. phew... multiple cores. who needs them?!
Any guest worker system is indistinguishable from indentured servitude.
Assuming you work an 8 hour day, that means you are testing your code every 2 minutes and 24 seconds. Given that most of your tests will take this long to run (you've got a suite of them right?), that leaves you with zero time to actually do the work you are testing.
Frankly, if you are using Unit Tests you should be using them after major chunks of work, not in a trial and error fashion. Now if you were using them in a trial and error fashion - "lets change this, run the tests and see if they pass, no that didn't work, lets try this", etc, I could understand how you hit the 200 times per day mark. That is a completely respectable position to take. I used to work in this way during college. My several thousand unit tests do take 2-3 minutes to build. My estimate of 200 times was probably over shot and should be more like 50-75 times a day. I would also like to point out that I can continue developing while the tests run. I use Maven2 as a build tool and enjoy it immensely, it helps me do test driven development. Since you are obviously far superior to me, I will assume you know what this means but point it out to the rest of the idiots like myself. TDD is where you write your unit tests before you code. Then you satisfy your unit tests with code. When you need to change code, you change the tests and then you change the code to fix the tests. Crazy waste of time right? If you are coding in a trial and error fashion and using unit tests that way, I'd advise getting some tuition or changing career. Thanks, I love you too.
But the thing is that my employer loves my work and my code rarely breaks. Now why is that? Perhaps because I'm regression testing at all times? Perhaps it's because I take the time to think about things before I do them and, as a result, I really begin to understand what it is that I'm writing.
An added benefit is that I've found I can look at my or others unit tests and really understand what was going through their mind when the first wrote the method that I am expanding. It's quite interesting, but I'm sure you are a supreme being like Knuth and don't bother with such trivialities. I'm a highly productive individual
Here's a question: how much time do you spend working out what happened when your code breaks? TDD is a trivial amount of time compared to that. I am concerned about my software in the present and future. I wish others were also. What counts is that when you run the unit tests, they pass, and that they accurately test the conditions that need testing. I disagree with you. I run unit tests that fail all the time--on purpose.
I know it will most likely result in a swift abrasive response but I implore your highness to really spend some time understanding how unit tests can help the really stupid coders (like me).
My work here is dung.
I myself solve the problem using this construct:
...
#define BeginWhile {
#define EndWhile }
#define BeginFor {
#define EndFor }
No, it is a person who says moooooo when you ask him about trivial things like O(X) is his algorithm or what is the finite state machine he used to implement a protocol. Using a mutex-locked delete+insert instead of atomic replace in SQL is another popular mooooooo. It is usually done because the cretin cannot fatom the idea that a database op done correctly is atomic anyway so it needs no mutex and the database will NOT DEADLOCK the way an incompetently done mutex can.
An so on...
Very common species... The COW-WORKER...
Baker's Law: Misery no longer loves company. Nowadays it insists on it
http://www.sigsegv.cx/
http://unix-archive.kalwun.de/PDP-11/Trees/V7/usr/src/cmd/sh/mac.h
You're full of shit. A proponent of semi-literate programming, I see.
Athletic Scholarships to universities make as much sense as academic scholarships to sports teams.
I fon't know. I've found that Dijkstra hasn't said anything new or profound in more than five years.
All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
I like the idea of using "ZEROORMOREOFTHEPRECEDINGCHARACTER" rather than "*", myself.
I have actually seen code like this:
// end while-loop // end if-loop
}
}
You read that right. if-loop.
Done with slashdot, done with nerds, getting a life.
Putting a comment above the line telling people why you're doing it isn't.
I don't have to tell people why I do it. I do it for money. Well, sometimes for love and world peace, but that's rare.
Know your pads. One time pad: good for cryptography. Two timing pad: where to take your mistress.
Nobody who modded this funny ever worked with a foreign language programming team.