Knuth老爷子的一段话

Seibel: 很多人都赞同你所说的,自己写代码更有乐趣。但除了乐趣之外——

Knuth: 不仅仅是乐趣而已。数学家的工作是给出证明,但在你求解数学问题时,几乎找不到某个定理的假设和你求解问题所需的假设恰好一模一样。通常来说,你已经得到了一个类似于书上定理的东西,你要做的就是看看它的证明,然后说,“嗯,为了证明我手头现有的假设,我要这样改动一下这个证明。”所以说,虽然数学书里总是塞满了定理,但你永远找不到严丝合缝的那个。你想看见的还是那个需要改动的证明,因为正好找到你想要的定理的概率只有百分之一。我认为这和软件的情况恰好吻合。

Seibel: Many people will agree with you that, yes, it’s more fun to write the code yourself. But other than the fun—

Knuth: It’s not only fun. The job of a mathematician is to make proofs but almost never, when you’re solving a mathematical problem, do you find a theorem for which the hypotheses are exactly what you need for the problem you’re solving. Almost always you’ve got something that’s sort of like the theorem that’s in the book. So what you do is you look at the proof of that theorem and you say, “Oh, here’s how I have to change that proof in order to prove the hypothesis that I really have.” So mathematical books are packed with theorems, but you never plug in exactly the theorem—you want to see that proof because it’s one time in a hundred when you’ll find just the theorem that you wanted. I think it’s exactly the same with software.

选自:Peter Seibel. Coders at Work : Reflections on the Craft of Programming. APress, 2009。中译本将由人民邮电出版社图灵公司翻译出版。

正好解了自己一段疑惑。

 

Leave a Reply

Your email address will not be published. Required fields are marked *