2017/6/26

The Ten Commandments of Egoless Programming


無我編程的十條戒律,最早出現在由Gerald Weinberg於1971年出版的經典著作《程序開發心理學》裡。這十條準則,除了告訴 programmer 要鍛鍊自己的人格修養之外,更多的是提醒大家,要擺脫 geek的形象,走入社會及人群。


  1. Understand and accept that you will make mistakes. The point is to find them early, before they make it into production. Fortunately, except for the few of us developing rocket guidance software at JPL, mistakes are rarely fatal in our industry, so we can, and should, learn, laugh, and move on.


    接受自己會犯錯的事實。關鍵是要在錯誤進入到生產環境之前把它們找出來。所幸的是,除了小部分在噴氣推進實驗室裡開發火箭制導系統的程序員,大部分錯誤都不會造成致命的後果。所以,我們一定能夠而且也應該要學會嫣然一笑,然後繼續。

  2. You are not your code. Remember that the entire point of a review is to find problems, and problems will be found. Don't take it personally when one is uncovered.


    不要使用代碼來針對個人。要記住,代碼評審的目的是為了找出問題,而且總歸會找到問題。如果真的找到了問題,請不要把它作為針對個人的藉口。

  3. No matter how much "karate" you know, someone else will always know more. Such an individual can teach you some new moves if you ask. Seek and accept input from others, especially when you think it's not needed.


    不管你知道多少“秘籍”,總有人比你知道得更多。如果你開口,他們就會教你更多的東西。在你認為沒有必要的時候,學會接受他人的建議。

  4. Don't rewrite code without consultation. There's a fine line between "fixing code" and "rewriting code." Know the difference, and pursue stylistic changes within the framework of a code review, not as a lone enforcer.


    不要不經討論地重寫代碼。“修復代碼”與“重寫代碼”是有明顯的區別的。瞭解這些區別,並在代碼評審的框架之內進行程式化的變更,而不是單獨作戰。

  5. Treat people who know less than you with respect, deference, and patience. Nontechnical people who deal with developers on a regular basis almost universally hold the opinion that we are prima donnas at best and crybabies at worst. Don't reinforce this stereotype with anger and impatience.


    尊重比你懂得少的人,並對他們抱以耐心。與技術人員打交道的非技術人員認為技術人員要麼是妄自尊大的討厭鬼,要麼是愛撂挑子的倔驢。所以,我們不要用我們的憤怒和不耐煩去加深他們對我們的這種印象。

  6. The only constant in the world is change. Be open to it and accept it with a smile. Look at each change to your requirements, platform, or tool as a new challenge, not as some serious inconvenience to be fought.


    這個世界唯一不變的就是變化。敞開胸懷,面帶微笑地去擁抱變化。把每一個需求變更、平台變更或工具變更都看成是一個新的挑戰,而不是令人厭惡的麻煩。

  7. The only true authority stems from knowledge, not from position. Knowledge engenders authority, and authority engenders respect – so if you want respect in an egoless environment, cultivate knowledge.


    真正的權威來自於知識,而不是職位。知識造就了權威,而權威會迎來尊重。如果你想要在一個無我的環境裡得到尊重,那麼充實你的知識吧。

  8. Fight for what you believe, but gracefully accept defeat. Understand that sometimes your ideas will be overruled. Even if you do turn out to be right, don't take revenge or say, "I told you so" more than a few times at most, and don't make your dearly departed idea a martyr or rallying cry.


    堅定你的立場,優雅地接受挑戰。要知道,你的想法有時候會遭到反對。你可以證明自己是對的,但不要試圖報復,不要總是叫嚷著“我早就說過”,不要把被否定的想法看成是一個犧牲品或者某種戰鬥口號。

  9. Don't be "the guy in the room." Don't be the guy coding in the dark office emerging only to buy cola. The guy in the room is out of touch, out of sight, and out of control and has no place in an open, collaborative environment.


    不要成為“小黑屋裡的人”。不要躲在小黑屋裡寫代碼,就算偶爾露個面,也只是為了買一杯可樂。躲在小黑屋裡只會讓你與其他人失去聯繫,淡出他們的視野,失去控制。在一個開放的協作環境裡,你會找不到自己的位置。

  10. Critique code instead of people – be kind to the coder, not to the code. As much as possible, make all of your comments positive and oriented to improving the code. Relate comments to local standards, program specs, increased performance, etc.


    批評代碼,而不是人。對人好一點,而不是代碼。讓你所有的評審為代碼帶來積極的改進,把你的評審與局部標準、程序規範和更好的性能結合在一起。


References


無我編程的十條戒律


The Ten Commandments of Egoless Programming

沒有留言:

張貼留言