This program automates the inventory management process. It accepts a properly formatted input file and outputs
an adjusted inventory to another (output) file. The input file must be formatted according to these rules:
- The file must have one inventory item per line
- The file must be delimited by spaces.
- The column order is fixed: Name, Sell in period, Quality metric
- The name may contain spaces. The program will always look for the last two columns and treat them as their respective values
The program requires the following command line arguments:
- The input file name
- The output filename
Example: GildedRose Input.txt Output.txt
The Input.txt file exists at the root of the repo so the program can easily be tested. The program will automatically create the Output.txt file.
The program will return 0 on success and any errors will be output to std out.
An example input file is shown below:
Backstage passes 9 2
Sulfuras 2 2
Both lines are parsed as follows
Name | Sell In Period | Quality |
---|---|---|
Backstage passes | 9 | 2 |
Sulfuras | 2 | 2 |
The name is currently used as a key to indicate the product type. The list of valid values are:
- "Aged Brie"
- "Backstage passes"
- "Sulfuras"
- "Normal Item"
- "Conjured"
If an invalid name is specified, the item will be replaced by "NO SUCH ITEM" when outputting the updated inventory.
- The main entry point needs to be refactored to allow for correct integration testing and to improve readability. I really hate how big it is right now. This would be the first thing I did if I had more time.
- The directory structure needs to be tidied up to make clear the purpose behind the various classes
- A couple of the factory objects are not DRY. I would like to resolve this.
- If this is likely to be extended further I would be nice to introduce dependency injection
- Make use a factory method/mock item in the unit tests to remove the allocation of Items
- More comments to describe the correct behaviour of the unit tests
- Tidy up visibility of class members (make things internal that don't need to be public).