Gilded Rose is the solution for a coding exercise problem named after the same name. The original prompt can be found at the bottom of this page, and the working solution is outline below.
- Gradle - Build Framework
- PMD - Static Analysis Tool
- JUnit 5 - Java Unit Testing Framework
- Karma - JavaScript Unit Testing Framework
- PiTest - Mutation Testing Tool
- Spring Boot - Opinionated Server-Side Java Spring Framework
- Angular - Client-Side JavaScript Framework
The GildedRose application is structured as a gradle multi-project build.
To build all components use:
gradlew build
To build an individual project typically you will use:
gradlew :<project-name>:mainBuild
Certain projects may have different commands to build. Those commands are documented in the
README.md
of those projects.
The application is split between Heroku for hosting the server project and Github Pages for the web project.
- The Procfile and system.properties control the Heroku deployment.
- The docs folder controls the content deployed to Github Pages (and is rebuilt via
gradlew deploy
).
The names of the various projects can be found in one of two ways:
-
Execute
gradlew projects
-
Check the settings.gradle file's
include
list
-
Add a folder in this directory for the new project
-
Add the name of the folder to the
include
list in settings.gradle -
Add a
build.gradle
to the new project folder for any project-specific build configuration -
Add a
src
folder to the project
For Java projects PMD
is used to analyze the code and enforce code quality.
PMD
is executed via the build, but to run it directly the following command can be used:
gradlew pmdMain pmdTest
To build upon and override the default rule set, a custom local configuration is used: pmd-exclusions.xml
For Java projects PiTest
is used to analyze test quality through Mutation Testing.
PiTest
is not ran via the build to avoid enforcing an arbitrary mutation coverage.
It can be executed via the following command:
gradlew pitest
Tests can be executed via
gradlew test
Hi and welcome to team Gilded Rose. As you know, we are a small inn with a prime location in a prominent city run by a friendly innkeeper named Allison. We also buy and sell only the finest goods. Unfortunately, our goods are constantly degrading in quality as they approach their sell by date. We need you to write a system that allows us to manage our inventory, so that we are able to service all of the adventurers who frequent our store (we don't want to run out of healing potions when an tiefling comes in unlike last time - poor Leeroy).
Here are the basic rules for the system that we need:
- All items have a SellIn value which denotes the number of days we have to sell the item
- All items have a Quality value which denotes how valuable the item is
- At the end of each day our system lowers both values for every item
Since this is the real world, there are some edge cases we need for you to account for as well:
- Once the sell by date has passed, Quality degrades twice as fast
- The Quality of an item is never negative
- "Aged Brie" actually increases in Quality the older it gets
- The Quality of an item is never more than 50
- "Sulfuras", being a legendary item, never has to be sold or decreases in Quality
- "Backstage passes", like aged brie, increases in Quality as it's SellIn value approaches; Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but Quality drops to 0 after the concert
- "Conjured" items degrade in Quality twice as fast as normal items
- An item can never have its Quality increase above 50, however "Sulfuras" is a legendary item and as such its Quality is 80 and it never alters.
We currently keep our inventory in a hand written list. Since Allison wants to get home at night, we keep the writing to a minimum. Each line has the following information, in order:
- Item Name
- Item Category
- Sell In
- Quality
- There is no requirement for what you choose as your interface into the system, however whatever interface you choose should, at a minimum, provide for the following commands:
- Ask for the entire list of inventory
- Ask for the details of a single item by name
- Progress to the next day
- List of trash we should throw away (Quality = 0)
- In this repo, you will find an inventory.txt file. This is the initial inventory your solution should load. After that, you may store the data however you wish.
Please use whatever technology and techniques you feel are applicable to solve the problem. We suggest that you approach this exercise as if this code was part of a larger system. The end result should be representative of your abilities and style.
Please fork this repository, then when you have completed your solution, issue a pull request to notify us that you are ready for us to review your submission.
Have fun.
Here are a couple of thoughts about the domain that could influence your response:
- The world is a magical place - you never know when the next "special requirement" might pop up - how can you make this painless?
- Keep in mind that accurate inventory is a must for the shop, how might you ensure that the future programmer who takes over the code while you are off adventuring doesn't mistakenly mess things up?