Sun Microsystems亞太區的工程師Lee Chuk Munn寫(xiě)了一篇不錯的小文,介紹一個(gè)高效程序開(kāi)發(fā)人員的應該有的7個(gè)習慣:
For instance, Lee said, there are different algorithms engineers can use to write a sorting program.
To select the right one to use, developers need to first understand the size of the data–that the sorting program will be administered on–in order to decide which is the right algorithm to use. "Choosing the wrong one would put your application in jeopardy in future," he said.
Quoting American psychologist Abraham Maslow, Lee read: "If the only tool you have is a hammer, you will see every problem as a nail."
This Maslow concept has become so popular among software developers that it has been dubbed the "Golden Hammer" rule, which cautions engineers with limited knowledge or training of solutions that they run the risk of using only tools they are familiar with, but that may not be the most appropriate, when they develop a new program.
Programmers should develop applications that are:
Easy to understand; Easy to explain; Easy to maintain; andEasy to document.
Lee said: "Put yourself as an author, how would you write something that others can easily understand and follow your thoughts? That’s how a programmer should code as well."
"Sometimes, there are bugs in your codes, or in other [software] libraries that you may have bought or downloaded that you cannot control," Lee said, underscoring the need for developers to "test early, test often".
Can developers then balance the commercial need to push out applications as quickly as possible, with the need to write codes that are clean?
Lee believes they can. "A lot of people say if they don’t have quantity time, at least they have quality. That’s not true… You can’t have quality time if you don’t put in quantity time," he said. "There’s commercialization [in software development] but there’s also ‘art’ and ‘good’ codes. And you can achieve both."
如何成為一個(gè)高效的程序員,我覺(jué)得這是每個(gè)開(kāi)發(fā)者應該去思考一下的問(wèn)題。聰明不等于高效。在我看來(lái),所謂的高效是能夠快速適應問(wèn)題領(lǐng)域,分析面對的問(wèn)題,最后快速找到解決方案。在這個(gè)過(guò)程中,很多品質(zhì)(Lee Chuk Munn把他叫習慣)決定了是否高效。比如KISS(Keep it simple,keep it stupid)原則,在一個(gè)team中,如果大家都一致認同這個(gè)原則,并在產(chǎn)品設計,需求分析甚至編碼的時(shí)候時(shí)刻提醒自己,那么在brainstorm的時(shí)候,很容易達到一致或者可以很快明確當前的主要TODO是什么。相反的,如果有人忽略了KISS,那么很容易糾纏于細節,導致最后的討論失去主方向。請記?。?strong>把一個(gè)系統設計的復雜要比簡(jiǎn)單來(lái)的容易得多。
我很喜歡Lee關(guān)于寫(xiě)代碼的比喻 —— 編寫(xiě)應用程序,就像你再寫(xiě)一本書(shū)。寫(xiě)書(shū)的時(shí)候你應該盡量保持結構清晰并且讓你的讀者不會(huì )覺(jué)得很晦澀。如果寫(xiě)書(shū)人能夠嘗試用40%的時(shí)間站在讀者的角度去思考問(wèn)題,我覺(jué)得這種書(shū)成為暢銷(xiāo)書(shū)的可能性很大。
聯(lián)系客服