DEV Community

Discussion on: I work hard in order to avoid work - My view on refactoring

Collapse
 
moopet profile image
Ben Sinclair

I generally agree.

But I'll point out that there are a lot of us who work on quirky foreign systems and codebases without much if anything in the way of testing. It's very easy to slip in a new bug when refactoring, and unless you have good tests for before/after, you might end up doing more harm than good.

I know, I know, that's a terrible point of view. But it's the practical one sometimes.

Collapse
 
nombrekeff profile image
Keff

Yeah, good point. I've had a couple of those 😅

I agree, because although there are some ways of refactoring that reduce the possibilities of harmig the system, it will never be totally safe. I would say that having tests gives you a lot more freedom and safety to refactor (but tests must be done correclty)