This test revolves around a refactoring excercise called The Gilded Rose.
It can be completed in any of the following programming languages:
- C#
- JavaScript
- PHP
- Python
- TypeScript
- Visual Basic
Download the code in this repository and complete the test using your programming language of choice. For each language, there is a unit test file and an example simulation program to help get you started.
When your solution is ready, send us the link to your submission (e.g. public Github repository or similar). Don't forget to include any additional instructions on how to build or run your solution, especially if you have introduced any new frameworks.
As the task is refactoring based, a solution is widley open to developer interpretation and offers the opportunity for a candidate to showcase their broader skillset.
There is no correct solution as such. Instead, you may be invited to justify your solution based on your approach and the technical design decisions you have made. You are welcome to include a new README file with your submission to assist with justification of your work.
Feel free to go above and beyond the initial requirements specification if desired. For example, you may think of an additional requirement and illustrate how your refactored code allows you to implement this efficiently.
You can spend as long as you like working on your submission, however a typical solution should take no more than 2-3 hours.
Hi and welcome to team Gilded Rose. As you may already know, we are a small inn with a prime location in a
prominent city ran by a friendly innkeeper. 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 have a system in place that updates our inventory for us, however its codebase is very basic and is becoming increasingly difficult for us to maintain when we want to add or update functionality.
Your task is to improve the quality of our codebase, and also add a new feature to our system so that we can begin selling a new category of items. First an introduction to our system:
- All
itemshave aSellInvalue which denotes the number of days we have to sell theitems - All
itemshave aQualityvalue which denotes how valuable the item is - At the end of each day our system lowers both values for every item
Pretty simple, right? Well this is where it gets interesting:
- Once the sell by date has passed,
Qualitydegrades twice as fast - The
Qualityof an item is never negative - "Aged Brie" actually increases in
Qualitythe older it gets - The
Qualityof an item is never more than40 - "Sulfuras", being a legendary item, never has to be sold or decreases in
Quality - "Backstage passes", like aged brie, increases in
Qualityas itsSellInvalue approaches;Qualityincreases by3when there are7days or less and by4when there are2days or less butQualitydrops to0after the concert
We have recently signed a supplier of conjured items. This requires an update to our system:
- "Conjured" items degrade in
Qualitytwice as fast as normal items
Feel free to make any changes to the UpdateQuality method and add any new code as long as everything
still works correctly. However, you must NOT alter the Item class or any of its properties.
We are looking for candidates to successfully demonstrate the following criteria to be progressed to the stage in our application process:
- Have shown an understanding and appreciation for the rules of the test
- Solution compiles and/or runs on all assessor machines (using any additional and reasonable instructions provided)
- Have successfully implemented the new feature request
- Demonstrated a clear attempt at code refactoring
- Demonstrated a clear understanding of software testing
- Solution contains few or zero bugs
- Solution does NOT contain evidence of over-reliance on AI (please refrain from doing this, we are looking to assess your own skills and potential. Submissions that show over-reliance on AI will not be progressed)
- Solution does NOT contain signs of private, plagiarised, inappropriate or malicious material
- Demonstrated technical capability in their submission, assessed through the following areas:
- Readability
- Maintainability
- Complexity
- Performance
- Any documented design decision justifications
The test source code is forked and adapted from the public original, which can be found here: https://github.com/emilybache/GildedRose-Refactoring-Kata