DEV Community

Discussion on: About refactoring, code quality & trends in software development

Collapse
 
murkrage profile image
Mike Ekkel

It seems faster to write a new feature in a complex system than to refactor the old system first and then add the new feature. But the overall time that you would spend debugging, rolling back releases, sending out bug fixes, writing tests for complex systems will be lesser of you refactor first.

This is incredibly true. I've only been going at this for a short time, but in my short time as a developer I've already experienced having to refactor something after the fact and it took me nearly twice as long. Not only did I have to refactor whatever code the new feature depended on, I also had to refactor the actual feature. Had I done the refactor first, I could have simply build on top of that work and I wouldn't have to be in that mess.

I've tried to refactor first ever since.

Collapse
 
murrayvarey profile image
MurrayVarey

Yeah, it's always best to refactor first (if possible). In my experience, refactoring really helps clarify how to approach a new feature -- quite often, the approach just kind of 'falls out' during the refactoring process.