DEV Community


Discussion on: Do you schedule time and tasks for refactors?

rhymes profile image

Lately the more Bob Martin quotes I see on the less I find myself agreeing with them :-)

He definitely has a point, even the agile coach at a client's company keeps saying that but that doesn't mean the point they make it's absolute and applies to every situation.

BTW if you need to justify refactoring to a PO and "be respectful" of Agile/XP/Kanban/whatever you can just use a bug as an excuse. Bugs purposefully don't have points in tracking systems because bugs are just bugs.

Sometimes it's a white lie, sometimes it isn't. Yesterday I refactored a piece of code another (very competent) developer wrote in one session because they needed the feature fast and his holidays were incoming.

I could have just added a breakpoint, fixed the two I found and called it a day. Instead I took a while more refactoring to add a few functional tests, better logging and a little bit of defensive programming (it's a parser for data we don't control), and also fixed the bugs of course :D

It might also be that more senior(ish) programmers can get away with it, I might not have been able to do it if I were a junior, because I would have probably been given less leeway (plus the fact that I would have been less experienced to begin with).

Also it's summer, customers here are on holiday, the backlog is lighter, it's a great time to lessen technical debt ;-)