(转载)Why i hate framework

说明:本文摘自Evan Wang 的Blog,因为对这个问题实在太有感触了,因此忍不住“偷”了过来。
作者的翻译真是好! 加了英文对照,为了方便体会原文的幽默和趣味,同时也提高下English.
引用自:http://www.blogjava.net/evanwhj/archive/2006/03/11/34837.html


Author
Benji Smith
TranslatorEvan Wang
Original Link
Why I Hate Frameworks

我正处于建造一个基于JavaWeb应用的规划阶段(是的,必须基于Java,不过我现在还不想讨论其中的原因)。在这个过程中,我评估了一系列CMS应用容器框架,它们大多拥有J2EE门户、采用与JSR相兼容的MVC架构、基于角色等。
I'm currently in the planning stages of building a hosted Java web application (yes, it has to be Java, for a variety of reasons that I don't feel like going into right now). In the process, I'm evaluating a bunch of J2EE portlet-enabled JSR-compliant MVC role-based CMS web service application container frameworks.

然而在花了几十个小时阅读功能列表和文档后,我几乎想戳瞎我的双眼。
And after spending dozens of hours reading through feature lists and documentation, I'm ready to gouge out my eyes.

首先假设我决定做一个调味品架子。
Let's pretend I've decided to build a spice rack.

我以前做过一些小的木工活,因此我知道自己需要以下东西:一些木头和基本工具,包括卷尺、锯子、水平仪和锤子。
I've done small woodworking projects before, and I think I have a pretty good idea of what I need: some wood and a few basic tools: a tape measure, a saw, a level, and a hammer.

如果我想造一栋房子,而不仅仅是一个调味品架,我还是需要卷尺、锯齿、水平仪和锤子(以及其它东西)。
If I were going to build a whole house, rather than just a spice rack, I'd still need a tape measure, a saw, a level, and a hammer (among other things).

所以,我跑到一家五金店,问一个销售员,哪里能找到一把锤子。
So I go to the hardware store to buy the tools, and I ask the sales clerk where I can find a hammer.

锤子?他说:现在几乎没人要买锤子了。这个已经过时了。
"A hammer?" he asks. "Nobody really buys hammers anymore. They're kind of old fashioned."

我很惊讶这样一种发展,于是问他为什么。
Surprised at this development, I ask him why.

嗯,问题在于有太多种类的锤子。大锤啦,拔钉锤啦,球头锤等等。你买了其中一种,后来发现你还需要另外一种怎么办呢?你下次还得单独买一把。因此,大多数人实际上需要一把能够处理他们一生中可能碰到的所有敲敲打打的活的锤子。
"Well, the problem with hammers is that there are so many different kinds. Sledge hammers, claw hammers, ball-peen hammers. What if you bought one kind of hammer and then realized that you needed a different kind of hammer later? You'd have to buy a separate hammer for your next task. As it turns out, most people really want a single hammer that can handle all of the different kinds of hammering tasks you might encounter in your life."

嗯,这个听起来挺不错。那么我在哪里能够找到这样一把通用锤子呢?
"Hmmmmmm. Well, I suppose that sounds all right. Can you show me where to find a Universal Hammer."

不,我们不再销售了。他们已经废弃了。
"No, we don't sell those anymore. They're pretty obsolete."

真的吗?我想你刚才不是说通用锤子是将来的趋势嘛。
"Really? I thought you just said that the Universal Hammer was the wave of the future."

事实上,如果生产出一种能够处理所有事情的锤子,反倒不能很有效率地处理其中的任何一件。用一把大锤去拔个钉子很费劲吧。并且,你要杀死你前任女友的话,没有什么会比一把球头锤更适合的了。
"As it turns out, if you make only one kind of hammer, capable of performing all the same tasks as all those different kinds of hammers, then it isn't very good at any of them. Driving a nail with a sledgehammer isn't very effective. And, if you want to kill your ex-girlfriend, there's really no substitute for a ball-peen hammer."

这倒是真的。如果没有人会买这种通用锤子,而你们又不再销售老式的各种锤子,那么你们卖什么样的锤子呢?
"That's true. So, if nobody buys Universal Hammers anymore, and if you're no longer selling all those old-fashioned kinds of hammers, what kinds of hammers do you sell?"

事实上,我们不卖锤子。
"Actually, we don't sell hammers at all."

