Error Handling and Debugging
- Comment, comment, comment. Put a lot of comments in your program. They tell other programmers what you did. They also tell you what you did.
- Use a single macro to define a constant value that is or may be reused so that we only have to change it in one place.
- Use the "KISS" principle. (Keep It Simple, Stupid.) Clear and simple is better than complex and wonderful.
- Use the "DRY" principle.(Don't repeat youself.) Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
- keep in mind "The Law of Least Astonishment," which states that your program should behave in a way that least astonishes the user.
- Turn on all the warning flags, then make your program warning free.
- Baby steps for the engineer: test the code every 20 to 50 lines
- Regression testing: running the same old tests on new pieces of code
- Never assume anything. Never assume that the tools are working flawlessly. Never assume that the hardware is good.
- Never changing more than one thing at a time
- Write a few notes about what change was made and what behavior was observed
- provide feedback to the engineer or engineering group that introduced the bug.