這些編程警句摘自《C語言程序設計——現代方法》。而此書的又是從Alan J. Perlis的《Epigrams On Programming》中摘錄,並且這些警句來自1982年。html
此書每章首摘錄一句,一共26句。ios
若是有人說「我想要一種語言,只需對它說我要幹什麼就行」,給他一支棒棒糖好了。程序員
When someone says "I want a programming language in which I need only say what I wish done," give him a lollipop.
這讓我想起prolog邏輯式語言,同時想起王垠的Prolog與人工智能的沒落。sql
某我的的常量多是其餘人的變量。編程
One man's constant is another man's variable.
在探索難以實現的問題時,簡化是惟一的辦法。數據結構
人不是經過用計算器學會的計算,但倒是靠此手段忘記了算術。nosql
One does not learn computing by using a hand calculator, but one can forget arithmetic.
不該用以聰明才智和邏輯分析能力來評判程序員,而要看其分析問題的全面性。編程語言
是否是應該討論下招聘及KPI? :P模塊化
不值得編寫沒有循環和結構化變量的程序。函數
A program without a loop and a structured variable isn't worth writing.
請別搞錯:計算機處理的是數而不是符號。咱們用對活動算術化的程序來衡量咱們的理解力(和控制力)。
Make no mistake about it: Computers process numbers - not symbols. We measure our understanding (and control) by the extent to which we can arithmetize an activity.
若是程序操縱着大量的數據,那它必定是用較少的方法辦到的。
If a program manipulates a large amount of data, it does so in a small number of ways.
想到如今的大數據。雖然,我尚未接觸Hadoop。
若是你有一個帶了10個參數的過程,那麼你極可能還遺漏了一些參數。
If you have a procedure with 10 parameters, you probably missed some.
正如羅傑斯可能會說的那樣:「沒有像自由變量這樣的東西。」
As Will Rogers would have said, "There is no such thing as a free variable."
who's 羅傑斯?
我忘記了第十一條戒律是「你應該計算」,仍是「你不該該計算」。
The 11th commandment was "Thou Shalt Compute" or "Thou Shalt Not Compute" - I forget which.
優化阻礙發展。
Optimization hinders evolution.
很難從字符串中找到感受,但它們倒是咱們能期望的惟一交流紐帶。
It's difficult to extract sense from strings, but they're the only communication coin we can count on.
在程序裏咱們始終有話要說,可是全部已知的語言都沒法表達得很好。
There will always be things we wish to say in our programs that in all known languages can only be said poorly.
很難找到正確的時間單位來衡量計算機的發展。有些大教堂用了一個世紀才建成。你能想象一個壯麗輝煌的大程序也能花這麼長的時間嗎?
Around computers it is difficult to find the correct unit of time to measure progress. Some cathedrals took a century to complete. Can you imagine the grandeur and scope of a program that would take as long?
函數延遲綁定:數據結構致使綁定。記住:在編程過程後期再結構化數據。
Functions delay binding: data structures induce binding. Moral: Structure data late in the programming process.
人們只會在腦海顯示覆雜的信息。好比看,靜景不管多麼生動,都不如景色的運動、流動和改變重要。
One can only display complex information in the mind. Like seeing, movement or flow or alteration of view is more important than the static picture, no matter how lovely.
讓一些事情可變很容易,而掌控不變的期限則須要技巧。
只要有模塊化就有可能發生誤解:隱藏信息意味着須要檢查溝通。
Wherever there is modularity there is the potential for misunderstanding: Hiding information implies a need to check communication.
當程序要求關注不相干的內容時,所用的編程語言就是低級的。
A programming language is low level when its programs require attention to the irrelevant.
每一個程序都是某些其餘程序的一部分,但不多是正合適的。
Every program is a part of some other program and rarely fits.
在人機共生的世界中,必須調整的是人:機器是沒法調整的。
In man-machine symbiosis, it is man who must adjust: The machines can't.
與計算機過長時間的接觸把數學家變成了書記員,反之亦然。
Prolonged contact with the computer turns mathematicians into clerks and vice versa.
編寫無錯程序的方法有兩種:但只有用第三種方法寫的程序才行得通。
Every program has (at least) two purposes: the one for which it was written and another for which it wasn't.
哈,意指不可能寫出無錯的程序。
若是您的計算機說英語,那麼它可能產自日本。
If your computer speaks English it was probably made in Japan.
肯定程序參數的應用是用戶,而不該該是它們的創造者。
It is the user who should parameterize procedures, not their creators.
這讓我想到TDD。嚴格的測試驅動會強迫你既是代碼的創造者,同時也是使用者。
關於C語言的書。你們都知道K&R的那本《C語言程序設計》,我也在裏奇過世的時候買了一本,我看完了,可是對如何將C應用到實際項目中,沒有指導做用。後來,我又找到了《C語言程序設計——現代方法》。我只能說與「現代方法」比起來,K&R那本只能用來作收藏。
「現代方法」,對「K&R」也有所評論:隨着C語言的迅速普及,一系列問題也接踵而至。編寫新的C語言編譯器的程序員們都把「K&R」做爲參考。可是遺憾的是,「K&R」對一些語言特性的描述很是模糊,以致於編譯器經常會對這些特徵進行不一樣的處理。並且,「K&R」也沒有屬於C語言的特性和屬於UNIX系統的內容進行明確的區分。況且在「K&R」出版之後,C語言仍在不斷變化,增長了新特性而且去除了少許過期的特性。
關於編程警句,原文一共有130句,惋惜,我英語水平不足以翻譯得好,期待牛人編譯。