Thursday, October 22, 2009

Boy Scout Rule

So I was happily coding the other day and ran across some code new to me. Mind you we used to have something like 8 developers on our team over the last couple of years and now we have 3. So naturally there are parts of the codebase I have not seen before. Anyway, the code looked like this:



I saw the todos commented above each method and thought I could tidy these up a bit. It wouldn't take long. So here is what I ended up with:



It took me five minutes and was a nice confidence booster to keep me going on my regular task at hand. So the lesson for the day is follow the "boy scout rule" which is nicely described here by Uncle Bob Martin: http://www.informit.com/articles/article.aspx?p=1235624&seqNum=6

1 comment: