• Stars
    star
    202
  • Rank 193,691 (Top 4 %)
  • Language
    Ruby
  • Created over 13 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The Gilded Rose Code Cata

The Gilded Rose Code Kata

This is a Ruby version of the Gilded Rose Kata, found here.

This is a refactorying kata, so you will be starting with a legacy code base. To work the Kata, clone this git repository and checkout the tag 'start-here'. Read the description below for the "rules" involving this kata.

Changes from the original

This Ruby version follows the original code very closely, but has the following changes:

  • The original had no tests. Since this is a refactoring kata, I feel the tests are important and provide a fairly complete test suite. Just delete the tests if you wish to "go it alone".

  • The original used a hard coded set of "items", presumably for testing the code. Since I added a test suite, the hard coded values were not of much use. I also changed the interface to accept a list of items as a parameter rather than a hard coded constant.

You can read the original kata article for more details.

Installation Hints

The easiest way is to use bundler to install the dependencies. To do so, you need to install the bundler gem if you haven't already done so

gem install bundler

run bundler

bundle

and should be ready to go. Alternatively, you can install the dependencies one by one using gem install, e.g.

gem install rspec-given

Have a look at the Gemfile for all dependencies.

Git Branches

  • The 'master' branch contains the starting point for the kata. It is also tagged as 'start-here'.

  • The 'solution1' branch is my first solution for this kata.

Hope you enjoy this. -- Jim Weirich

Original Description of the Gilded Rose

Hi and welcome to team Gilded Rose. As you know, we are a small inn with a prime location in a prominent city run by a friendly innkeeper named Allison. We also buy and sell only the finest goods. Unfortunately, our goods are constantly degrading in quality as they approach their sell by date. We have a system in place that updates our inventory for us. It was developed by a no-nonsense type named Leeroy, who has moved on to new adventures. Your task is to add the new feature to our system so that we can begin selling a new category of items. First an introduction to our system:

  • All items have a SellIn value which denotes the number of days we have to sell the item
  • All items have a Quality value which denotes how valuable the item is
  • At the end of each day our system lowers both values for every item

Pretty simple, right? Well this is where it gets interesting:

  • Once the sell by date has passed, Quality degrades twice as fast
  • The Quality of an item is never negative
  • "Aged Brie" actually increases in Quality the older it gets
  • The Quality of an item is never more than 50
  • "Sulfuras", being a legendary item, never has to be sold or decreases in Quality
  • "Backstage passes", like aged brie, increases in Quality as it's SellIn value approaches; Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but Quality drops to 0 after the concert

We have recently signed a supplier of conjured items. This requires an update to our system:

  • "Conjured" items degrade in Quality twice as fast as normal items

Feel free to make any changes to the UpdateQuality method and add any new code as long as everything still works correctly. However, do not alter the Item class or Items property as those belong to the goblin in the corner who will insta-rage and one-shot you as he doesn't believe in shared code ownership (you can make the UpdateQuality method and Items property static if you like, we'll cover for you). Your work needs to be completed by Friday, February 18, 2011 08:00:00 AM PST.

Just for clarification, an item can never have its Quality increase above 50, however "Sulfuras" is a legendary item and as such its Quality is 80 and it never alters.

More Repositories

1

rspec-given

Given/When/Then keywords for RSpec Specifications
Ruby
652
star
2

builder

Provide a simple way to create XML markup and data structures.
Ruby
362
star
3

wyriki

Experimental Rails application to explore decoupling app logic from Rails.
CSS
272
star
4

re

Regular Expression Construction
Ruby
181
star
5

argus

Ruby API for controlling a Parrot AR Drone
Ruby
117
star
6

swimlanes

Draw git repositories in swim lane notation
JavaScript
113
star
7

sorcerer

Generate Ruby source from a Ripper style AST
Ruby
99
star
8

flexmock

Flexible mocking for Ruby testing
Ruby
93
star
9

sicp-study

Study Group Worked Exercises from "The Structure and Interpretation of Computer Programs"
Scheme
86
star
10

presentation_solid_ruby

SOLID Ruby Design Principles Presentation
Ruby
74
star
11

Given

A Given/When/Then Specification Framework
Ruby
60
star
12

emacs-setup

Emacs Setup and Customization
Emacs Lisp
59
star
13

presentation_connascence

The Grand Unifying Theory of Software Development: Connascence
Ruby
49
star
14

