The
Brutal
Refactoring
Game
What are we going to do?
How will we do it?
while (inSession())
{
writeSomeCode();
while (!codebase().isPerfect())
{
refactor();
}
}
"Perfect"?
- Lack of tests
- Name not from domain
- Name not expressing intent
- Unnecessary
if
- Unnecessary
else
- Duplication of constant
- Method does more than
one thing
- Primitive obsession
- Feature envy
- Method too long (> 6 lines)
- Too many parameters (> 3)
- Tests: not unitary
- Tests: setup too complex
- Tests: unclear action
- Tests: more than one assert
- Tests: no assert
- Tests: too many paths
Three Questions.
Was your code better than usual?
What upset you?
Would you do this again?
SoCraTes UK
http://socratesuk.org/