星期四, 2月 03, 2011

Don't shave that yak - God loves lazy programmers

Don't shave that yak - God loves lazy programmers (Google 翻譯)
不刮鬍子的犛牛 - 神愛懶惰的程序員
照片由Liminal Mike

The Lesson

Yak shaving is a term I first ran across in the Jargon File, and it stuck in my head because it's so common and so dangerous in programming. It's when you're working on a task because you need to do it to get something else done, which you're doing to complete another job, and so on up a long dependency chain towards your real goal. This happens a lot when you're coding, and just like my story each step is very logical but you ultimately end up wasting massive amounts of time on something that has very little effect on what you really want to do.

犛牛剃須是一個術語,我第一次碰到的行話文件,它停留在我的頭上,因為它是如此普遍,如此危險的節目。這是當你工作在一個任務,因為你需要做它得到別的東西做,你正在做的另一份工作來完成,等了一個長長依賴鏈朝著自己的真正目標。這種情況發生了很多當你編碼,和我的故事,就像每一步非常合乎邏輯的,但你最終結束浪費大量時間的東西已經很少對自己真正想做的事情。

I swear that the biggest reason I'm a more effective programmer now than when I was 20 is that I'm better at spotting when I'm shaving a yak, and finding another way. The biggest clue is when I'm working too hard. I went into a serious deep dive for the last few days, staying up late, skipping dog walks and getting way behind on my emails (sorry to anyone waiting for a reply!). If I'm making progress on something core this sort of crunch time is actually an energizing process as long as I don't keep it up too long. In this case I was feeling frustrated, and looking back it was largely because it was a peripheral task that at some level I knew didn't have to be solved.

我發誓,最大的原因,我是一個更有效的程序員現在比我20歲的時候,是我比較好地察覺時,我剃犛牛,並尋找另一種方式。最大的線索是,當我工作太辛苦。我走進一個嚴重的深潛在過去幾天裡,熬夜,跳繩的狗散步,越來越方式落後於我的電子郵件(對不起任何人等待答复!)。如果我在進步核心的東西這類的關鍵時刻實際上是一個充滿活力的過程,只要我不繼續下去的時間太長。在這種情況下,我感到沮喪,回想起來,這主要是因為它是一個周邊的任務,在一定程度上,我知道沒有得到解決。

There's already lots of other reasons to embrace lazy programming. Fewer lines of code means fewer bugs. The best route to an easy life is writing solid code that doesn't require constant maintenance, and is documented enough so people don't bug you with questions. Harness your inner laziness to spot yak shaving too, and find a simpler way when you're spinning your wheels on a peripheral task.

還有很多其他原因已經擁抱懶惰編程。少數幾行代碼意味著更少的錯誤。的最佳途徑安逸的生活是寫作堅實的代碼,不需要經常維護,並記錄足以使人們不打擾你了疑問。要控制你內心的懶惰也被發現犛牛剃須,並找到一個簡單的方法,當你旋轉你的輪子外圍的任務。