The refactoring is defined as the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure.
We can enumerate three cases concerning the code refactoring:
- Iterative refactoring: your application can’t be developed perfectly at the first iteration, even if the team has the best of the architects, designers and developers. The easy way to do refactoring without investing a lot of money and without wasting time is to integrate it in the development process and do it after each iteration.
- Refactoring when is necessary: after the application is deployed, there are some feedbacks and bugs, if resolving them take a lot of time or some clients needs are very complex to develop and integrate to the existing system, a refactoring can be a good solution to improve the quality of the code base, but in this case it can be very risky and we have to take care to avoid the regression in the existing code.
- Not refactor: sometimes even if there are many problems in the existing application, a refactoring is never began, because the boss not want to invest in this process, and the support team have to manage the stress generated by all the bugs and feedbacks.
Choice of some known open source projects teams:
As LLVM/Clang the chrome browser team prefer to refactor regularly the source code, and as soon as the C++11 was implemented by the compilers they chose to move forward to this new standard. here’s the list of the c++11 features used.
At google they chose LLVM to refactor automatically their C++ code as shown by this video.
For each major version of Clang, we update CppDepend to use the latest stable version, and for each version we discover a lot of changes due to the refactoring of the whole LLVM/Clang source code. As example in the latest version 3.7 the source code was modernized to use many C++11 features.
Unlike google and LLVM teams, the php team did not refactored their source code for many years, and for each major version only minor changes were introduced to the design, and the external libraries used. It was not a big problem until the Php6 version where the code changes became very risky and introduced many regressions, specially for the UTF8 integration.