Fork me on GitHub

9/06/2010

[轉] 程式設計語錄

一個好的程式設計師,就是那種就算只是要穿越單行道,也會看看兩邊再走的人。
A good programmer is someone who looks both ways before crossing a one-way street.
-- 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, 計算機科學家


抽象化和和模糊化是完全不同的…抽象的目的不是去模糊它,而是建立一種新的、能夠絕對精確的語意層。
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


除了數學外,精通母語也是一個勝任程式設計師的重要資產。
Besides a mathematical inclination, an exceptionally good mastery of one's native tongue is the most vital asset of a competent programmer.
-- Edsger Dijkstra


C 讓你很容易搬石頭砸自己的腳;C++ 雖然比較不容易做到,但是如果做到的話,你可能會打爛整隻腳。
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, C++ 程式語言開發者

大部分的錯誤都可以簡單地修正,困難在於如何找到問題所在。
Commentary: most debugging problems are fixed easily; identifying the location of the problem is hard.
-- 不知道是誰


考慮到目前我們電腦程式的悲慘狀況,軟體開發顯然還是門魔法,還不能稱他為一個工程學科。
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, 美國前總統


有很長一段時間,我一直很困擾,為什麼有的東西如此地昂貴、如此前瞻、卻也如此沒用。
同時我也發現,電腦是一個很笨的機器,但是他卻可以做到難以置信的聰明事;而程式設計師是聰明的人,卻始終做些難以置信的蠢事。簡而言之,他們是絕配。
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


只要有足夠的眼睛,就可以讓所有的 Bug 浮現(也就是,有足夠多的測試者和開發者,幾乎所有的問題都可以很快地發現、並且被修正)
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


良好的程式碼是自己最好的文件。
當你打算加上註解的時候,先問問自己:「我要如何改善才能讓這段程式碼不需要註解?」
改善自己的程式碼、然後再註解,這樣可以讓他更清楚。
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》


嘿!編譯過了!可以出貨了!
Hey! It compiles! Ship it!
-- 不知道是誰


在每個寫得很好的大程式裡,都是寫得很好的小程式。
Inside every well-written large program is a well-written small program.
-- 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, 電腦科學家


管理程式設計師就像放養貓一樣。
Managing programmers is like herding cats.
-- 不知道是誰


用程式碼行數來衡量進度,就像用重量來評估飛機的建造進度一樣。
Measuring programming progress by lines of code is like measuring aircraft building progress by weight.
-- Bill Gates, 微軟共同創辦人


用那些被批評成很差的語言所寫的好程式,遠比用那些宣稱美妙的語言來的多。
More good code has been written in languages denounced as bad than in languages proclaimed wonderful -- much more.
-- 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 和 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.
-- 不知道是誰


簡單是可靠性的前提。
Simplicity is prerequisite for reliability.
-- Edsger Dijkstra


C 程式語言--這是一種結合了組合語言的靈活性和組合語言的強大能力的語言。
The C programming language -- a language which combines the flexibility of assembly language with the power of assembly language.
-- 不知道是誰


前 90% 的程式碼用了 90% 的開發時間,但是剩下的 10% 還需要另外 90% 的開發時間。
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, 貝爾實驗室的物件導向程式專家


很重要的一點:加入一個功能的成本不是只有為了這項功能寫程式所花的時間,還要包含他對以後擴展造成阻礙。當然,只要有足夠的時間,所有要求的功能是都能被實作出來的;但是隨著這些功能出現的,通常會是一個脆弱的程式庫,脆弱到就算只是一個應該是極度簡單的新想法,都需要越來越長的時間和已經存在的網路糾纏。處理的秘訣就是只挑選那些不會和其他功能打架的功能。
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, 電腦遊戲程式設計師


效能的關鍵在於簡潔,而不是大量的特例。除非成效非常顯著,不然應該忍住去微調它的衝動。
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 和 M. Douglas McIlroy, 貝爾實驗室的電腦科學家


最後一個用 C 寫出來的好作品,是法蘭茲‧舒伯特的第九號交響曲。(C 大調…)
The last good thing written in C was Franz Schubert's Symphony Number 9.
-- Erwin Dieterich, 程式設計師


使用 C++ 的問題在於他的語言中有很強烈的傾向,你必須要在你做任何事之前知道所有事情。
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, Perl 語言的開發者


越早開始寫程式,程式寫得越久。
The sooner you start to code, the longer the program will take.
-- Roy Carlson, University of Wisconsin


原型的價值在於它對你的教育,而不是程式碼本身。
The value of a prototype is in the education it gives you, not in the code itself.
-- Alan Cooper, 《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


有兩種設計軟體的方法:一種是讓它簡單到明顯地沒有缺陷,另一種則是讓它複雜到沒有明顯的缺陷。
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.
-- 不知道是誰


如果創造了一種程式語言,可以讓程式設計師用簡單的英文來寫的話,那你會發現程式設計師不會講英文。
When a programming language is created that allows programmers to program in simple English, it will be discovered that programmers cannot speak English.

出處:http://heresy.spaces.live.com/blog/cns!E0070FB8ECF9015F!11414.entry

......

No comments:

Post a Comment