Iteration Problems
nMixing of traversal and processing code
n// Java based on example from Nicholas Lesiecki
ndouble tax=0.0;
nfor (int i=1;i<taxBrackets.length;i++)
n    tax+=between(taxBrackets[i-1].cutoff,taxBrackets[i].cutoff,
n            income)*taxBrackets[i].rate;
This is code similar to what we had a few months ago in a demonstration of JUnit and some eXtreme Programming methods, except that code was even more complicated: there was no function “between”.  Instead, there were another six to ten lines of code here.  The code did both the traversal and the processing and therefore violates the single responsibility principle.