Hello,小伙伴们,今日不聊技能,共享点有意思的东西。前段时间,表弟给我发过来一篇老外写的文章,以略带挖苦的对话方式戏弄了自己对结构的看法,我在读了一下以后也感觉比较风趣,这儿共享给咱们。

作者Benji Smith,可惜目前在这位老哥的个人网站上现已找不到这篇文章的原文了,只剩下了一段自我介绍。这儿最终在国内的技能论坛里找到了英文原文和其他的大佬的翻译,这儿我参阅了一些版别的译文,合作自己的了解重新进行了一波翻译,并增加了一些插图,便利咱们更容易地了解原文。

好了,下面就来看一下正文吧。

正文

目前,我正处于构建一个Java web运用的计划阶段(是的,有必要要运用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.

听老外吐槽框架设计,Why I Hate Frameworks?

在以前,我做过一些零碎的木匠活,因而我很清楚我究竟需求什么:一些木头以及根底的东西,例如卷尺、锯子、水平仪和锤子。

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.

听老外吐槽框架设计,Why I Hate Frameworks?

假如我要制作一整栋房屋,而不仅是一个香料架的话,那么我需求的仍是卷尺、锯子、水平仪、锤子以及其他的一些东西。

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.

听老外吐槽框架设计,Why I Hate Frameworks?

“一把锤子?”他问道,“现在现已没有人再买锤子了,它们现已过时了。”

“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.”

听老外吐槽框架设计,Why I Hate Frameworks?

“呃,嗯,我以为这听起来的确不错。那么你能告诉我哪里能找到这么一把全能的锤子吗?”

“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.”

听老外吐槽框架设计,Why I Hate Frameworks?

“这倒是真的。那么,假如没有人买这种全能锤子的话,而你们也不再卖那些老样式的锤子的话,你们究竟卖什么锤子呢?”

“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.”

听老外吐槽框架设计,Why I Hate Frameworks?

“可是我真的不想买一个锤子工厂…”

“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.”

听老外吐槽框架设计,Why I Hate Frameworks?

“嗯,这么听上去的确挺合理。”

“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.”

听老外吐槽框架设计,Why I Hate Frameworks?

“让我猜一下,你们必定也不再出售这些规划图了”

“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!!”

听老外吐槽框架设计,Why I Hate Frameworks?

“我很赞同你的观点。”

“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.”

听老外吐槽框架设计,Why I Hate Frameworks?

“嗯,那实际上并不……”

“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.”

听老外吐槽框架设计,Why I Hate Frameworks?

“是的,这可不是闹着玩的。”

“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).”

听老外吐槽框架设计,Why I Hate Frameworks?

“所以说你们根本就没有锤子,对吗?”

“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.”

听老外吐槽框架设计,Why I Hate Frameworks?

“现在每个人都是这样做的吗?当需求一把锤子的时分,他们都在运用一个通用的能够出产东西工厂的制作工厂的工厂吗?”

“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?”

现在,我现已骄傲的具有了自己的通用的东西工厂的制作工厂的制作工厂,我很欣喜地知道它与GPTBFFF 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.

听老外吐槽框架设计,Why I Hate Frameworks?

走运的是,在面向东西的元工厂联盟中,70%的工人经过了这一版别规范的认证。

Luckily, 70% of the workers in the Tool-Oriented Metafactory Union are certified against this version of the spec.

然而规范之争已初露端倪,一项名为UXCTBFFF(通用跨大陆东西制作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.

我的了解是,只要在用户界面上创立一个笼统层,必定会有一个补丁包能使我的GPTBFFF 0.97 RC2与UXCTBFFF规范达到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).

听老外吐槽框架设计,Why I Hate Frameworks?

— End —

Benji Smith个人网站:

www.benjismith.net/

原文及译文参阅:

www.cnblogs.com/kkjmyazi/ar…

PS:

由于文中有很多我也不确定翻译是否正确的当地,所以贴出了英文原文。例如关于文中“which promises to unify the factory factory factory industry to comply with guidelines of countries that use both metric and standard tools.”这一句,假如从字面上进行翻译的话后半句大致意思是“使它契合一些一起运用公制和规范东西的国家的规范”,而我决议将它引申为“一起运用通用工厂办法和规范原始东西”。

诸如此类的当地,假如您有更好的建议,能够在大众号后台直接发送建议给我,万分感谢!

作者简介,码农参上,一个酷爱共享的大众号,风趣、深入、直接,与你聊聊技能。欢迎增加老友,进一步交流。