Gilded Rose Refactoring Kata

repository·main·Indexed 26 days ago

https://github.com/emilybache/gildedrose-refactoring-kata

A practice exercise for developers to improve refactoring legacy code and designing test cases. This repository provides a codebase with complex logic and various testing options, including unit tests and approval tests, across multiple programming languages such as ABAP, Bash, C, C++, C#, Clojure, Common Lisp, Delphi, Elm, and Erlang.

Tokens
16.9K
Snippets
97
Records
196
Agent score
87%

What's inside gildedrose-refactoring-kata

  1. Understand the Gilded Rose Item properties and update logic

    main

    The Gilded Rose system manages inventory items using a specific set of rules. All items are represented by an Item class with two primary properties:

    • SellIn: An integer representing the number of days remaining to sell the item.
    • quality: An integer representing the item's value.

    At the end of each day, the system calls the updateQuality method to decrement the SellIn value and adjust the quality based on the item's specific rules.

  2. Understand the Gilded Rose system requirements

    main

    The Gilded Rose system manages inventory quality and sell-by dates. You must implement or maintain the updateQuality method which processes items based on their SellIn (days remaining to sell) and Quality (value of the item) properties.

    Core Rules

    • General Degradation: At the end of each day, SellIn and Quality are decremented. Once SellIn passes, Quality degrades twice as fast.
    • Minimum Quality: Quality can never be negative.
    • Maximum Quality: Quality generally cannot exceed 50, except for legendary items.

    Item-Specific Behaviors

    • Aged brie: Increases in Quality by 1 each day. Once SellIn is passed, it increases by 2.
    • Sulfuras (Legendary): Does not degrade in Quality and has no SellIn requirement. Its Quality is immutable at 80.
    • Backstage passes: Increases in Quality as the concert approaches:
      • 10 days or less: Quality increases by 2.
      • 5 days or less: Quality increases by 3.
      • Once SellIn is passed: Quality drops to 0.

    New Requirement (The Task)

    • Conjured items: These items degrade in Quality twice as fast as normal items.
  3. Gilded Rose System Rules and Requirements

    main

    The Gilded Rose is an inventory management system where items have SellIn (days remaining to sell) and Quality (item value) values. You must implement or update the logic to handle item degradation and value changes according to these rules:

    General Rules

    • Every day, both SellIn and Quality decrease by 1.
    • Once the SellIn period expires, the Quality value decreases twice as fast.
    • Quality can never be negative.
    • Quality cannot exceed 50 (except for specific legendary items).

    Item-Specific Rules

    • Aged Brie: Quality increases as SellIn decreases.
    • Sulfuras: A legendary item. It does not need to be sold, and its Quality never changes. Its Quality is fixed at 80.
    • Backstage passes: Quality increases as SellIn approaches zero:
      • Within 10 days: Quality increases by 2 each day.
      • Within 5 days: Quality increases by 3 each day.
      • After the concert (when SellIn is 0 or less): Quality drops to 0.

    New Requirement: Conjured Items

    • Conjured items degrade in Quality at twice the rate of normal items.
  4. Use the TextTest Graphical User Interface (GUI)

    main

    TextTest provides a GUI to manage and run test cases. To use the GUI effectively with this repository:

    1. Set the TEXTTEST_HOME environment variable to the root folder of this repository.
    2. Launch the TextTest GUI.
    3. Select a test case and click "Run".
    4. If a test fails, double-click a file to view the diff against the Golden Copy.