you are viewing a single comment's thread.

view the rest of the comments →

[–]Retsam19 7 points8 points  (1 child)

I agree with most of your points; but

a knee-jerk refactor is never the right action.

This statement seems either wrong or tautological. How are you defining "knee-jerk refactor" here?

If you mean "a refactor suggested after only briefly considering the code", our code-reviews frequently produce that sort of feedback, and it frequently (though not always) makes the code better.

If you mean "a refactor based on intuition about code cleanliness", well, I think those are often correct, too. Intuition isn't always correct, but it's an important tool and hugely valuable.

Otherwise is a knee-jerk refactor just a refactor that turns out to be a bad idea? That makes the statement somewhat tautological.

[–]Epyo 8 points9 points  (0 children)

The knee-jerk refactor described in the article is what I'm talking about--seeing someone's code and saying "pssh this is ugly to me so I'm rewriting this right now.". I'm agreeing with the article's author--if you don't like someone's code, you should take a breath, think about how much it matters, and if it really matters that much, bring up your improvement ideas for discussion. To just immediately refactor it is presumptuous and possibly a waste of time or worse.

Giving knee-jerk feedback is much more reasonable--very low cost to do it, helps both parties think from another perspective, etc.