7.

Overview

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?"

As we discussed in Chapter 4, 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:

  1. To maximize the use of static checking.

  2. To minimize the ways in which errors can be introduced.

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.

Let's consider some of the ways to apply each of these two guiding principles and see how design patterns can help.



Bug Patterns in Java
Bug Patterns In Java
ISBN: 1590590619
EAN: 2147483647
Year: N/A
Pages: 95
Authors: Eric Allen

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net