Everything is a parameter

Problem: Methods are difficult or impossible to test because they require too much state and change too many properties

Pattern: During development a rule is adopted that anything which alters the state of an object, or performs manipulation of data, is written as a static method that operates only on data passed as a parameter. Instance methods are then written that pass all required values as parameters to these static methods, then set instance members based only on what is returned.

Example: In the old code, a method that's difficult to test might look like this:

Discussion: In the example, the new ProcessData() is practically a blueprint for the unit test of CompensateByFactor, which has not only inherited all of the business logic, but also takes everything it operates on as a parameter.