8. Design is hard.
The design of
reusable software
is especially hard.
Reusable software usually is the
result of many design iterations.
William F. Opdyke, 1992
it’sallaboutdesign
9. Books, papers
• „REFACTORING OBJECT-ORIENTED FRAMEWORKS“
William F. Opdyke, 1992
http://www.ai.univ-paris8.fr/~lysop/opdyke-thesis.pdf
• „Refactoring: Improving the Design of Existing Code“
Martin Fowler, 1999
• „Working Effectively with Legacy Code“
Michael Feathers, 2004
• „31 Days of Refactoring“
http://lostechies.com/wp-content/uploads/2011/03/31DaysRefactoring.pdf
• „Subjective evaluation of software evolvability using code smells: An
empirical study“
http://www.soberit.hut.fi/~mmantyla/ESE_2006.pdf
48. Conditionals
Combinatorial Explosion
Type embedding
Data Clumps
sets of variables that are always together, get passed in, etc. => extract into class
avoid placing types in method names; it's not only redundant, but it forces you to
change the name if the type changes
You have lots of code that does almost the same thing
watch out for large conditional logic blocks
particularly blocks that tend to grow larger or change significantly over time
49. Feature envy
a method making more use of another class than the one it is in
Speculative Generality
write code to solve today's problems
and worry about tomorrow's problems when they actually materialize
52. Obscure test
it is difficult to understand the test at a glance
Conditional test logic
• tests take too long to run
• make developers not run the tests
• leads to untested code
• demotivates continuous testing
• make code rot
55. General fixture
a setUp method contains code only used by some tests
Lazy test
using the same fixture for multiple tests
Test run war
test can only be run by one person at a time, due to use of same external ressource