The Codeless Code: Case 10-11 Pride(傲)、Cages(牢笼)

The Codeless Code: Case 10 Pride

After a cursory inspection, the Java master decreed that each monk in the Elephant's Footprint Clan would henceforth catch his own fish, harvest his own rice, sew his own robes, and cobble his own shoes.

在大致观察了一下之后,Java大师颁布了一个规定,要求在象印城的每个僧侣从此以后只能吃自己捕的鱼,吃自己采摘的粮食,穿缝自己做的长袍和靴子。

Within a month, the monks were half-naked and severely malnourished. Deadlines began to slip. The abbot implored the Java master to reconsider his decision.

于是,一个月之内,这些僧侣都变的衣不蔽体和营养不良。死亡的阴影开始慢慢降临。象印城的住持恳求大师重新考虑他的决定。

“Very well,” said the Java master. “Every Thursday, have them also burn their robes and shoes, and cast their rice and fish into the river.”

“非常好”,大师说道,“每周四,他们还是要燃烧他们的袍子和靴子,去将粮食扔掉,将鱼放回河里。”

The abbot asked what transgression his clan had committed to merit such punishment.

住持就问大师,究竟大家是犯了什么错,要受到这种惩罚。

“Punishment?” said the Java master. “I intended only to reward. Do not the monks of the Elephant’s Footprint relish their independence and self-sufficiency? Their code tells me as much:

“惩罚?”,大师问道,“我更倾向于认为这是一种赏赐。这个部落的僧侣们不是都喜欢自给自足吗?他们写的代码告诉我了很多东西”

“Each has authored essentially the same Data Access Objects and Value Objects as his neighbors. Each has crafted his own String utilities and configuration file parsers. Each has taken exquisite pains to design, implement, integrate, test, debug, repair, and extend that which he might merely have consumed from one of his brethren.

“他们每个人基本上都是用的相同的数据访问对象和值访问对象。他们每个人都精心设计自己的字符串工具和文件解析器。每个人都在设计、实现、集成、测试、调试、修复和扩展方面付出了极大的努力,而不用其他师兄早已写好的代码。”

“Shall I infer incompetence? If so, then every last monk of the Elephant’s Footprint must be cast out of the monastery.

"我就在想,是他们能力不够吗?如果是这样的话,那这个部落的每一个僧侣都应该驱逐出修道院了。"

“Shall I infer willful ignorance? If so, tradition demands that they blind themselves with nettles, and then be cast out.

"我又想,是他们视而不见吗?如果是这样的话,那按照传统的规矩应该用荨麻把他们的眼睛都弄瞎,再给驱逐出去。"

“Shall I infer contempt for the preciousness of time? If so, the dungeons await...

“我还在想,是他们轻视时间的宝贵吗?要是这样的话,地狱在等着他们。。。。。”

“But no,” concluded the Java master. “I shall instead infer pride—pride taken by each that his code is superior to that of his brethren. Pride is one of the Four Seeds of Greatness, and must be encouraged. Let the Elephant’s Footprint hone its skills with shears and spears, with needles and sickles, until every monk may be likewise proud of his fine robes and the bounty on his plate!”

“但真实情况,并不是这样的”,Java大师总结道,"我确定他们这么做的原因是他们有一股子傲气——是这个让他们觉得自己的代码优于其他人的。这种傲气是孕育出伟大的四个条件之一,必须得到鼓励。让这个部落里的僧侣们自给自足,直到每个僧侣连对自己所穿的僧袍所用的东西都有一股子傲气!"

“There will be little time left for coding,” observed the abbot. “And the Emperor is quite literal in his interpretation of the word deadline.”

“可是,如果这样的话,就没有时间写代码了”,住持说,"国王可是要求过,到了预定期限交不上代码,可是死罪啊!"

The master nodded. “The merchant, lately ruined, knows only the pangs of loss. Whereas the old hermit extols the virtues of austerity, and will not change his state. Yet are these not the same man, separated only by a gulf of years?”

大师点了点头说:“刚刚破产的商人,只知道散财的痛苦,隐居的老者只知道颂扬节约的价值。这难道不是一类人吗?,只不过处在不同的时间当中罢了”(读者注:大师的意思是说,有傲气,能够对别人写的代码存超越之心,是好事,这会激励"码僧"们,去创造更完美的代码,相比之下,做倒手买卖的商人,从别人那里获得代码,再转卖出去和做隐士的,将之前写的代码保留,然后,每次用的时候都本着节约的态度去套以前的代码,都是不可能创造出完美的代码的,而在业界,只有创造完美代码的公司才不会被轻易的淘汰,商人和隐士这两类人,其实都是一类人——无法激起自己创造完美代码的人罢了!)

Thus was the Elephant’s Footprint spared twice and corrected.

正是由于大师的做法,象印城才在经历了两次危机后又都纠正了回来。

The Codeless Code: Case 11 Cages

To prevent any further proliferations of redundant code, the abbot of the Elephant's Footprint Clan decreed that his monks were only to produce code which was application-specific. Anything of a more general nature had to be proposed to a Software Reuse Subcommittee, which researched open source solutions, weighed the merits of the proposal against the needs of the various applications, amended the design as its members saw fit, and (if all signs were favorable) put the project on the implementation schedule. The whole process, from inception to execution, took many weeks.

为了防止冗余的代码越来越多,象印城的住持要求城里的僧侣们必须针对专门功能来创造代码。任何多余的常用属性都必须得到软件重用委员会(这是一个用于研究开源解决方法、权衡所提议的优点和各种不同应用的实际需要,根据每个组委会成员的意见来修改决定,(如果都顺利的话)把提交的项目加入到实施的日程中)审查,被允许后才可以加进去。整个的审查过程需要花费好几个星期的时间。

When news of this policy reached him, the Java master sent for the abbot’s two prized songbirds. His letter promised that the birds would be returned the following week. And so they were, in two separate bamboo cages of the Java master’s devising.

当这执行这个要求的消息传到了Java大师那去之后,大师给象印城的住持送去了两只珍贵的会唱歌的鸟。大师在信中说,要在下周归还他送给住持的鸟,就这样这两只鸟分装在大师亲手做的竹笼子里送了过去。

The bars of the first cage were a handspan apart; the bird had easily escaped during the journey.

关第一个鸟的笼子的开关和笼子是分离的,鸟早就轻易的从笼子里逃走了。

The bars of the second cage were so close that neither light nor air could pass through. The bird inside was dead upon arrival.

关第二个鸟的笼子的开关被锁的死死的,连笼子也被罩的一点光和空气都透不过来。呆在里面的鸟快被闷死了。

Tied to each cage was a poem in the master’s hand:

大师亲手在两个笼子上都题了一句话:

Along the road from air to coffin lie the many houses of cage.

从生至死,沿路遍布竹笼

The house of the thrush is not shared by the worm and the bull.

画眉之屋,虫牛不可同生(打算把程序员所写的代码都要靠一群“专家”评估,才能通过,无异于把程序员的创造力给闷死)

发布了271 篇原创文章 · 获赞 8 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_17846375/article/details/104752901