The BenefitsIt is important [1] emerge in the code. This enables you (the developer) to work with these emerging patterns and further improve the structure of your code.Always being on the look out for changes that will improve the structure of your code will force Chapter 1. FeedbackThe ability to refactor your code takes the pressure off the design phase of software development. Formal methods (such as waterfall) advocate developing a perfect design before any code is written. In the real world, perfect design upfront is impossible because during the implementation of the code you will learn lessons that affect the design.Refactoring enables you to change the design of the code at a later stage. This means that you do not have to get the design absolutely right before you write any code. You can get a rough design worked out, code it up, and then if (when) you spot a better design you can refactor your code toward the better design.Refactoring enables you to get started on the coding earlier than you might have been able to otherwise. Getting started earlier enables you to get feedback on the progress from other coders and even customers at an earlier time. This feedback is valuable because it might force you to rethink the original design. The earlier you rethink designs, the higher your chances are of getting the final result that the customer wants. CommunicationSome of the refactorings we will do in this chapter do nothing more than improve the readability of the code. The benefit in the short term is that other programmers will find it easier to work with the code. In the medium to long term, more-readable code is easier to understand and therefore easier to maintain. SimplicityBy simplifying your code through refactoring, you get the immediate benefit to the development team of having less to understand. This in turn improves the quality of the code. Bugs often result because of misunderstanding existing code and writing code that causes existing code to break. |