Marick's Law 51

Posted by Uncle Bob Sat, 29 Nov 2008 20:12:00 GMT

A month ago I was deep in the throes of shipping the current release of FitNesse. I just wanted to get it done. I was close to delivery when I spotted a subtle flaw. To fix this flaw I decided to insert identical if statements into each of 9 implementations of an abstract function.

My green wrist band was glowing a nasty shade of puke. I knew I was duplicating code. I knew that I should use the Template Method pattern. But that just seemed too hard. I was convinced that it would be faster to spew the duplicated code out into the derivatives, get the release done, and then clean it up later.

So this morning I was doing something else, and I spotted this duplicated code. I sighed, as I looked down at my green wrist band, and thought to myself that I’d better eat my own dog food and clean this mess up before it gets any worse. I was dreading it.

I made sure that every occurrence of the statement was identical. Then I went to the base class with the intention of refactoring a Template Method. When, what to my wondering eyes should appear, but a Template Method that was already there.

I sheepishly copied and pasted the if statement from one of the derivatives into the Template Method, and then deleted the other eight instances.

I ran the tests.

They all passed.

Damn.

My green wrist band is shouting: “I TOLD YOU SO!”

For my penance I did 20 recitations of Marick’s law. “When it comes to code it never pays to rush.”

Comments

