最佳编程语录
以前本站发布过《22条经典的编程引言》、《编程引言补充》、《Linus Torvalds 语录》还有《十条不错的编程观点》。今天向大家介绍“最佳编程语录”,条条都是很不错的语录,如同我们的太阳,照亮了我们的方向(所以我们选用了一个红色的图片,希望能够通过五毛们的网络审查)。其中只有一两条在以前本站发布过的文章中出现过。这篇文章的出处在这里,下面是“Neo”和“陈皓”的翻译,我们的翻译水平有限,所以,我们提供了中英文对照,有不当之处,还请各位指正。
A good programmer is someone who looks both ways before crossing a one-way street. — Doug Linder, systems administrator
好的程序员这样一类人,这类人在横穿一条单行道前都要先看一下路两边。– Doug Linder, 系统管理员
A most important, but also most elusive, aspect of any tool is its influence on the habits of those who train themselves in its use. If the tool is a programming language this influence is, whether we like it or not, an influence on our thinking habits. — Edsger Dijkstra, computer scientist
关于工具,一个最重要的,也是最不易察觉的方面是,工具对使用此工具的人的习惯的潜移默化的影响。如果这个工具是一门程序语言,不管我们是否喜欢它,它都会影响我们的思维惯式。 –Edsger Dijkstra, 著名的计算机科学家。
Being abstract is something profoundly different from being vague… The purpose of abstraction is not to be vague, but to create a new semantic level in which one can be absolutely precise. — Edsger Dijkstra
抽象和模糊完全地不同,抽象的目的并不是把事情变模糊,而去创建一个新的语义层,在那里是绝对精确的描述。 — Edsger Dijkstra
Besides a mathematical inclination, an exceptionally good mastery of one’s native tongue is the most vital asset of a competent programmer. — Edsger Dijkstra
除了数学爱好,对于一个有能力的程序员来说,出色地掌握自己的母语是最宝贵的财富。– Edsger Dijkstra
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg. — Bjarne Stroustrup, developer of the C++ programming language
C很容易使你搬起石头砸自己的脚,而C++把这事变得更难,但是如果一定要这么做,那么你的整条腿都会被炸飞 -Bjarne Stroustrup, C++语言的发明者
Commentary: most debugging problems are fixed easily; identifying the location of the problem is hard. — unknown
修复bug很容易,但是定位bug却很困难 – 匿名
Considering the current sad state of our computer programs, software development is clearly still a black art, and cannot yet be called an engineering discipline. — Bill Clinton, former President of the United States
看看当前计算机程序糟糕的事态,软件开发明显一直是一门妖术,其仍然不能被称为一个工程学。 –比尔.克林顿 美国前总统
For a long time it puzzled me how something so expensive, so leading edge, could be so useless, and then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match. — Bill Bryson, author, from Notes from a Big Country
长期以来,有个事一直困扰着我,那就是越是昂贵的,越是前沿的,就越可能是没用的。然后,困扰我的另一个事是,计算机是一个死的机器,却可以不可思议地去完成那些巧妙的事情,而计算机程序员是那么聪明人却在做着不可思议的愚蠢的事情,简而言之,他们真是天生的一对。– Bill Bryson旅游文学作家 Big Country中的笔记
Given enough eyeballs, all bugs are shallow (e.g., given a large enough beta-tester and co-developer base, almost every problem will be characterized quickly and the fix obvious to someone). — Eric S. Raymond, programmer and advocate of open source software, from The Cathedral and the Bazaar
足够多的眼睛,就可让所有问题浮现(比如:只要给于足够多的beta测试者和开发人员一起工作,那么,几所所有的问题都会很快的出现,而修正也会是显而易见的)
Good code is its own best documentation. As you’re about to add a comment, ask yourself, ‘How can I improve the code so that this comment isn’t needed?’ Improve the code and then document it to make it even clearer. — Steve McConnell, software engineer and author, from Code Complete
好的代码自己本身就是最好的文档。当你打算加注释的时候,问问自己‘我如何才能把我的代码改善到不需增加注释?’重构自己的代码,然后使文档让其更清楚。 — Steve McConnell《代码大全》的作者
Hey! It compiles! Ship it! — unknown
嘿,编译通过了!出货!–匿名
Inside every well-written large program is a well-written small program. — Charles Antony Richard Hoare, computer scientist
在每个编写精良的大程序里面都是一个编写精良的小程序。 –Charles Antony Richard Hoare,计算机科学家
It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter. — Nathaniel S. Borenstein, computer scientist
需要注意的是,没有哪个经过规范培训的工程师会赞成写一个DestoryBaghdad(摧毁巴克达)的函数。最基本的职业规范会告诉他们应该去写一个叫DestoryCity的函数,然后把“Baghdad”(巴克达)当成这个函数的参数。—— Nathaniel S. Borenstein, 计算机科学家
Managing programmers is like herding cats. — unknown
管理程序员就如同养一群猫一样 –匿名
Measuring programming progress by lines of code is like measuring aircraft building progress by weight. — Bill Gates, co-founder of Microsoft Corporation
用代码行数来衡量编程的进度,就如同用航空器零件的重量来衡量航空飞机的制造进度一样。——Bill Gates,微软创始人
More good code has been written in languages denounced as bad than in languages proclaimed wonderful — much more. — Bjarne Stroustrup, from The Design and Evolution of C++
更多的优秀代码是用被认为很烂的语言写成的,而不是用那些被说的好的不得了的语言。——Bjarne Stroustrup, 摘自《The Design and Evolution of C++》
Programs must be written for people to read, and only incidentally for machines to execute. — Harold Abelson and Gerald Jay Sussman, computer scientists and authors, from The Structure and Interpretation of Computer Programs
代码应该是写给其他人来读的,而能让机器运行的仅仅是附带着的。—— Harold Abelson 与 Gerald Jay Sussman, 计算机科学家和作家,摘自《The Structure and Interpretation of Computer Programs》
Real programmers don’t comment their code. If it was hard to write, it should be hard to understand. — unknown
真正程序员从来不写代码的注释,如果代码非常难写,那么同样代码的注释也会非常难懂 –匿名
Simplicity is prerequisite for reliability. — Edsger Dijkstra
简单是可靠的前提条件 — 迪杰斯特拉
The C programming language — a language which combines the flexibility of assembly language with the power of assembly language. — unknown
C语言—— 一门同时具有了汇编语言灵活性和汇编语言强大能力的语言。– 匿名
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. — Tom Cargill, object-oriented programming expert at Bell Labs
开始的90%的代码用了90%的开发时间,而剩下的最后的10%的代码会需要另外90%的开发时间。– Tom Cargill,贝尔实验室的面向对象编程专家。
The important point is that the cost of adding a feature isn’t just the time it takes to code it. The cost also includes the addition of an obstacle to future expansion. Sure, any given feature list can be implemented, given enough coding time. But in addition to coming out late, you will usually wind up with a codebase that is so fragile that new ideas that should be dead-simple wind up taking longer and longer to work into the tangled existing web. The trick is to pick the features that don’t fight each other. — John Carmack, computer game programmer
增加一个功能特性的成本并不单单是为这些功能编码所花费时间的成本,还这个成本应该包括特性扩展的障碍成本。当然,任何的功能清单都可以被实现,只需要有足够的时间。但是除些之外,你应该对你的代码库的脆弱性感到紧张,而那些新的想法应该足够的简单,而不是去花费更多更多的时间去纠缠于现有的蜘蛛网。这里的决窃是挑选那些不会和别人冲突的的功能。
The key to performance is elegance, not battalions of special cases. The terrible temptation to tweak should be resisted unless the payoff is really noticeable. — Jon Bently and M. Douglas McIlroy, both computer scientists at Bell Labs
表现的关键是精美和典雅的,并不是使用大量的特殊案例。对于任何调整的冲动都应该是被限制的,除非其回报真的是值得注意的。– Jon Bently and M. Douglas McIlroy, 二者都是贝尔试验实的计算机科学家
The last good thing written in C was Franz Schubert’s Symphony Number 9. — Erwin Dieterich, programmer
最后一件用C做的好作品就是弗朗茨.舒伯特的C大调第9交响曲 — Erwin Dieterich, programmer程序员
The problem with using C++ … is that there’s already a strong tendency in the language to require you to know everything before you can do anything. — Larry Wall, developer of the Perl language
使用C++最大的问题是..在C++语言里,存在这一种很强的趋势,就是如果你不明白C++语言的细节,你就无法做好任何事情。– Larry Wall, developer of the Perl language
The sooner you start to code, the longer the program will take. — Roy Carlson, University of Wisconsin
你越早开始都手编码,你所花费来编程的时间就越长 — Roy Carlson, University of Wisconsin
The value of a prototype is in the education it gives you, not in the code itself. — Alan Cooper, software author, from The Inmates are Running the Asylum
原型的价值在于他给你的教训,而不是代码自身 — Alan Cooper, software author, from The Inmates are Running the Asylum
There are only two kinds of programming languages: those people always bitch about and those nobody uses. — Bjarne Stroustrup
世界上只有两类编程语言:人们都抱怨的语言和从来没有人使用的语言 — Bjarne Stroustrup
There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies. — Charles Antony Richard Hoare
世界上有两个设计软件的方法,一种方法是设计的尽量简单,以至于明显的没有什么缺陷,另外一种方式是使他尽量的复杂,以至于其缺陷不那么明显。
Ugly programs are like ugly suspension bridges: they’re much more liable to collapse than pretty ones, because the way humans (especially engineer-humans) perceive beauty is intimately related to our ability to process and understand complexity. A language that makes it hard to write elegant code makes it hard to write good code. — Eric S. Raymond
丑陋的程序就像一座丑陋的吊桥:他们相比漂亮的良好的吊桥起来,更有可能会坍塌,这是因为人类(尤其是工程师)感知漂亮的东西是和我们处理和理解复杂问题的能力相关的。所以,一个程序语言如果很难以优雅地方式编程,那么其就很难写出好的代码。
Weeks of programming can save you hours of planning. — unknown
多做几周的编程可以节省你做计划的时间 —— 匿名 (意思为,只有实践过了,你才更容易做计划,没有实践过,做起计划来将会很头痛)
When a programming language is created that allows programmers to program in simple English, it will be discovered that programmers cannot speak English. — unknown
当程序语言被设计成允许程序以很简单的英语来编程的时候,人们将会发现编写程序的程序员都来自不会说英语的地方。 –匿名
(全文完,翻译水平有限,如果有误,还请批评指正!)
(转载本站文章请注明作者和出处 酷 壳 – CoolShell ,请勿用于任何商业用途)
《最佳编程语录》的相关评论
Weeks of programming can save you hours of planning. 这其实是个反语. 意为数个小时的准备能抵得上几个星期的编程工作. planning显然比programming更重要. 而非”成周的编程可以节省你计划的时间”. 最喜欢的是这个:“A good programmer is someone who looks both ways before crossing a one-way street.”
Managing programmers is like herding cats. — 这句话是Barbara Moo 在管理Foundation项目时 说过的
Good code is its own best documentation. As you’re about to add a comment, ask yourself, ‘How can I improve the code so that this comment isn’t needed?’ Improve the code and then document it to make it even clearer. — Steve McConnell, software engineer and author, from Code Complete
第一句翻译的似乎有点不妥。应该是:好的代码其本身就是最好的文档。
谢谢指正,修改了
很喜欢这篇 但翻译的问题有点大
然后把“Baghdad”(巴克达)当成这个函数的参数。
Orz….
个人理解:
“The sooner you start to code, the longer the program will take. — Roy Carlson, University of Wisconsin”
编得越早,跑得越慢
“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. — Tom Cargill, object-oriented programming expert at Bell Labs” 最初写的 90% 的代码要耗 90% 的时间来开发,还有 10% 的代码要为前 90% 的开发时间负责。(完善工作很重要;行百里者半九十)
—->>你越早开始着(都)手编码,你所花费来编程的时间就越长 — Roy Carlson, University of Wisconsin
—->>black art翻译成妖术似乎不妥,隐含有魔力的意思
代码应该是写给其他人来读的,而能让机器运行的仅仅是附带着的
—->>代码的目的是给人阅读的,只是顺便能让机器运行而已.
—->>好的代码都都在的批评声中写成的,而差的则是在表扬(杨)声中写成的。
—->>If it was hard to write, it should be hard to understand.应该是如果注释很难写,那么也会很难懂.这里it指代”注释”而非代码
Hey! It compiles! Ship it!
这个怎么解释呢
“The last good thing written in C was Franz Schubert’s Symphony Number 9.”
用C永远写不出弗朗茨.舒伯特的C大调第9交响曲。这样貌似要好理解些。
最后一件用C做的好作品就是弗朗茨.舒伯特的C大调第9交响曲,哈哈笑死我了
@dummytaurus
我觉得作者的翻译反映了原话的幽默感。
>Given enough eyeballs, all bugs are shallow
>只要给于足够的重视,所有的bug浮现出来
Linus定律
http://zh.wikipedia.org/zh-cn/%E6%9E%97%E7%BA%B3%E6%96%AF%E5%AE%9A%E5%BE%8B
我觉得“enough eyeballs”跟维基百科翻译成“足够多的眼睛”好点,因为后面那个长句就是解释这个短句。足够过的人去测试(开发模式),而不是重视(态度)。
谢谢指正,已做修改
@sparklo you are right
@Neo Weeks of programming can save you hours of planning. 几周的编程可以帮助你节省几小时的规划。 你翻译反了
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg. — Bjarne Stroustrup, developer of the C++ programming language
C很容易使你搬起石头砸自己的脚,C++却很难砸到自己的脚,但是一旦不幸砸到了,那么你的整条腿都会被炸飞
-Bjarne Stroustrup, C++语言的发明者
More good code has been written in languages denounced as bad than in languages proclaimed wonderful — much more. — Bjarne Stroustrup, from The Design and Evolution of C++
应翻译成:
用所谓糟语言写成的代码比用所谓好语言写成的代码多。
(句中的 languages 是 programming languages 之意,不是指人类语言)
Weeks of programming can save you hours of planning. — unknown
是反语,正过来说就是: 少了几小时的计划,多了几周的编程。
>>Edsger Dijkstra, 计算机科学家,著名的“程序=数据结构+算法”的提出者。
Edsger Dijkstra的确是著名的计算机科学家。但是是Niklaus Wirth提出“程序=数据结构+算法”。参见:http://en.wikipedia.org/wiki/Niklaus_Wirth
多谢指正,已经更新了
O(∩_∩)O哈哈哈~
“修复bug很容易,但是定位bug却很困难。”
经典啊,所以测试手段是如此重要又如此棘手的事情啊。
Weeks of programming can save you hours of planning. — unknown
我觉得应该是 做好计划可以节省你几周的编程时间,作者故意反着说的,
Hours of planning can save you weeks of programming.
More good code has been written in languages denounced as bad than in languages proclaimed wonderful — much more. — Bjarne Stroustrup, from The Design and Evolution of C++
好的代码都都在的批评声中写成的,而差的则是在表杨声中写成的。——Bjarne Stroustrup, 摘自《The Design and Evolution of C++》
==>
更多的优秀代码是用被认为很烂的语言写成的,而不是用那些被说的好的不得了的语言。
这个是C++的作者在回应其他人对C++语言的批评。
感觉第一个翻译的有点糙,不够雅致。
太喜欢你的博客了。
不错
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. — Tom Cargill, object-oriented programming expert at Bell Labs
开始的90%的代码用了90%的开发时间,而剩下的最后的10%的代码会需要另外90%的开发时间。– Tom Cargill,贝尔实验室的面向对象编程专家。
第二个百分比应该是10%吧
开始的90%的代码用了10%的开发时间,而剩下的最后的10%的代码会需要另外90%的开发时间。– Tom Cargill,贝尔实验室的面向对象编程专家。
也许只是从名人嘴里说出来的原因,不过都是经典啊
这个就是我的一大弊病了
学习了,这个blog要常来逛逛!
The sooner you start to code, the longer the program will take. — Roy Carlson, University of Wisconsin
===========================================
这是不可能的。事实上你考虑得多了,就永远不可能完成编码。
是不是这个文章拿“unknow”的语录做反面教材啊?怎么看上去有点。。。。