Last week, Raymond Lewallen posted a refactoring pattern quiz. A lot people view refactoring as a "bad thing" since you're taking existing, debugged (sometimes in-production) code and changing it. While there is definitely the riesk of introducing regression bugs, Raymond addressed an important point in deflecting some of that risk:
...you will ALWAYS want to write a unit test for your initial code and make sure it passes all scenarios BEFORE beginning your refactoring process and DURING and AFTER your refactoring process.Unit tests can not reduce the risk of regression bugs to zero, but with a good set of unit tests, the risk can come very close to zero. That's another reason to start writing unit tests NOW. You'll learn more about the process of unit testing and over time you'll be able to write better and better unit tests.