Not subject to altering behavior via standard mechanisms:
decorator, strategy, subclassing: you end up adding another
conditional test
Hard to give a name to describe what the class does.
Whenever struggling with a name, the code is telling you that the
responsibilities are muddled. When objects have a clear name, it
is easy to keep them focused and shear off any excess baggage.
problem: class does too much
how to tell
Try to sum up what a class does in a single phrase. If this phrase
includes “AND” it’s probably doing too much.
solution: class does too much
Class-responsibility-collaboration (CRC) card
"If it fits, it ships!"
solution: class does too much
Reduce Cyclomatic Complexity: Number of paths through a
code base
Higher complexity is harder to test
High complexity is tied to low cohesion (degree to which
the elements of a module belong together.)
problem: constructor does real work
solution: constructor does real work
Dependency Injection
Outside the scope of what we want to talk about... (but look at
Spring and Guice).
moe money moe problems?
Continue to look at PDF
developer workflow
modifying workflow to encourage testing
start thinking about features in the
context of "how do we test that??"
think outside the container: You don’t need to start the
Web container to run code (even database code)!
developer workflow
business logic tests: Fast,
Repeatable (automatable??)