Giter Site home page Giter Site logo

gilded-rose-problem's Introduction

Here is my version of Gilded Rose problem in Python

Purpose

This coding challenge is to go over refactoring of code, using tests to ensure the code acts the same as before the refactoring. Also to make the code more manageable and readable, for future generations of developers or yourself if you are unlucky.

Assumptions I took

  1. Item quality cannot be less than 0 (Even when passed to the class as less than 0)
  2. Item quality cannot be more than 50 (Even when passed to the class as more than 50)
  3. Sulfuras is always 80

These assumptions are a little different to the original code. I would say that the requirements file is more valid for the approach than the existing code. Care would have to be taken rolling this out, as the outputs are slightly different. Picking up errors need to be handled on code refactoring not just making sure the new outputs match the existing outputs 100%.

Approach I took

  1. Write tests on the existing code (I aligned the test with the requirements sheet)
  2. Run tests on existing code to make sure it works
  3. Tests failed, as the outputs do not match the requirements sheet (I made the assumption that it was the source of truth)
  4. Refactor the code to make it more readable, reliable and improve the formatting
  5. Rerun the tests to ensure that the new code works as intended

gilded-rose-problem's People

Contributors

bradwebb101 avatar

Watchers

 avatar

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.