In this final chapter, we discuss the yin-yang motivations for employing bug patterns when designing a program: maximizing static checking use and minimizing error introduction.
Now that we've taken a trip through some of the most common bug patterns and have seen how to deal with them, we're in the enviable position of asking this question: "What are the implications of bug patterns on program design?"
The extreme programming practice of writing tests in tandem with writing code has several major ramifications on design. We have also demonstrated how the causes of the most common bugs can be eliminated by taking several preventative programming measures, but these measures have been largely below the level of design.
Considering these preventative measures as a whole, we can formulate a guiding set of design principles to avoid these bugs and many like them. In fact, a prudent application of some of the most popular design patterns can help to eliminate occurrences of many bug patterns.
After reviewing the preventative programming measures discussed in previous chapters, we can see that there are two primary motivations behind them:
These two motivations are sometimes in conflict. Errors can be minimized by keeping a single point of control for each functional aspect of the code, but static type checking doesn't always allow for such single points of control.
Conflicts like these make programming a hard task. As is always the case, resolution of conflicts among sets of principles must be resolved by an assessment of the costs and benefits of each in a given context.
Related Online Articles:
- Bug Pattern in Java - Other Obstacles to Factoring Out Code.
- Bug Pattern in Java - Null Pointers Everywhere
- Bug Patterns in Java - The Orphaned Thread
- Bug Pattern in Java - The Double Descent
- Bug Pattern in Java - Saboteur Data
- Bug Patterns in Java - The Fictitious Implementation
- Bug Patterns in Java - The Run-On Initialization
- Bug Pattern in Java - About the Bug Patterns
- Design Patterns for Debugging - Maximizing Static Type Checking
- Bug Pattern in Java - The Broken Dispatch
Shweta Sharma on 2009-03-28 01:36:24 wrote,
@Rajesh Kumar Gupta,