Sunday, June 14, 2009

Refactoring : The Silent No

Few months ago I gave a presentation in front of my colleagues. Some of them completely missed it because they've expected something that goes for hour or two and they've were late hoping to skip the part with making projector work and non essential intro. Fortunately for them I've started in time and talked for less then 15 minutes. I mean if that's enough for Dick Hardt why make it any longer.
The theme was something dear to my heart, refactoring. I've had a slideshow with pretty pictures, stole a giggle or two, and got few useful questions when finished. It was a presenters' dream came through. But afterwards I felt something odd, the aftermath of silent no.
What the hell went wrong? My advices were fine, like it sure easier to write a parameterized constructor then burden the class or struct user to manually set them eachtime, or that source control keeps old version of our code so we don't need if (false) ... . But the problem was that those advices were fine for me and people that tend to think like me. The terse language thinkers, but not all coders are molded from a same shape. My ability to reduce line count several times is annoying for some and useless for many. What's wrong with having two simigliar methods rather then adding parameter to merge them? They're doing the same thing aren't they, so whats the point of making it shorter?
I can't speak for everybody else but my reasons for refactoring are practical.I have a small amount of brain cache memory. So the best thing to understand something is a dense writing with descriptive names. If I need to scroll a function there is a good chance to forget what the hell was on the page before while reading the current page. So If you're amount of brain chache is outrageous, good for you. Refactoring is something to be left for the less gifted. But me and likes will have to fallow Ken Iversons' advice he once gave to Fred Brooks(author of The Mythical Man-Month:

If it’s a clause, turn it into a phrase. If it’s a phrase, turn it into an adjective or an adverb. If it’s an adjective or an adverb, omit it. And you apply these recursively.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.