|
Welcome to CodeShine™ |
Top Next |
|
One key benefit of refactoring is that it encourages interactive design - you can often write a quick and dirty first draft of some piece of logic, even using hard-coded values for parameters, and then refactor it to a better and more general design as the need arises.
"Cleaning code" for it's own sake can be a waste of time and money - most of the time, I use CodeShine when I'm either debugging or enhancing existing code. It is a great aid in understanding and untangling existing code - whether written by you ("what was I thinking?") or someone else ("that idiot!").
Refactoring is an excellent path to code reuse. For example, when you use Extract Method, you automatically isolate the parameters that a block of code needs in order to function.
The key reference text about refactoring is the book Refactoring: Improving the Design of Existing Code by Martin Fowler. Reading this book may change your conception of what good code looks like! Not only is this a profound book, in my opinion, but it is also one of the most well-written, understandable and just plain interesting books on programming that I've ever seen. Most of the examples are in Java, but they are readily understandable to anyone who has used classes in Visual Basic. |