views:

202

answers:

7

Why should companies invest in refactoring components, though it is not going to add any new feature to the product ?

I agree it is to clean the code, fix bugs and remove dead code - but what is the take ??

+8  A: 

Maintenance. It will reduce your maintenance costs significantly. There is no comparison between fully factored code and the junk that sits in most companies repositories. The latter is virtually worthless, while the former is gold.

Bill K
But what is the value add for the customer ??
atVelu
There is no single customer-The customer exists throughout the lifecycle of the code. Every bugfix and update is easier and quicker, so the product at any given time has more features stability. I'm working on your next cable box right now-want me to stop refactoring (trust me, the answer is no)?
Bill K
+2  A: 

It depends who you ask. A non-technical manager may say there is no need. A support developer would say that it would help keep the maintenance costs down.

harriyott
+1  A: 

Refactoring needs to be a part of your every-day job. You constantly refactor your code to make it more readable/maintainable/robust/reusable, etc.

Your code is a living document. If it doesn't change over time, it becomes stagnant.

Invest in testing. Invest in refactoring. Invest in writing good code.

Brian Genisio
+1  A: 

To start off with: Refactoring is a tax. If the code works, then you are spending time fixing code that already works, I can see the business types looking quizzical now. A saying I like is "Legacy is another word for code that works."

Now there are many problems with a growing code base that need to be addressed before you start to spend more time maintaining the code that developing features.

Personally I like the "No Broken Windows" philosopy.

vfilby
A: 

If it ain't broke don't fix it.

But if you need to start fitting the components into new unpredictable requirements then it often makes sense to identify the bits you can extract and reuse. You need to be certain that your changes are introducing unexpected bugs - so you'll need good test coverage.

Ken
+1  A: 

maintenance. Sometimes, a project gets to big or with too many "fast" patches to be further expanded. You just have to sit down calmly and clean and refactor.

Marc
+1  A: 

While the other answers are all true the power of Refactoring is that it allows you to change the design of your code with predictable results. The biggest problem of maintenance is that it is virtually impossible to anticipate all requirements for complex applications.

Most of these can be dealt with by adding a new feature like a new report or command. But other will require part of your application to be redesigned. This is where refactoring and it's sibling unit-testing comes into play. By using refactoring techniques you can make needed design changes safely.

It is not a cure all technique but another tool that improves the quality of your code. (stuructured programming, object-orientation, etc).

RS Conley

related questions