那么…”
"So..."

根据我们的研究,人们需要的根本不是通用锤子。最好还是用不同的锤子做不同的工作。所以,我们现在销售锤子工厂,它能够生成任何你需要的锤子。你所需要的只是为锤子工厂招聘员工,开动机器,购买原材料,付公用事业费,诸如此类的这样你就可以随时得到你需要的锤子。
"According to our research, what people really needed wasn't a Universal Hammer after all. It's always better to have the right kind of hammer for the job. So, we started selling hammer factories, capable of producing whatever kind of hammers you might be interested in using. All you need to do is staff the hammer factory with workers, activate the machinery, buy the raw materials, pay the utility bills, and PRESTO...you'll have *exactly* the kind of hammer you need in no time flat."

但我真的不想买一个锤子工厂…”
"But I don't really want to buy a hammer factory..."

对头。我们其实也不再销售锤子工厂了。
"That's good. Because we don't sell them anymore."

但你刚刚还说…”
"But I thought you just said..."

我们发现大多数人实际上不需要一整个锤子工厂。比如说,一些人,就不可能用到球头锤。(也许他们就没有前女友。或者他们用冰锥来解决她们。)所以对一些人来说一个能生产各种锤子的工厂是没有什么意义的。
"We discovered that most people don't actually need an entire hammer factory. Some people, for example, will never need a ball-peen hammer. (Maybe they've never had ex-girlfriends. Or maybe they killed them with icepicks instead.) So there's no point in someone buying a hammer factory that can produce every kind of hammer under the sun."

耶,这个实际得多。
"Yeah, that makes a lot of sense."

所以,我们开始销售锤子工厂的示意图,以便我们的客户能够建造他们自己的锤子工厂,自行设计只生成他们实际需要的那些锤子。
"So, instead, we started selling schematic diagrams for hammer factories, enabling our clients to build their own hammer factories, custom engineered to manufacture only the kinds of hammers that they would actually need."

让我猜猜看。你们现在也不再销售这些了。
"Let me guess. You don't sell those anymore."

对,真的是这样。实际上,人们不会为了几把锤子去建一个工厂。就像我经常说的,让建造工厂的专家去建造工厂吧。
"Nope. Sure don't. As it turns out, people don't want to build an entire factory just to manufacture a couple of hammers. Leave the factory-building up to the factory-building experts, that's what I always say!!"

这一点我赞成。
"And I would agree with you there."

对的。所以我们停止销售这些示意图,转而销售建造锤子工厂的工厂。每个建造锤子工厂的工厂都由这方面的顶尖专家建造,所以,你根本不需要操心建造工厂的任何细节。你依然拥有自定义锤子工厂的好处,根据你自己特定的锤子设计做出你自己的锤子。
"Yup. So we stopped selling those schematics and started selling hammer-factory-building factories. Each hammer factory factory is built for you by the top experts in the hammer factory factory business, so you don't need to worry about all the details that go into building a factory. Yet you still get all the benefits of having your own customized hammer factory, churning out your own customized hammers, according to your own specific hammer designs."

嗯,这个实际上并不…”
"Well, that doesn't really..."

我知道你想说什么!我们也不再销售这些东西了。因为某些原因,也没有多少人买建造锤子工厂的工厂,所以我们又有了新的解决方法。
"I know what you're going to say!! ...and we don't sell those anymore either. For some reason, not many people were buying the hammer factory factories, so we came up with a new solution to address the problem."

哇哈。
"Uh huh."

当 我们回过头来审查这个统一工具的基础时,发现人们被必须管理和运作一个制造锤子的工厂以及它所生成的锤子工厂给困住了。当你需要处理类似的建造卷尺工厂的 工厂,水平仪工厂的工厂,锯子工厂的工厂的时候,这很快就会变得相当棘手。更别提木材生产集团公司了。当我们审查这种状况的时候,我们意识到这对于仅仅想 做个调味品架子的人来说过于复杂了。
"When we stepped back and looked at the global tool infrastructure, we determined that people were frustrated with having to manage and operate a hammer factory factory, as well as the hammer factory that it produced. That kind of overhead can get pretty cumbersome when you deal with the likely scenario of also operating a tape measure factory factory, a saw factory factory, and a level factory factory, not to mention a lumber manufacturing conglomerate holding company. When we really looked at the situation, we determined that that's just too complex for someone who really just wants to build a spice rack."

