Phase: Implementation
Explicitly initialize all your variables and other data stores, either during declaration or just before the first usage.
Phase: Testing
Use automated static analysis tools that target this type of weakness. Many modern techniques use data flow analysis to minimize the number of false positives. This is not a perfect solution, since 100% accuracy and coverage are not feasible.