Continuous Refactoring Is A Wise Investment

I wrote earlier about the need to refactor your codebase continuously – making small improvements on a regular basis. In this post, I want to elaborate on why continuous refactoring is such a wise investment. With continuous refactoring, you get several benefits:

  1. Helps you recognize and correct incorrect domain understanding. When you  move a parameter from one class to another or make an atomic parameter a collection – you are refactoring to align your code with your domain. These changes will help you address evolving requirements faster and in a more natural manner.
  2. Reduces the probability for massive re-design of your code: when you continuously refactor, you are making improvements. You may introduce a constant / access data from a properties file to remove hard-coded values or apply a new design pattern that helps with a tricky requirement. These changes align your code and design better – For instance, your initial implementation might have sent data to another object directly. You realize in a subsequent iteration that more than one process needs this information. You refactor your code to introduce patterns or simplications – this process is iterative.
  3. Continuous refactoring makes the domain model more explicit and easy to understand. It is natural to accumulate business knowledge as you proceed through development and without refactoring this new knowledge will get lost.
  4. Continuous refactoring also provides the opportunity to review your code – for bugs, for deviations, for needless complexity, missed opportunities for reuse etc. You can make refactoring a necessary follow-up action as part of design reviews and code reviews.

Having said all this – the key concept to recognize is the need for continuity and discipline. An incremental improvement may not seem like a big gain and it isn’t always. However, small changes do add up to significant gains over multiple iterations. In a follow-up post I will provide concrete examples of using refactoring to improve the quality of your codebase.

About these ads

3 Responses to Continuous Refactoring Is A Wise Investment

  1. [...] This post was mentioned on Twitter by Art of SoftwareReuse. Art of SoftwareReuse said: Continuous Refactoring Is A Wise Investment: I wrote earlier about the need to refactor your codebase continuously… [...]

  2. [...] something reusable, consciously align classes and interfaces for reuse. Refactor, refactor, and keep refactoring – because only with multiple iterations is your asset going to be increase it’s reuse [...]

  3. [...] and release is an opportunity to review and update the investment. When you make a decision, continuously refactor to make the capabilities less app specific and [...]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: