Code Monkey home page Code Monkey logo

gildedrose-refactoring-kata's Introduction

I started by adding test coverage for the specification in the pdf as I understood it. php/tests/GildedRoseTest.php I evolved this coverage as I went, ensuring it passed for every commit, and exploring any edges cases as I discovered them.

I then implemented the conjured items requirement (interpreted a little creatively to mean any item with the string 'conjured' in its name) by first adding a failing test case, then added an implementation that required very little change to the code.

Once I was satisfied this worked I set about a gradual step by step refactoring of the GildedRose class to untangle the logic, reduce complexity, improve readability and remove repetition. I relied on the test coverage I had added to give me confidence in my changes.

If I had more time, the next steps I would take are:

  • Setup github actions to run the test suite on every commit.
  • (forbidden in the exercise rules) Rework the domain model significantly so that the data Item objects use timestamps to denote when they came into stock and not incrementing counters. Items could have they're status calculated in real time based on the current date rather needing to run a process each day to increment the counters.
  • Introduce an item type system using enums so that logic can be associated with an item's type rather relying on inspecting the string names of items. I hinted at this flexibility in the way I implemented conjured items as multiple possible items rather than one specific item name.

I hope you think it's a good submission, and if not any feedback is welcomed!

gildedrose-refactoring-kata's People

Contributors

shkeats avatar

Watchers

Adam Smith avatar  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.