|
@@ -1,12 +1,74 @@
|
1
|
|
-------------------------------------------------------------------------
|
2
|
|
-This is the project README file. Here, you should describe your project.
|
3
|
|
-Tell the reader (someone who does not know anything about this project)
|
4
|
|
-all he/she needs to know. The comments should usually include at least:
|
5
|
|
-------------------------------------------------------------------------
|
6
|
|
-
|
7
|
|
-PROJECT TITLE:
|
8
|
|
-PURPOSE OF PROJECT:
|
9
|
|
-VERSION or DATE:
|
10
|
|
-HOW TO START THIS PROJECT:
|
11
|
|
-AUTHORS:
|
12
|
|
-USER INSTRUCTIONS:
|
|
1
|
+# Clean Code
|
|
2
|
+
|
|
3
|
+### **Objective:**
|
|
4
|
+* Refactor (aka clean up) the code in the `Inventory` class to make it more maintainable and readable.
|
|
5
|
+
|
|
6
|
+### **Purpose:**
|
|
7
|
+* To understand why writing test matter
|
|
8
|
+* To understand why writing readable code matter
|
|
9
|
+
|
|
10
|
+### **Instructions:**
|
|
11
|
+
|
|
12
|
+1. Fork this Repository
|
|
13
|
+ * [fork](https://help.github.com/articles/fork-a-repo/) this repository to your personal github account
|
|
14
|
+ * [clone](https://help.github.com/articles/cloning-a-repository/) **your** `forked` repository to your local machine.
|
|
15
|
+ * clean up the code in the `Inventory` class
|
|
16
|
+ * commit your changes
|
|
17
|
+ * submit a `pull request` which compares Zipcoder your branch with the branch level (eg. if you work on level2, the base should be zipcode's level2 branch compare to your level2 branch)
|
|
18
|
+3. DO NOT CHANGE THE TEST
|
|
19
|
+
|
|
20
|
+# Levels
|
|
21
|
+This lab is divided into two levels. If you are 90% done with your labs or if you want to challenge yourself, get level2 with `git checkout level2` after you clone the repository. Otherwise, work on the master branch.
|
|
22
|
+
|
|
23
|
+# Part 1 - Original Description of the Gilded Rose
|
|
24
|
+
|
|
25
|
+Hi and welcome to team Gilded Rose. As you know, we are a small inn
|
|
26
|
+with a prime location in a prominent city run by a friendly innkeeper
|
|
27
|
+named Allison. We also buy and sell only the finest
|
|
28
|
+goods. Unfortunately, our goods are constantly degrading in quality as
|
|
29
|
+they approach their sell by date. We have a system in place that
|
|
30
|
+updates our inventory for us. It was developed by a no-nonsense type
|
|
31
|
+named Leeroy, who has moved on to new adventures. Your task is to add
|
|
32
|
+the new feature to our system so that we can begin selling a new
|
|
33
|
+category of items. First an introduction to our system:
|
|
34
|
+
|
|
35
|
+- All items have a SellIn value which denotes the number of days we
|
|
36
|
+ have to sell the item
|
|
37
|
+- All items have a Quality value which denotes how valuable the item
|
|
38
|
+ is
|
|
39
|
+- At the end of each day our system lowers both values for every item
|
|
40
|
+
|
|
41
|
+Pretty simple, right? Well this is where it gets interesting:
|
|
42
|
+
|
|
43
|
+ - Once the sell by date has passed, Quality degrades twice as fast
|
|
44
|
+ - The Quality of an item is never negative
|
|
45
|
+ - "Aged Brie" actually increases in Quality the older it gets
|
|
46
|
+ - The Quality of an item is never more than 50
|
|
47
|
+ - "Sulfuras", being a legendary item, never has to be sold or
|
|
48
|
+ decreases in Quality
|
|
49
|
+ - "Backstage passes", like aged brie, increases in Quality as it's
|
|
50
|
+ SellIn value approaches; Quality increases by 2 when there are 10
|
|
51
|
+ days or less and by 3 when there are 5 days or less but Quality
|
|
52
|
+ drops to 0 after the concert
|
|
53
|
+
|
|
54
|
+Just for clarification, an item can never have its Quality increase
|
|
55
|
+above 50, however "Sulfuras" is a legendary item and as such its
|
|
56
|
+Quality is 80 and it never alters.
|
|
57
|
+
|
|
58
|
+DO NOT alter the Item class or Items property as those belong to the goblin
|
|
59
|
+in the corner who will insta-rage and one-shot you as he doesn't
|
|
60
|
+believe in shared code ownership (you can make the UpdateQuality
|
|
61
|
+method and Items property static if you like, we'll cover for
|
|
62
|
+you).
|
|
63
|
+
|
|
64
|
+## Part 2 - Add a new item
|
|
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.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+This was "borrowed" from [alexaitken](https://github.com/alexaitken/GildedRose_java) which originated from [Bobby Johnson's Blog](https://iamnotmyself.com/2011/02/13/refactor-this-the-gilded-rose-kata/).
|