学习,提高debug技能

http://www.javaworld.com/community/node/2927
Learning and Improving Your Debugging Skills
Programmers spend a high percentage of the time debugging rather than writing code.
程序员花在调试的时间比写代码的时间还多。
You probably had some training in learning a language or framework--but how did you learn to fix the defects in your software?
可能会有人培训如何使用一个框架,但是却很少培训如何调试。
....省略很多字
   1. Be disciplined. Debugging is a process, said one developer, not a series of random events. Don't randomly tweak knobs; follow the code's execution process. Just like fixing a lawnmower, he said. Does part A get the input it needs? How about the output? If that's OK, move on.
有条理的,像割草工人一样....
   2. To improve your skills, debug other people's code rather than your own. It will be easier to see the faults in the other person's assumptions than it is to see your own. You might do this as part of a cross-peer code review and cross-peer debugging. You will develop the ability to recognize the common causes of defects more quickly, promised one developer, and teach you to recognize (and abandon) your own bad development practices.
调试别人的代码....
   3. Pretend you're the compiler. Find and correct as many errors as you can before pressing the Compile button. While most modern IDEs include integrated debuggers (like Visual Studio's Intellisense), you'll learn less from their automation than you will from consciously examining the process. (The same way you'll never learn to spell correctly by relying on a spell checker to do all the work.)
装成编译器的样子,在按下编译的时候多有意识去找出一些错误.....
   4. Learn to fix bugs as early in the development process as you can. That might mean something formalized, such as test-driven development. That also means devoting time to debugging your design instead of barreling into coding.
学习尽可能早的修复bug.... tdd....多花时间设计,别奋不顾身的跳进代码..()
   5. Debugging is easiest when you can hold the whole system in your head. Don't make the mistake of focusing in on only one part of an application. Pay attention to the interrelationships between modules. Read the code at multiple levels of abstraction, advised one programmer. "Finding the bug is the hardest part, and it takes clear understanding of what multiple pieces of the code are doing," she said.
hold the whole system ,很重要,让debug变得更简单。
   6. Part of the same bit of advice, I think, is someone else's suggestion: gain a good understanding of the system one level down from what you are working on. "If you are debugging a system level C program, it helps to know some assembly and something about the OS," explained a system software lead engineer. "If you are debugging a J2EE app, it helps to know something about Java threads, RMI and GC." In many cases, he pointed out, error messages come from that one-level-down. "If you can understand what that means, it will help you figure out what is going wrong at your level of abstraction," he explained.
多了解地下一层。写C的,可以多了解点操作系统级,写Java可以多了解点虚拟机级别。用Java高级框架,就了解点Java,比如struts的,就了解点servlet,jsp等等。

你可能感兴趣的:(学习,提高debug技能)