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
html

我正處於建造一個基於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. java

首先假設我決定作一個調味品架子。
Let's pretend I've decided to build a spice rack. web

我之前作過一些小的木工活,所以我知道本身須要如下東西:一些木頭和基本工具,包括捲尺、鋸子、水平儀和錘子。
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. promise

若是我想造一棟房子,而不只僅是一個調味品架,我仍是須要捲尺、鋸齒、水平儀和錘子(以及其它東西)。
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." app

我很驚訝這樣一種發展,因而問他爲何。
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." ide

事實上,若是生產出一種可以處理全部事情的錘子,反倒不能頗有效率地處理其中的任何一件。用一把大錘去拔個釘子很費勁吧。而且,你要殺死你前任女朋友的話,沒有什麼會比一把球頭錘更適合的了。
"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?" ui

事實上,咱們不賣錘子。
"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標準草案兼容,這是通用的工具工廠的建造工廠的建造工廠的標準。 
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).



http://www.cnblogs.com/kkjmyazi/archive/2006/11/29/576573.html

相關文章
相關標籤/搜索