以前本站發布過《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
當程序語言被設計成允許程序以很簡單的英語來編程的時候,人們將會發現編寫程序的程序員都來自不會說英語的地方。 –匿名