是啊,这可不是开玩笑。
"Yeah, no kidding."

所以,这个星期,我们正在推广一种通用的建造工厂, 用来建造生产工具工厂的工厂,这样你所有的用来建造不同种类工具的工厂的工厂就可以由一个单一的、统一的工厂来建造了。这种工厂将仅仅生产你所需要的工具 工厂的建造工厂,而这些建造工厂将生成一个仅生产你自定义的工具的工厂来。你将得到你要的那种锤子,你要的卷尺,所有这一切仅仅需要按一下按钮(当然,也 许你要发布一些配置文件以便它能根据你的期望来工作)。
"So this week, we're introducing a general-purpose tool-building factory factory factory, so that all of your different tool factory factories can be produced by a single, unified factory. The factory factory factory will produce only the tool factory factories that you actually need, and each of those factory factories will produce a single factory based on your custom tool specifications. The final set of tools that emerge from this process will be the ideal tools for your particular project. You'll have *exactly* the hammer you need, and exactly the right tape measure for your task, all at the press of a button (though you may also have to deploy a few *configuration files* to make it all work according to your expectations)."

所以,你们根本就没有什么锤子?不是吗?
"So you don't have any hammers? None at all?"

是的。如果你需要一个高质量的,工业标准的调味料架子,你绝对需要这些高级玩意,而不是从那些破破烂烂的五金店里就买得到的锤子。
"No. If you really want a high-quality, industrially engineered spice rack, you desperately need something more advanced than a simple hammer from a rinky-dink hardware store."

现在所有的人都在这么做吗?当他们需要一把锤子的时候,所有的人都在使用一个通用的能够生产工具工厂的建造工厂的工厂吗?
"And this is the way everyone is doing it now? Everyone is using a general-purpose tool-building factory factory factory now, whenever they need a hammer?"

是的。
"Yes."

好吧。我想这就是我必须要做的。如果这是处理事情的既定方法,我想我最好还是学学怎么来用吧。
"Well…All right. I guess that's what I'll have to do. If this is the way things are done now, I guess I'd better learn how to do it."

祝你好运!
"Good for you!!"

这些都有文档的,对吧?
"This thing comes with documentation, right?"

现在我已经自豪地拥有了自己的通用的工具工厂的建造工厂的建造工厂,我很高兴地知道它与GPTBFF 0.97 RC2标准草案兼容,这是通用的工具工厂的建造工厂的建造工厂的标准。Deleting... Approving...
Now that I'm the proud owner of my own general-purpose tool-building factory factory factory, I'm satisfied to know that it complies with the GPTBFFF 0.97 RC2 draft specification for tool-building factory factory factories.

很幸运地,面向工具的元工厂联盟里的工人都通过了这个版本的标准的验证。
Luckily, 70% of the workers in the Tool-Oriented Metafactory Union are certified against this version of the spec.

然而标准之争即将开始:一种名为UXCTBFFF(Universal Trans-Continental Tool Building FFF)很有竞争力的原工厂技术承诺将统一建造工厂的工厂的建造行业,以使之符合那些同时使用公制和当地度量单位的国家的标准。

On the horizon is a competing standard, though: a very compelling metafactory technolgy called the UXCTBFFF (Universal Trans-Continental Tool Building FFF), which promises to unify the factory factory factory industry to comply with guidelines of countries that use both metric and standard tools.

我的理解是只需要创建一个贯穿用户界面的抽象层的补丁包,就可以使GPTBFF 0.97 RC2UXCTBFF标准达到95%左右的兼容。

My understanding is that there will be a service pack to my GPTBFFF 0.97 RC2 to bring it into nearly 95% compliance with the UXCTBFFF standard, just by creating an abstraction layer through its user interface.

真是太好了!
Sweet!!

想必这种新的发展能够提升我的调料架的质量(一旦我搭建好我的工具工厂的建造工厂的建造工厂并使之运行,培训好工人,从柬埔寨进口来原木,在最近的某天,我就要开始做那个调料架了)。
Surely this new development will improve the quality of my spicerack (which I'll get around to building one of these days, as soon as I've got my factory factory factory all up and running, my labor force trained, my raw materials imported from Cambodia, etc).

posted on 2006-11-29 22:34  Jessica.kjm  阅读(1213)  评论(0编辑  收藏  举报