DEV Community

Discussion on: Readable vs Workable Code

nestedsoftware profile image
Nested Software • Edited on

One thing I advocate for in refactoring is not to refactor in order to reduce duplication or make code more readable, or anything of that sort. Instead, I propose that one should refactor when making a needed change starts to get hard. If some additional logic we wish to introduce doesn't fit, then we refactor first so that the new behaviour can just slide into place. This way things like readability and reduced duplication become a byproduct of making the code easier to work with on tangible pieces of functionality.