Design Patterns For Debugging - Online Article


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:

  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.

About the Author:

No further information.


Shweta Sharma on 2009-03-28 01:36:24 wrote,

@Rajesh Kumar Gupta,
good artical..