免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 16790 | 回复: 18
打印 上一主题 下一主题

22条经典的编程引言 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-06-03 08:59 |只看该作者 |倒序浏览
原文:http://cocre.com/?p=808 - 酷壳





下面的这些经典的引言来自英文,也许有些我翻译的是不很好,所以,我提供了中英对照,如果有问题,请大家指正。



过早的优化是万恶之源。Premature optimization is the root of all evil!
- Donald Knuth



在水里行走和以一个需求规格进行软件开发,有一点是相同的,那就是如果水或需求都被冻住不了,那么行走和软件开发都会变得容易。Walking on water and developing software from a specification are easy if both are frozen
- Edward V Berard





Hofstadter 定理:“一件事情总是会花费比你预期更多的时间,就算是你已经考虑过本条Hofstadter 定理”。It always takes longer than you expect, even when you take into account Hofstadter’s Law.
- Hofstadter’s Law





有些遇到问题的人总是会说“我知道,我会使用正则表达式”,那么,你现在有两个问题了。(意思是:你本想用正则表达式来解决你已有问题,但实际上你又引入了“正则表达式”的一个新问题)Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems
- Jamie Zawinski




调试程序的难度是写代码的两倍。因此,只要你的代码写的尽可能的清楚,那么你在调试代码时就不需要那么地有技巧。Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
- Brian Kernighan



用代码行来衡量开发进度,无异于用重量来衡量制造飞机的进度。Measuring programming progress by lines of code is like measuring aircraft building progress by weight.
- Bill Gates



PHP被一些不合格的业余人员造就成了一个小恶魔;而Perl则是被一些熟练的但不正当的专业人员造就成了一个超级大恶魔。PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil, perpetrated by skilled but perverted professionals.
- Jon Ribbens



在两个场合我被问到:“请你告诉我,如果你给机器输入了错误的数字,那么,是否还能得到正确的答案?”我并不能正确领会这类想法。(注意,本引言的作者姓Babbage,这个名字和神父同名,意思是,作者在反问提问的人,你是问我还是向神父祈祷?)On two occasions I have been asked, ‘Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?’ I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.”
- Charles Babbage



在编程的时候,我们一定要想像一下,以后维护我们自己的代码的那个人会成为一个有暴力倾向的疯子,并且,他还知道我们住在哪里?Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
- Rick Osborne



现代的编程是“程序员努力建一个更大更傻的程序”和“世界正在尝试创造更多更傻的人”之间的一种竞赛,目前为止,后者是赢家。Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
- Rich Cook



我才不关心我的代码是否能在你的机器上工作!我们不会给你提供机器。I don’t care if it works on your machine! We are not shipping your machine!
- Ovidiu Platon



我总是希望我的电脑能够像电话一样容易使用;我的这个希望正在变成现实,因为我现在已经不知道怎么去使用我的电话了。I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone.
- Bjarne Stroustrup



计算机是一种在人类历史上所有发明中,可以让你比以前更快地犯更多的错误的发明,同样,其也包括了“手枪”和“龙舌兰酒”这两种发明的缺陷。A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila.
- Mitch Ratcliffe



如果调试程序是一种标准的可以铲除BUG的流程,那么,编程就是把他们放进来的流程。If debugging is the process of removing software bugs, then programming must be the process of putting them in.
- E. W. Dijkstra



教一群被BASIC先入为主的学生,什么是好的编程风格简直是一件不可能的事。对于一些有潜力的程序员,他们所受到的智力上的伤害远远超过了重建他们的信心。It is practically impossible to teach good programming style to students that have had prior exposure to BASIC. As potential programmers, they are mentally mutilated beyond hope of regeneration.
- E. W. Dijkstra



理论上来说,理论和实际是一样的。但实际上来说,他们则不是。In theory, theory and practice are the same. In practice, they’re not.
- Unknown



只有两个事情是无穷尽的:宇宙和人类的愚蠢。当然,我现在还不能确定宇宙是无穷尽的。Two things are infinite: the universe and human stupidity; and I’m not sure about the universe.
- Albert Einstein



Perl这种语言就好像是被RSA加密算法加密过的一样。Perl - The only language that looks the same before and after RSA encryption.
- Keith Bostic



我爱“最终期限”,我喜欢“嗖嗖嗖”的声音就像他们在飞一样。I love deadlines. I like the whooshing sound they make as they fly by.
- Douglas Adams



说Java好的是因为它跨平台就像好像说肛交好是因为其可以适用于一切性别。Saying that Java is good because it works on all platforms is like saying anal sex is good because it works on all genders
- Unknown



XML就像是一种强暴——如果它不能解决你的问题,那只能说明你没有用好它。XML is like violence - if it doesn’t solve your problems, you are not using enough of it.
- Unknown



爱因期坦说,自然界中的一切一定会有一个简单的解释,因为上帝并不是反复无常和独裁的。当然,不会有什么信仰能程序员像爱因期坦那样感到舒服。Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer.
- Fred Brooks



本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/haoel/archive/2009/06/01/4233454.aspx

论坛徽章:
0
2 [报告]
发表于 2009-06-03 09:05 |只看该作者
虽然这些都是教条,但还是顶一下