lambda_fizz

The Classic FizzBuzz program implemented in pure Ruby-Flavored Lambda Calculus
Ruby
47
star
15

emacs-setup-esk

My Emacs Setup based on the Emacs Starter Kit (ESK)
Emacs Lisp
45
star
16

bnr-ios-rubymotion

Big Nerd Ranch Guide to iOS Programming Examples in RubyMotion
Ruby
41
star
17

texp

Temporal Expressions for Ruby
Ruby
40
star
18

emacs-starter-kit

A Starter Kit for Rubyists wanting to use Emacs
Emacs Lisp
29
star
19

presentation_source_control

Source Control for People Who Don't Like Source Control
25
star
20

dim

DIM - Dependency Injection - Minimal
Ruby
25
star
21

sudoku

A Simple Sudoku Solver
Ruby
22
star
22

irb-setup

My setup and initialization files for irb
Ruby
18
star
23

presentation_enterprise_mom

What the Enterprise Can Learn From Your Mom presentation for erubycon 2008. (Aka "What? Threads are Hard?")
Ruby
18
star
24

presentation_10papers

10 Papers -- Really Fast
Ruby
17
star
25

presentation_writing_solid_ruby_code

How to Write Robust Ruby Programs
Ruby
16
star
26

partially_valid

A Rails plugin that allows validation on partially completed Active Record models (useful in wizards that incrementally build a model).
Ruby
16
star
27

pair_programming_bot

Pair Programming Bot iPhone Application
Ruby
16
star
28

presentation_ynot

Keynote and practice files for the Y-Not Talk (deriving the y-combinator from first principles)
15
star
29

rava

Ruby Code for Java Developers
Ruby
14
star
30

gotags

Simple TAGS file generator written in go (compare to ctags or exuberant_ctags)
Go
13
star
31

presentation_agile_engineering_practices

Agile Engineering Practices Overview
13
star
32

presentation_testing_why_dont_we_do_it_like_this

A presentation on ways to improve the way we do testing in an agile process.
Ruby
13
star
33

presentation_kata_and_analysis

A Presentation on a simple code kata and an analysis of the decisions made throughout the coding session.
Ruby
11
star
34

beer_song

Beer Song Kata (courtesy of Sandi Metz)
9
star
35

dudley

Techniques for Decoupling your application logic from Rails (or any web framework for that matter).
Ruby
9
star
36

BankOcrKata

Ruby solution to the Bank OCR Kata described at http://www.codingdojo.org/cgi-bin/wiki.pl?KataBankOCR
Ruby
9
star
37

presentation-connascence-examined

Connascence Examined Presentation
Java
9
star
38

polite_programmer_presentation

The Polite Programmer Presentation
Ruby
9
star
39

presentation_parenthetically_speaking

Keynote Presentation on SICP
Ruby
8
star
40

present_code

Tools for autoupdating Keynote presentations from a live code base.
Ruby
8
star
41

presentation_playing_it_safe

Presentation on Writing Good Library Code in Ruby
JavaScript
7
star
42

presentation_event-vs-cells

Presentation given at Big Ruby on Evented vs Celluloid
Ruby
7
star
43

presentation_to_infinity

Mountain Ruby Keynote - Don't be afraid to pioneer your ideas
6
star
44

RakePresentations

Rake Boot Camp and Power Rake Presentations
Ruby
6
star
45

polite_programmer_blog

The Blog of the Polite Programmers
6
star
46

sample_friends_app

This is a sample Rails app where I play around with some queries.
Ruby
5
star
47

presentation_flying_robots

Presentation on Controlling AR Drone with Ruby
4
star
48

Personography

Personal Project for Jenny
Ruby
4
star
49

project_euler_solutions

My solutions for the Project Euler problem set.
Ruby
4
star
50

rakedocs

Documents for the Rake Build System
CSS
3
star
51

jsblogger_sample

Sample Implementation of JS Blogger
Ruby
3
star
52

presentation-given

RSpec Given/When/Then Presentation
Ruby
2
star
53

protection_proxy

A proxy that protects against updates of selected fields
Ruby
2
star
54

example_blogger_with_seo

This is a version of the JumpStart blogger example with SEO url mapping
Ruby
1
star
55

travis_ci_flexmock_debug

A Project using FlexMock that can be deployed onto Travis-CI to see why flexmock isn't picked up.
Ruby
1
star