What are the advantages and disadvantages of refactoring code smell in software quality?

- 6,860
- 20
- 39
- 51

- 11
- 1
- 1
-
You might want to try and provide some more context on this question - it sounds very vague. Nonetheless, the most obvious advantage is that refactoring leads to better quality code. The potential disadvantage is that you might have to retest lots of functionality - but whether or not that is a big issue comes down to the quality of your continuous integration pipeline and your automated tests. – Riaan Nel May 17 '17 at 05:54
2 Answers
Although refactoring does not add features or functionalities in a software system, it is sharp weapon for developers in their maintenance activities. It makes a software system easier to understand and cheaper to modify without changing its observable behavior by changing its internal structure.
The purposes of refactoring according to Martin Fowler (Father of Code Smell) are stated in the following:
- Refactoring Improves the Design of Software
- Refactoring Makes Software Easier to Understand
- Refactoring Helps Finding Bugs
- Refactoring Helps Programming Faster
Specially for long-term software, it is essential to refactor the code in order to make the software more adaptive. However, you definitely do not perform refactoring tasks, if it exceeds your budget and time. In essence, stop refactoring when you -
- Run out of money
- Run out of time

- 1,028
- 12
- 30
Advantages: 1. Refactoring is a really good weapon to maintain the code 2. It's interesting thing to do whether part of current task or as a separate task 3. Make the code clean and organized 4. Help to follow principles like SOLID, GRASP, etc
Disadvantages: 1. It's risky when the application is big 2. It's risky when the existing code doesn't have proper test cases 3. It's risky when developers do not understand what's all about

- 11
- 2