Practical Programming Tips
128 Ways to Enhance Your Software Development Skills
Table of Contents
3 Developer's Toolbox
4 Developer's Tips
Extended Table of Contents
3 Developer's Toolbox
3.1 Software Tools
- File comparison tool
- File/text search tool
- Documentation generator
- Version control tool
- Modeling tool
- Bug tracking system
- Make tool
- Memory leak detection tool
- Integrated development environment (IDE)
- Simulation tool
- File compression tool
- Installation tool
- FTP tool
- Remote system control
- Packet sniffer / Protocol analyzer
3.2 Hardware Tools
4 Developer's Tips
4.1 General Tips
- Know the 80/20 rule
- Assume problems will happen
- Get feedback to your work
- Consult other people
- Free development bottlenecks
- Start development ASAP
- Be in shape
- Be updated with new technological developments
- Avoid working overtime
- Iterative development process
- Constant improvement development process
- Avoid skipping development stages
- Avoid switching development tasks
- Don't compromise on work quality
4.2 Specification Tips
4.3 Design Tips
- Write design document
- Free design bottlenecks
- Use object oriented design
- Estimate work schedule
- Find the difference between what you need and what you have
- Don't re-invent the wheel - reuse existing modules
- Use design patterns
- Simulate complex algorithms
- Do esthetic work
- Design scalable system
- Define the interface first
4.4 Implementation Tips
- Use examples from documentation
- Use examples from code
- Write comments before writing code
- Divide complicated task to several simple tasks
- If the task is complicated - implement simpler task
- Don't optimize before it works
- Use lookup table for fast calculations
- Use loop unrolling to speedup execution
- Use inline/macro to speedup execution
- Use shifts for fast division / multiplication.
- Use structured programming
- Use coding conventions/rules
- Don't ignore compiler's warnings
- Advance slowly on unknown ground
- Compile during coding
- Remark old code before deleting or changing it
- Backup your work frequently
- Avoid unnecessary inside loop calculations
- Write remarks as higher level abstraction of code
- Write pseudo code remarks
- Write directive remarks (!!!)
- Write questions remarks (???)
- Mark code to be deleted (xxx)
- Avoid unnecessary remarks
- Round integer result by adding 0.5 bit
- Make a minimal working skeleton of the module
- Prefer enums instead of #define
- Redefine data types for multi platform compatibility.
- Avoid recursion with limited memory.
- Pass big objects by reference.
- Reuse code only when it helps.
- Prevent header files from been included several times
4.5 Debugging Tips
- Problem handling stages
- Find the changes from previous version.
- Review the code.
- Read error description in the manual
- Add an error to the code when checking compilation problem.
- Fix compilation errors by the order they appear
- Use assertions.
- Write validity checks of parameters.
- Check if the problem occurs with previous versions
- Check the platform
- Check if the problem occurs with similar platforms.
- Check if the problem is consistent or random.
- Remark suspected parts of the code and see if problem disappeared.
- Use debugger.
- Build in debug mode.
- Undo recent changes until problem disappears.
- Use binary search to find the problem. (lion in the desert).
- Trial and error. (try several ways and choose the one that works the best)
- Use scope to probe output signal (embedded).
- Consult customer support
- Search internet forums and resources
- Use debug variables.
- Use debug prints
- Check that the source/object/executable files are updated.
- Check the version number. (that you are working with the right version)
- Check that the problem really exist. (bad testing method)
- Use conditional compilation of debug code. (#ifdef DEBUG #endif)
- Rewrite the code
- Common bug: array index / pointer overflow.
- Common bug: casting error in calculation ((float)(a+0.5) - when a int)
- Common bug: if( a=b ) -> (overwrite a)
- Common bug: for(i=0; i<10; j++)
- Common bug: use of local variables instead of dynamic allocation.
- Common bug: cyclic include dependencies.
- Check the compiled asm file (advanced programming)
- Check the map file
- Check memory leaks
- Find a workaround the problem.
- Compare memory section images (good operation vs bad - file compare diff)
- Add conditional breakpoints and prints (if( xxx ) a=a messagebox() )
- Rebuild all
- Fix bugs immediately (stable system / might be related to the bug)
- When problem is not consistent, try to make the problem happen more frequently (increase the suspected problem factors)
- Link error: missing library / missing file in project
4.6 Test Tips
4.7 Release Tips
4.8 Tools Tips
- Optimize your computer
- Use surge protector or UPS
- Avoid using version 1.0.0
- Use the shortcut keys
- Use "Find in Files" button
- Use "Go to Definition" button
- Use automatic statement completion
- Backup your work regularly
- Cancel text smoothing in Adobe Reader
- Set Windows Display Properties
- Prefer to buy the tools that you need
- Avoid using replace all
4.9 Documentation Tips
- Document your status and progress
- Write FAQ document
- Write bug report
- Insert screen captures in bug report
- Write what you learn
- Read the development environment documentation