Code gets Bad! Don't Live with it, Fix it!
Code easily gets out of hand. The goal is then to stop adding functonality,
fixing bugs, and subtracting old functionality. Instead, you re-consider
your design, eliminate duplications, and focus on creating a single point
of control for each current functionality. For every
run the test suite. It is critical that your changes do not affect the test
suite. If you "accidentally" fix a bug, make sure you take a note and test
Refactoring with a goal in mind is the best thing. It helps you find the
bad spots in the code that might get in your way. So imagine that your
- adds the method
so that a player program can determine the color of its followers;
- adds an observer call-back
sign-up (of color and name) so
that observers find out who else is playing;
- changes the distribution of tiles so that it corresponds to those found
in "paper versions" of Carcassonne.
- Martin Fowler. Refactoring. Improving the Design of Existing
Code. Addison-Wesley. 2002.