Code Monkey home page Code Monkey logo

gilded-rose-typescript's Introduction

Gilded Rose Typescript

๐Ÿšง ย  work in progress ย ๐Ÿšง

Attempts

1. Violated Rules

Code: Attempt 1

The description says:

(...) do not alter the Item class

And that's exactly what I did ๐Ÿ™ˆ I added updateQuality method to Item class, so that when GildedRose was iterating over its items, it was invoking that method. This allowed each special item to have its own version of updadeQuality with some special conditions.

Conjured Item implementation works, but I'm not really happy with this solution.

2. Heavily inspired by Sandi Metz

Code: Attempt 2

In this approach I tried to apply what I learned by watching the talk by Sandi Metz. Copying her solution 1-to-1 is not possible, for number of reasons:

  1. She uses Ruby, not TypeScript.
  2. Her version of the Kata is a bit simplified, which in my opinion is understandable, because when you give a talk you want to focus on the key concepts, and don't delve into some corner cases. Nevertheless, here are some differences:
    • Her GildedRose class doesn't have items that it iterates over, there is just one item being handled.
    • Some edge cases are not handled, e.g. in her implementation it'd be possible to increment the quality "Aged Brie" to 51.
    • In her version a normal/common item has property name of "normal", whereas in original Kata, any item which name is not "Aged Brie", "Backstage passes", "Sulfuras" or "Conjured" is considered normal.

Resources

The exercise's content comes from emilybache/GildedRose-Refactoring-Kata repo.

RailsConf 2014 - All the Little Things by Sandi Metz

gilded-rose-typescript's People

Contributors

sitek94 avatar

Watchers

 avatar  avatar

Forkers

maiksensi

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.