Why you should build refactorings little by little rather than completely rewriting your code



Refactoring to organize the internal structure without changing the behavior of the code, and rewriting code written in an old design language such as C or Java in a new advanced language are both the same points of changing the code . However, unless rewriting is absolutely necessary, Justin Fuller, a software engineer, points out that it is preferable to repeat refactoring.

Why do we fall into the rewrite trap? | Justin Fuller — Software Engineer

Fuller has worked for several companies, but all companies had a culture that emphasized refactoring. For example, the first company I worked for was using an old application framework called ColdFusion , but as the whole team continued to improve, adding features and fixing bugs, their productivity gradually increased, It is said that he gained profit by taking market share.

Fuller suggests that refactoring is a good idea: 'Code is harder to read than writing, but you get more from reading.' Reading code written by others is a bit confusing, but the things that the original code writer accumulated, such as debugging results using logs and how to avoid errors, are very useful for understanding the development. Fuller says it is not desirable to rewrite the code because it is 'incomprehensible'.


Ed Robertson

Also, code written in older languages is not always bad. Fuller is currently working for the New York Times , but when he learned that it was necessary to investigate how APIs of old languages such as PHP and Java were involved, it seemed to tremble when imagine the complexity is. However, those codes were refined by old refactorings, and they were easy to understand and organized so that they could use the company's code suite in two months after joining the company.

Refactoring is important, but sometimes you need to rewrite all your code. Fuller says that the perfect opportunity is to review the product itself. When the business surrounding the product is down and the product developers are dissatisfied with the code, a complete rewrite of the code can help. It is also worth rewriting code that is very complex and of low quality, and that bugs will occur whenever a part of the code is changed.

by Roozbeh Eslami

Although refactoring is not desirable in all situations, basically it should be refactoring rather than rewriting completely. Fuller says that reading ' Refactoring ' by Martin Fowler , a well-known software engineer, gives a deep understanding of refactoring.

in Note,   Software, Posted by darkhorse_log