高效程序开发人员应该有的7个习惯
Saturday September 8, 2007Sun Microsystems亚太区的工程师Lee Chuk Munn写了一篇不错的小文,介绍一个高效程序开发人员的应该有的 7个习惯
1. 明白问题
2. 使用合适的工具
3. 保持简单,简易
4. 保持代码整洁
5. 学习调试
6. 借鉴他人
7. 持续学习
Keep it clean, and keep it simple–that is the maxim software developers should adhere to.
- Understand the problem
- Use appropriate tools
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.
- Strive for simplicity
Programmers should develop applications that are:
- Easy to understand;
- Easy to explain;
- Easy to maintain;
- and Easy to document.
- Keep your code clear
- Learn to debug
- Leverage what is available
- Continue to learn
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”.
Developers should also look for solutions or algorithms that are already publicly available, such as those highlighted in developer forums and mailing lists.
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 qu
