Wednesday, April 4, 2012

A Brand New Approach to the Gilded Rose Kata

Today, I have completed the Gilded Rose Kata for the third and final time. Below are my notes:

  • Instead of focusing on TDD, I decided to use a test suite from my previous attempt at the kata.
  • I refactored the updateQuality() method to simply iterate through the item list apply rules to the items, if there are any.
  • The rules have been changed to be stored in a HashMap. Whenever I wanted to apply rules to an item, I could simply access the item's list of rules by using the item's name as a key.
  • Each rule consists of a sellIn point, a qualityChange amount, and a sellInChange amount.
  • I decided that no rule would cancel out another rule, unless it is explicitly told to do so.
  • Refactoring the updateQuality() method while having the test cases in place was fun!

To revisit my notes for my previous attempts at the Gilded Rose Kate, please visit these previous blog entries: 1, 2.

P.S. I would have to say that my level of self-awareness of copying code is II. Please see what the levels mean in my learning plan.

No comments:

Post a Comment