论坛徽章:
14
巨蟹座
日期:2013-11-19 14:09:4615-16赛季CBA联赛之青岛
日期:2016-07-05 12:36:0515-16赛季CBA联赛之广东
日期:2016-06-29 11:45:542015亚冠之全北现代
日期:2015-07-22 08:09:472015年辞旧岁徽章
日期:2015-03-03 16:54:15巨蟹座
日期:2014-12-29 08:22:29射手座
日期:2014-12-05 08:20:39狮子座
日期:2014-11-05 12:33:52寅虎
日期:2014-08-13 09:01:31巳蛇
日期:2014-06-16 16:29:52技术图书徽章
日期:2014-04-15 08:44:01天蝎座
日期:2014-03-11 13:06:45
3 [报告]
发表于 2009-06-03 09:18 |只看该作者

都绝对经典

尤其是:
说Java好的是因为它跨平台就像好像说肛交好是因为其可以适用于一切性别。
XML就像是一种强暴——如果它不能解决你的问题,那只能说明你没有用好它。

论坛徽章:
0
4 [报告]
发表于 2009-06-03 09:38 |只看该作者
加一条

python的口号是 做爱只用一种姿势

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
5 [报告]
发表于 2009-06-03 10:10 |只看该作者
Perl这种语言就好像是被RSA加密算法加密过的一样。Perl - The only language that looks the same before and after RSA encryption.
- Keith Bostic


正确的译法应该是:
Perl 是唯一一种代码经过 RSA 加密之后,看上去和加密之前没什么变化的语言。

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
6 [报告]
发表于 2009-06-03 10:11 |只看该作者
调试程序的难度是写代码的两倍。因此,只要你的代码写的尽可能的清楚,那么你在调试代码时就不需要那么地有技巧。Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
- Brian Kernighan


没想到在地球的另一边居然也有人和我产生了同样的想法。
BTW:我几乎不用 gdb,除了偶尔 bt 一把之外。

论坛徽章:
0
7 [报告]
发表于 2009-06-03 10:27 |只看该作者

回复 #6 flw 的帖子

汗 那不用GDB,是由于代码写的OK?

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
8 [报告]
发表于 2009-06-03 10:36 |只看该作者
原帖由 lsupper 于 2009-6-3 10:27 发表
汗 那不用GDB,是由于代码写的OK?

我坚信一点:
就我所服务的几个雇主来看,调试代码时所需要关心的内容,交付后仍然可能需要关心,而用 gdb 获取这些信息是一次性的,如果需要反复地获取,就需要反复地 gdb。
另一方面,gdb 依赖于源代码。

论坛徽章:
0
9 [报告]
发表于 2009-06-03 14:30 |只看该作者
原帖由 flw 于 2009-6-3 10:11 发表
调试程序的难度是写代码的两倍。因此,只要你的代码写的尽可能的清楚,那么你在调试代码时就不需要那么地有技巧。Debugging is twice as hard as writing the code in the first place. Therefore, if you writ ...

貌似翻译的有问题阿. 我的理解,调试程序的难度是写代码的两倍.因此,如果你写代码时把聪明发挥到极致,那么就没有足够的能力去debug了.
我觉得他说的是不要写太聪明的代码

论坛徽章:
8
CU大牛徽章
日期:2013-04-17 10:59:39CU大牛徽章
日期:2013-04-17 11:01:45CU大牛徽章
日期:2013-04-17 11:02:15CU大牛徽章
日期:2013-04-17 11:02:36CU大牛徽章
日期:2013-04-17 11:02:58技术图书徽章
日期:2013-12-04 10:48:50酉鸡
日期:2014-01-03 10:32:30辰龙
日期:2014-03-06 15:04:07
10 [报告]
发表于 2009-06-03 14:42 |只看该作者
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
- Brian Kernighan

排除bug的难度是当初编码的两倍。因此,如果你写代码时用上了所有的聪明才智,那么,很显然,你的智力将不足以为它排错。

(KISS原则的另一种表述)


On two occasions I have been asked, ‘Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?’ I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.”
- Charles Babbage

我曾两次被问到“请问,Babbage先生,如果你把错误的描述输入机器,正确答案会出现吗?”,我实在无法理解一个人的脑子得有多混乱才会冒出这种想法。



Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer.
- Fred Brooks

爱因斯坦争辩(著名的量子大辩论)说,自然的一切行为一定有简洁单一的解释,因为上帝不会反复无常或者随心所欲(或许该译为著名的“上帝不掷骰子”)。软件工程师不用这种信仰安慰自己[解释A](或者译为 没有类似的保证可以安慰程序员[解释B])。

解释A:程序员总喜欢拿偶发或运行环境之类理由来开脱自己,却不肯承认那是自己代码的缺陷——也就是“程序员认为自己的世界就是反复无常随心所欲、无法简单解释的”,所以不用类似信仰安慰自己(于是继续努力写烂程序)

解释B:程序员依赖的库、操作系统等运行环境以及用户行为之类都是不可靠或不可预测的,不要想当然的认为他们不会犯错——也就是“写程序时一定要考虑各种意外”

两个解释似乎都通……

[ 本帖最后由 shan_ghost 于 2009-6-3 15:39 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP