42.

What We've Learned

In this chapter on the Rogue Tile bug pattern we've, learned the following:

  • Rogue Tile is the most common bug pattern and often results from copying and pasting a block of code from one section of a program to another.

  • Cut-and-pasting "bug-free" code may not be the work-saving option you think it is.

  • Environmental variables may cause cut-and-paste code to work correctly in some places but not in others.

  • Factoring out common code can be a preventative measure, but it may not be an easy task.

  • There is a tradeoff between encapsulating code and keeping a single point of control for each functional aspect.

  • Statically typed languages tend to limit expressiveness, thereby reducing our effectiveness in preventing rogue tiles. Generic types have the potential to counter this drawback of Java to a certain extent.

  • The requirement that all checked exceptions must be caught or declared as thrown means that some of the code in methods cannot be factored out.

  • Aspect-oriented programming-adding a program's "aspects" to its classes and functions as a way of organizing it-can help handle duplicated code. (Aspects correspond to the global properties of a program, such as the way checked exceptions are handled in methods.)



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