Leave a response

  1. Avatar
    llewellyn falco about 1 hour later:

    I agree with this, but I have to say that pairing makes it easier to implement. So much harder to slack off with others watching

  2. Avatar
    Mike Finney about 2 hours later:

    Hmmm. Perhaps we should make a plug-in for our IDE which has a little character applauding when it recognizes a refactoring we did. :) Perhaps a nice sound. (Ding!)

  3. Avatar
    Bret Pettichord 3 months later:

    And a raspberry when it sees us doing too much cut n paste.

  4. Avatar
    DinnerwarE 10 months later:

    Oh i agree on that, rushing code always puts us in trouble! But i did not know about these green wrist band and i just love them, i’ll send a donation and will get a few for the office, it’s a funny reminder that can really get helpfull!

  5. Avatar
    ed hardy 10 months later:

    So much harder to slack off with others watching …..

  6. Avatar
    family lawyers sydney 12 months later:

    can you give more

  7. Avatar
    worker compensation lawyers 12 months later:

    Hi..thanks for the information… loved it simply Oh man! What an amazing thing to say

  8. Avatar
    Kooba Handbags about 1 year later:

    Living without an aim is like sailing without a compass. with a new http://www.handbags4buy.com/ idea is a crank until the idea succeeds.

  9. Avatar
    ipad video converter about 1 year later:

    ah ha you can have a yrt

  10. Avatar
    jewellery about 1 year later:

    ah ha you can have a yrt

  11. Avatar
    cheap chi flat irons about 1 year later:

    best deals on original chea chi flat irons with some new arrived.

  12. Avatar
    bag manufacturers about 1 year later:

    an have a yrt

  13. Avatar
    Prepaid News about 1 year later:

    The depth and quality of this post is really awesome. It is very knowledgeable information that could be very much helpful in IT as well as e-business industry.

  14. Avatar
    sinlu about 1 year later:

    Armani Jeans is an Italian extension to the famous Italian fashion house Gucci Jeans For Men. However, it is more specialized in youthful clothes and men’s accessories for young ages. They produce summer wear, beach wear, youthful jeans, and more trendy attires and stuff.tattered denim. It is a true staple for the warmer weathers and on the runways of Dolce Gabbana Jeans. Designers Dominico Dolce and Stefano Gabbana gave us looks to coincide with their Crown Holder Jeans and Dolce Gabbana Jeans collection. The looks of this collection are very “preppy in the park” like a disheveled Chuck Bass almost. Along with the tattered denim, models were also sent down the runway in patchwork denim and a pair of denim shorts. You can check out the denim looks below.

  15. Avatar
    sinlu about 1 year later:

    Supra Greco Suprano were designed by Jim Greco. The simple design provides these shoes with a classic look. These creative recreation shoes High shoe consist of special features such as tongue foam and a thin collar as well as a mesh tongue that allows your foot to be ventilated, a little extra protection for your heel, and a vulcanized rubber outsole.creative recreations shoes can stand at a high position of Market for the pattern and material, the most “straighten up” and the material most shinny. So surpra bring more to the fashion field and the sports.More and more stars endorse creative recreations sneakers with condition. Such as Slash, JAY-Z, Lil Wayne, Lindsay Lohan, Heidi Klum, Mr. Diddy and so on. They always putting on a pair of SUPRA shoes to attend the parties. Well as a skateboarder, I often try my luck on the marketplace to find new skateboarding shoes. It just so happens that -White—Mint_p467.html”>creative cesario low mens are my favorite.

  16. Avatar
    std testing center about 1 year later:

    I would like to have blue wrist band shouting: “I TOLD YOU SO!” too! That’s awesome

  17. Avatar
    lidia about 1 year later:

    Crown Holder Jeanslaunched as a diffusion line in 1981. Internationally renowned and oozing with quality and style, Cheap Crown Holder Jeans takes contemporary fashion to another level.From elegant and glamorous backless ball dresses to casual basics, Crown Holders Jeans dominates the world of designer fashion for the modern man.Mens Diesel Jeans is an Italian design company known best for its clothing which is aimed mainly to the adult market, especially the jeans. The new season Cheap Diesel Jeansare definitely the must buy pair of jeans this year. They incorporate a Straight cut design which are very casual and would compliment a smooth shirt and a pair of your favourite shoes tremendously well.Dolce Gabbana Jeans can be categorized under designer or casual wears and people of all age are overtly crazy about them. Color, texture, cut or wash- everything blends enormously well with the new-age fashion trend as well as the comfort quotient of a working man or woman. Teenagers and youngsters too can die for the Dolce And Gabbana MensJeans.

  18. Avatar
    Pandora over 2 years later:

    It seems unlikely that new Slim features will be needed very often.

  19. Avatar
    iPhone to Mac Transfer over 2 years later:

    I don’t know much about this topic. So, I am looking a way to solve it. I want to study. When I come to here, I think I am in the right place. the web gives me a lot of infomation, it is very informative. I think lots of people can learn much here. I will come to here again. Thanks.

  20. Avatar
    pandora over 2 years later:

    Had a pleasant reply virtually done, ended up being proof reading it & acquired erased by an ad with regard to Shipwreck beads. Been age groups since i have looked at inside right here & remaining because the large internet site modifications lsat summer time produced taking part via dial-up AGONIZING. I notice everything is much the same. Sleep deprived & sprang over in the Etsy community forums which didn’t seize me personally tonight… Spend time hanging out for the boards & perusing products available for sale & lately distributed. There had been around 197,500 diamond jewelry listings after i exposed my own shop (NGHDesigns) at the end of August. There are no longer Three hundred and fifty,000 now. I’ve acquired a number of good results & appreciate taking part generally there, yet are glad it’s not how you preserve the roofing more than each of our heads. Some dealers prosper presently there, people certainly not offer a thing. Even essentially the most outstanding products are generally smothered within the heap in mere units.

  21. Avatar
    http://www.blacktowhiteiphone4.com over 2 years later:

    White iPhone 4 was the best of the bunch, even though that photo also was a bit washed out.

  22. Avatar
    Dr Dre Headphones over 2 years later:

    With Monster Beats Studio, you’ll hear every sonic detail the musicians and recording engineers laid down in the studio. Deep bass. Hard hitting drums. Bold midrange. And clean, undistorted highs. All in a comfortable fit you can wear for hours. Solos are compact and incredibly lightweight and ready for your active lifestyle, gym work out, or frequent travel. The Monster Dr Dre Headphones design allows Solos to fit into the included compact carrying case. With Dr Dre Earphones getting a great music experience has never been easier. Now, a new headphone in the Beats tradition, Beats By Dr Dre in ear brings you amazing sound in a smaller, lighter on-ear design.

  23. Avatar
    bag manufactures over 2 years later:

    Nice blog ! I like your article and i will definitely look again…....................................... regards: http://www.viaam.com

  24. Avatar
    bag mnaufacturers over 2 years later:

    Great blog ! Your article is admirable and i will look again…........................................ regards: http://www.viaam.com

  25. Avatar
    bag manufacturers over 2 years later:

    Great blog ! Your article is admirable and i will look again…........................................ regards: http://www.viaam.com

  26. Avatar
    Silicone Molding over 2 years later:

    Intertech Machinery Inc. provides the most precise Plastic Injection Mold and Rubber Molds from Taiwan. With applying excellent unscrewing device in molds, Intertech is also very professional for making flip top Cap Molds in the world.

  27. Avatar
    iPad PDF Transfer for Mac over 2 years later:

    I really like this essay. Thank you for writing it so seriously. I want to recommend it for my friends strongly. iPad PDF Transfer for Mac can help you transfer ebooks in PDF format from ipad to mac/iTunes.

  28. Avatar
    hermes belt over 2 years later:

    Hermes belts, Hermes belt, Hermes belts for men, Hermes mens belt, dupont lighter, dupont lighters, st dupont lighter, s.t. dupont lighters.

  29. Avatar
    Men's belts over 2 years later:

    Men’s belts, LV men’s belts, Gucci men’s belts, Hermes men’s belts.

  30. Avatar
    replica belts over 2 years later:

    replica gucci belts, replica gucci belt, replica gucci belts for men, replica gucci mens belt.

  31. Avatar
    Gucci belts over 2 years later:

    gucci belts for men, gucci belts, gucci mens belt, gucci mens belts.

  32. Avatar
    Criminal Records over 2 years later:

    When, what to my wondering eyes should appear, but a Template Method that was already there.

  33. Avatar
    Tenant Screening over 2 years later:

    I’m frequently see people doing the same mistakes when it comes to TDD. People test methods and implementations, which leads to tests that are too closely coupled to the implementation, difficult to maintain and refactor, and seems to slow down development and changes.

  34. Avatar
    ghd australia over 2 years later:

    GHD australia have fairly very rated for rather a few of elements just like pattern durability and ease of use.

  35. Avatar
    Monster beats over 2 years later:

    Headphonesyou like Bose Headphonesso Bose Earphonesthat Sony Earphonesno AKG Headphoneschoise Sony Headphonesand all kinds of headphones UKYou can see the Monster beatsdo monster beats headphonessale online Beats by dreyourcolleagues buy Beats dr dresuch as Beats dre and Beats by dr dreso on

  36. Avatar
    lv backpack over 2 years later:

    lv backpack have fairly very rated for rather a few of elements just like pattern durability and ease of use

  37. Avatar
    dswehfhh over 2 years later:

    We are the professional scarfs manufacturer, scarfs supplier, scarfs factory, custom scarfs.

  38. Avatar
    Sunglass over 2 years later:

    At fashion-world4u you find Imitation

  39. Avatar
    Yalova Emlak over 2 years later:

    Thanks for this article.I like its.As to me it’s good job.I wait ur next articles and I will read ur new articles.I come to this site.Because i like this site.

  40. Avatar
    Gucci Outlet Online over 2 years later:

    If psychologically prepared, all preparations have been completed!

  41. Avatar
    Disount Christian Louboutin over 2 years later:

    This is a superb posting, I identified your weblog web page executing study google for any related topic and came to this. I couldnt uncover to substantially supplemental info and details on this write-up, so it was pleasant to find this 1. I’ll in all probability finish up currently being again once more to appear at another content articles that you’ve got yet another time. yhm20110408 Disount Christian Louboutin

  42. Avatar
    okey oyunu oyna over 2 years later:

    Thanks uncle bob.

    Dunyanin en büyük online okey oyunu bu sitede sizleri bekliyor. Gerçek kisilerle sohbet ederek okey oyunu oyna ve internette online oyun oynamanin zevkini çikar.

  43. Avatar
    Hermes belts over 2 years later:

    Strongly recommended for shopping at Hermes belts store.

  44. Avatar
    Hermes belt over 2 years later:

    Hermes belt store offers high quality and cheap designer belts, please have a look.

  45. Avatar
    christian louboutin shoes on sale over 3 years later:

    Have the christian louboutin patent leather pumps is a happy thing. Here have the most complete kinds of christian louboutin leather platform pumps.

  46. Avatar
    Hancy over 3 years later:

    Hello Friend,Whichever style of Fashion Shoes you’re looking for, classical, fashionable, lovely or the latest design, you can find your favorite designer shoes in www.dunkpage.com ,several days ago I bought one pair of shoes from there,It’s beautiful and very comfortable!

  47. Avatar
    avocat algerien over 3 years later:

    It is an article that reaches our view point by point avocat constantine

  48. Avatar
    provillus over 3 years later:

    hmm ,i’m not sure if this is what i’m looking for but anyway this is interresting and could be useful some day,thanks for taking time to write such cool stuff

  49. Avatar
    Puma espera shoes over 3 years later:

    The fifty years history of PUMA are written in the history of the great accomplishments of movement. PUMA with Pele went into the final of World Cup championship,While with tennis player Beck always won at wimbledon lawn of soil. And made cooperation with the most of the top athletes and constantly strive for the latest technology to make the best sports equipment. Puma founder,Rudolph Deisler established the PUMA brand in 1948 in Germany.for decades puma has been the important actor in the sport.During the recent years, the more successful combination of pop sports,puma become one of the favorite brand for young people.

  50. Avatar
    Tips For Bowling over 3 years later:

    One of the best things to come out of the home computer revolution could be the general and widespread understanding of how severely limited logic really is.

  51. Avatar
    Injection mold over 3 years later:

    Intertech Machinery Inc. provides the most precise Plastic Injection Mold and Rubber Molds from Taiwan. With applying excellent unscrewing device in molds,

    Intertech is also very professional for making flip top Cap Molds in the world. Mold making is the core business of Intertech (Taiwan). With world level technology, Intertech enjoys a very good reputation for making Injection Mold and Plastic Molds for their worldwide customers.

Comments