Giter VIP home page Giter VIP logo

codekata-gildedrose's Introduction

CodeKata-GildedRose

Welcome to my solution to the GildedRose code kata. So first things first, what is the GildedRose? The GildedRose is a general store in the World of Warcraft universe that sells everything frome basic items and potions to legendary items and concert tickets. The GildedRose has contacted us to optimize and update their code.

Requirements from the GildedRose

I have linked the full set of requirements here but the basic idea is that there are:

  1. We have two classes namely Item and GildedRose.
  2. We can't make any changes to the Items class holding the information of the itmes, but we are allowed to make it static.
  3. We need to refractor (original GildedRose class here) the UpdateQuality method in the GildedRose class and we are allowed to make it static, but we need to use the same method called in the original code.
  4. We need to add code to handle a new item type.

Now, even though they have allowed me to change the classes to static, I have added the additional restriction that I'm not allowed to change the endpoints in any way that will require the client, or rather the goblin at the GildedRose, to make any changes other than including/replacing the files and everything should continue to work.

The solution

In the solution here I have used the Test Driven Development (TDD) method for ensuring that the code is still working and also to add and test the additional changes from the requirements. I also decided to use more switches where it made sense as a way of showing other solutions other than simple if else solutions.

I also included a seperate branch named "AlternativeSolution" where I used a similar idea but using extention methods and making the assumption that the GildedRose is using or has access to a data source that contains a list of all legendary items. In this code I'm also utilizing that possibility as part of the code. Now, it is hard coded in the solution, but I do mention there that it will need to connect to the source.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.