创业成功人士访谈录 第99期:我是仁慈的独裁者(5)(在线收听) |
If you ask beginning programmers to write a calendar control, they often think to themselves, 如果你要求一个入门级的程序员写一个日历控件, 他们通常会对自己说
“Oh,I,m going to write the world’s best calendar control! It’s going to be polymorphic with respect to the kind of calendar.
啊,我要写一 个世界上最好的日历控件,它将会是多形态的日历
It will have displayers, and mungers, and this, that, and the other.”
它会有显示器,芒格,还有这个,还有那个,等等
They need to ship a calendar application in two months.
他们需要在两个月内完成这个控件。
They put all this infrastructure into place in the control, and then spend two days writing a crappy calendar application on top of it.
他们把所有的基础框架都放到了控件里面,然后花两天时间在上面写了一个蹩脚的日历程序。
They’ll think, “In the next version of the application, I’m going to do so much more.”
他们会想,“下个版本,我会做更 多事情。”
Once they start thinking about how they’re actually going to implement all of these other concretizations of their abstract design,
一旦他们开始思考如何把自己的抽象设计具体化的时候
however, it turns out that their design is completely wrong.
他们就会发现自己的设计完全错误。
And now they’ve painted themselves into a comer, and they have to throw the whole thing out.
现在他们把自己逼上了绝路,不得不放弃所有的东西。
I have seen that over and over. I’m a strong believer in being minimalistic.
我经常看见这样的事。我是一个坚定的“最小化主义者”。
Unless you actually are going to solve the general problem, don’t try and put in place a framework for solving a specific one,
除非你真的是要解决一般性问题,否则就不要尝试用一个框架来解决具体问题,
because you don’t know what that framework should look like.
因为你根本就不知道那个框架应该是什么样子。
The Extreme Programmers say, “Do the simplest thing that could possibly work.”
极限编程人员说,“做最简单的事才能有效。”
Yeah, well, Einstein said that, “Do the simplest thing possible, but no simpler.”
是的。爱因斯坦说过,“要尽可能地最简单,而不是比较简单。”
The concern I have about checked exceptions is the handcuffs they put on programmers.
我担心受控异常会成为程序员的手铐。
You see programmers picking up new APIs that have all these throws clauses,
当你看见程序员拿到如此有着复杂拋出语句的新应用程序界面的时候,
and then you see how convoluted their code gets, and you realize the checked exceptions aren’t helping them any.
你会发现他们的代码是如此的回绕,你会意识到受控异常对他们没什么帮助。
It is sort of these dictatorial API designers telling you how to do your exception handling.
这好像是专制的应用程序界面设计者告诉你必须怎样进行异常处理。
They should not be doing that.
他们不应该那样做。 |
原文地址:http://www.tingroom.com/lesson/cycgftl/400972.html |