Updated: 3/28/2005; 11:11:16 AM.
Mondegreen
Erik Neu's weblog. Focus on current news and political topics, and general-interest Information Technology topics. Some specific topics of interest: Words & Language, everyday economics, requirements engineering, extreme programming, Minnesota, bicycling, refactoring, traffic planning & analysis, Miles Davis, software useability, weblogs, nature vs. nurture, antibiotics, Social Security, tax policy, school choice, student tracking by ability, twins, short-track speed skating, table tennis, great sports stories, PBS, NPR, web search strategies, mortgage industry, mortgage-backed securities, MBTI, Myers-Briggs, Rensselaer Polytechnic Institute, RPI, Phi Sigma Kappa, digital video, nurtured heart.
        

Tuesday, May 13, 2003
trackback []

Bob Cringely writes “against” refactoring, adducing the well-known principle that “if the code ain’t broke, don’t fit it”. Hard to argue with that. But when I think of re-factoring, I think of another hard-to-argue-with aphorism: “take the time to do it right”. So, no, you shouldn’t dive into an ugly section of code if it is bug-free and not affected by any feature enhancement requests. But if either of the following scenarios apply, then you do have a re-factoring opportunity:

  1. You have to make a minor update to existing code, like maybe add some “ElseIf” statements to exclude some previously unforeseen exceptions. Following the rule of 3 for refactoring, maybe it is time to create a more generalized, configurable case that could eliminate future maintenance of this sort. Either way, the module will have to be re-tested.
  2. Similarly suppose you are making an update to existing code, and in an adjacent section within the same module, you see a section of code that presumably works but is problematic. Perhaps it doesn’t conform to current standards (because SQL statements are hard-coded rather than assembled dynamically), and could break in the future if there is a seemingly innocuous change to the database. The entire module has to be re-tested anyway, so seems like a good time for a well-chosen re-factoring.

9:47:32 AM    comment []

© Copyright 2005 Erik Neu.
 
May 2003
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Apr   Jun


Click here to visit the Radio UserLand website.

Subscribe to "Mondegreen" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.


Search My Blog