|
| 1 | +# The Gilded Rose Code Kata |
| 2 | + |
| 3 | +This is a Java version of the Gilded Rose Kata, original found |
| 4 | +[here](http://www.iamnotmyself.com/2011/02/13/RefactorThisTheGildedRoseKata.aspx). |
| 5 | + |
| 6 | + |
| 7 | +## A few small changes |
| 8 | + |
| 9 | +* After seeing jim weirich [ruby port](http://github.com/jimweirich/gilded_rose_kata) I also included tests in the project for the original functionality. |
| 10 | + |
| 11 | +* I have moved the hard coded items to the default constructor and gave an alternative constructor to allows the tests to inject the list of items. |
| 12 | + |
| 13 | + |
| 14 | +## Setup |
| 15 | + |
| 16 | +This has been setup as an eclipse project. I have not provided an ant build file or a maven pom. |
| 17 | +* To setup create a new java project in eclipse. (check out the code from git hub directly or import it into your java project) |
| 18 | +* add the junit 4 library to your build path. |
| 19 | +* include both the test and src directory as "Source Folders" |
| 20 | +* right click the project and run as JUnit test |
| 21 | + |
| 22 | + |
| 23 | +## Branches |
| 24 | + |
| 25 | +* The 'master' branch contains the starting point for the kata. It is |
| 26 | + also tagged as 'start-here'. |
| 27 | + |
| 28 | +* The 'solution' branch is my first solution for this kata. Feedback welcome! |
| 29 | + |
| 30 | +It was fun. You should give it a try! |
| 31 | + |
| 32 | +Alex |
| 33 | + |
| 34 | + |
| 35 | +# Original Description of the Gilded Rose |
| 36 | + |
| 37 | +Hi and welcome to team Gilded Rose. As you know, we are a small inn |
| 38 | +with a prime location in a prominent city ran by a friendly innkeeper |
| 39 | +named Allison. We also buy and sell only the finest |
| 40 | +goods. Unfortunately, our goods are constantly degrading in quality as |
| 41 | +they approach their sell by date. We have a system in place that |
| 42 | +updates our inventory for us. It was developed by a no-nonsense type |
| 43 | +named Leeroy, who has moved on to new adventures. Your task is to add |
| 44 | +the new feature to our system so that we can begin selling a new |
| 45 | +category of items. First an introduction to our system: |
| 46 | + |
| 47 | +- All items have a SellIn value which denotes the number of days we |
| 48 | + have to sell the item |
| 49 | +- All items have a Quality value which denotes how valuable the item |
| 50 | + is |
| 51 | +- At the end of each day our system lowers both values for every item |
| 52 | + |
| 53 | +Pretty simple, right? Well this is where it gets interesting: |
| 54 | + |
| 55 | + - Once the sell by date has passed, Quality degrades twice as fast |
| 56 | + - The Quality of an item is never negative |
| 57 | + - "Aged Brie" actually increases in Quality the older it gets |
| 58 | + - The Quality of an item is never more than 50 |
| 59 | + - "Sulfuras", being a legendary item, never has to be sold or |
| 60 | + decreases in Quality |
| 61 | + - "Backstage passes", like aged brie, increases in Quality as it's |
| 62 | + SellIn value approaches; Quality increases by 2 when there are 10 |
| 63 | + days or less and by 3 when there are 5 days or less but Quality |
| 64 | + drops to 0 after the concert |
| 65 | + |
| 66 | +We have recently signed a supplier of conjured items. This requires an update to our system: |
| 67 | + |
| 68 | +- "Conjured" items degrade in Quality twice as fast as normal items |
| 69 | + |
| 70 | +Feel free to make any changes to the UpdateQuality method and add any |
| 71 | +new code as long as everything still works correctly. However, do not |
| 72 | +alter the Item class or Items property as those belong to the goblin |
| 73 | +in the corner who will insta-rage and one-shot you as he doesn't |
| 74 | +believe in shared code ownership (you can make the UpdateQuality |
| 75 | +method and Items property static if you like, we'll cover for |
| 76 | +you). Your work needs to be completed by Friday, February 18, 2011 |
| 77 | +08:00:00 AM PST. |
| 78 | + |
| 79 | +Just for clarification, an item can never have its Quality increase |
| 80 | +above 50, however "Sulfuras" is a legendary item and as such its |
| 81 | +Quality is 80 and it never alters. |
0 commit comments