Wow. Thanks for the replies.
There's a whole lot of crazy in this thread. It's possible the scope of change we're talking about is being overestimated (refactoring != redesign). I'm really shocked by some of the responses.
My view was always that you should leave code better than you found it. If you can make simple refactorings such as pulling methods to improve readability, reuse, testablity then its basically your responsibility as a professional to do that.
Exactly. Otherwise you might as well be a code monkey.
Code-rot is a fact of life; and once the rot's set in, if i intertwine new functionality with rotten code I'm just catalysing the whole rotting process.
Comparisons to a decorator doing the wallpaper/ceilings/etc when he was only asked to paint the skirting boards are the wrong analogy. It's more akin to the painter discovering that the skirting boards are peeling badly, so he does a professional job and sands them down first rather than just slapping a new coat on top of the peeling paintwork. The painter isn't interested in the wallpaper or ceilings, and limits the scope of his professionalism to the area which he's been assigned to improve.
Plus the new feature/fix i've implemented is now unit tested, along with whatever i've been able to make testable in the process.
And Tarbera - get a clue! Worst case you see what i've done, say "nice effort, but there are particular risks in this project which you wasn't aware of and it'll be too expensive to redo the performance testing". Then it takes me 3 minutes to revert the code back to it's original state (Oh! not even that because it's not even merged into the release branch because it;s not been approved yet), and you can not pay me for 3 hours of my time, or I can make it up and I'll know better next time.
So a change in a variable name requires same performance testing as breaking a 1000 line program into 15 sub procedures -
that kind of refactoring typically doesn't even change ANY logic. One can go further afterwards if they like, but you can split that huge chunk of code into small methods with descriptive names often without changing any logic at all. You can encapsulate the different responsibilities you discover, in separate classes, again often without changing any logic. Plus I'm aware enough to know whether the code I'm working on is performance critical or not - in fact in this example (in which I did change some logic which the enhancement required) I made the conscious decision to reimplement the new version of the routine in a less efficient way. The trade-off between performance & maintainability was easy to make given the context in which that code is utilised.
Are you one of those excel-monkey (clueless) PMs who has to manufacture importance for themselves?
Anyhow, like i say it's possible some people have overestimated the scale of the refactoring (or just aren't very good at refactoring), so ignore me if that's the case.
Had another batch of reviews today, with a different guy, which went well - infact he started calling me out on the inappropriate multiple responsibilities a particular class was holding, before I pointed out that he was looking at the previous commit, rather than the new one, on the diff. So I might have just got the cantankerous bad egg previously.
I didn't expect a whole load of pages arguing whether it is right or wrong to maintain code as you work with it - it's something I've always taken for granted (at least in my more experienced years after having had a chance to work with the real pros).
I just wanted to see who else was frustrated working with the software dung-beetles who like to live & work in tulip.

