DEV Community

Discussion on: JS Refactoring Combo: Simplify Duplicated Function Call Inside If-Else Statement

Collapse
 
jonrandy profile image
Jon Randy 🎖️

From the look of the video, it would have been quicker just to re-type the refactored version yourself?

Collapse
 
grantdotdev profile image
Grant Riordan

On this .. refactoring yourself would also increase your knowledge and understanding.

  • faster not using GitHub Copilot
  • not using = using your own brain
  • improve problem solving / refactoring skills.
Collapse
 
lgrammel profile image
Lars Grammel

Yup, and I tested it. Manual retyping is about 2x as fast in this case.

However, the main strength of automated refactoring is their safety, both in terms of accurately executing the changes and in terms of evaluating pitfalls (some of the time).

When I talked to other people about chaining automated refactorings vs manually retyping, there was a preference for safety over speed, especially in legacy code that's more complex than this toy example.

Collapse
 
jonrandy profile image
Jon Randy 🎖️

Unless it's an extensive variable rename, my instincts are quite the opposite... I much prefer to do it myself - a tool like this just feels cumbersome and unnecessary

Thread Thread
 
lgrammel profile image
Lars Grammel

That's fair - the tooling value depends on personal preferences, experience, the complexity of & familiarity with the codebase, etc.