I remember reading an article that an average programmer spends 90% of the working time for debugging, and 10% for actual development. Even though the number itself may not be correct for everyone, I think the idea itself makes sense.
Then how about the开发者_如何转开发 idea of DDE - Development for Debugging Easiness? In order to do sthat, I think of the following procedures and tools.
- UNIT Test, and xUNIT tools for testing function level.
- Assert for input checking, and assert related functions for checking input parameters
- Logging values, and logger functions for enabling the trace of the problem origin
What else do you have? What procedures and tools can be used to reveal the bug itself effectively and efficiently?
Unit tests help you develop code with fewer bugs but I don't think they really help in debugging code or help isolate a problem in production.
Asserts generally help you to make sure certain conditions are satisfied before doing any further business logic.
Logging is only functionality mentioned above which really helps in isolating the problem when in production and to give some clues about what might went wrong. Also it is purely upto the developer to use logger methods in critical/crucial steps in the application process and is very helpful in isolating the problems.
Being that said, when in development stages it's very important that your IDE supports the debugging and it should be very intuitive. But when going to production, very occasionally, you may have a chance to attach the debugger to running production environment to debug for specific case. In those cases only developer log information is to the rescue.
精彩评论