Starting code for the GildedRose Refactoring Kata in many programming languages.
Go to file
2023-01-16 08:17:49 +01:00
abap
Ada
c99
C
clojure Add Clojure translation 2022-09-25 20:41:30 +02:00
COBOL Add add script that helps you add items 2022-09-26 15:28:05 +02:00
commonlisp
cpp Fix syntax errors in cpp kata 2022-05-13 21:24:02 +02:00
cpp-catch2
csharp
csharpcore
csharpcore-Verify.xunit update .net version 2022-12-07 08:23:51 +01:00
d
dart
Delphi
elixir
elm
erlang
fortran
fsharp
fsharp-core
go feat: update go boilerplate 2022-04-26 16:27:42 +01:00
Groovy Added Gradle to Groovy project. 2022-08-26 13:51:13 -05:00
haskell
Java make the gradle task for texttest slightly easier to use 2022-12-02 08:10:07 +01:00
Java-Approvals
Java-Cucumber
Java-Spock
js-jasmine
js-jest
js-mocha
julia Fix Item parametric type 2022-11-28 18:31:04 -08:00
Kotlin
lfe
pascal
perl
perl6
php Bump to PHP 8.0+ 2023-01-07 17:19:35 +00:00
plantuml
plpgsql
plsql
python
R
ruby
rust
scala
scheme
Smalltalk
sql
swift a - Apply SwiftFormat 2022-06-10 11:30:11 -07:00
texttests
TypeScript Readme updated 2022-02-10 10:13:36 +01:00
vbnet Add VB.NET implementation 2022-03-16 20:35:25 -04:00
xslt
.bettercodehub.yml
.gitignore
GildedRoseRequirements_de.md improve language 2022-02-11 21:08:27 +01:00
GildedRoseRequirements_es.md
GildedRoseRequirements_fr.md removed a word that didn't mean anything in the sentence in french 2022-11-07 09:31:27 +01:00
GildedRoseRequirements_jp.md
GildedRoseRequirements_kr.md Update GildedRoseRequirements_kr.md 2023-01-12 14:08:50 +09:00
GildedRoseRequirements_pl.md add polish translation of requirements 2022-06-09 20:17:36 +02:00
GildedRoseRequirements_pt-BR.md
GildedRoseRequirements_ru.txt
GildedRoseRequirements_th.md
GildedRoseRequirements_zh.txt
GildedRoseRequirements.txt
license.txt
README.md remove BetterCode Hub, since it's no longer working. Improve info on TextTest. 2023-01-16 08:17:49 +01:00

Gilded Rose Refactoring Kata

This Kata was originally created by Terry Hughes (http://twitter.com/TerryHughes). It is already on GitHub here. See also Bobby Johnson's description of the kata.

I translated the original C# into a few other languages, (with a little help from my friends!), and slightly changed the starting position. This means I've actually done a small amount of refactoring already compared with the original form of the kata, and made it easier to get going with writing tests by giving you one failing unit test to start with. I also added test fixtures for Text-Based approval testing with TextTest (see the TextTests)

As Bobby Johnson points out in his article "Why Most Solutions to Gilded Rose Miss The Bigger Picture", it'll actually give you better practice at handling a legacy code situation if you do this Kata in the original C#. However, I think this kata is also really useful for practicing writing good tests using different frameworks and approaches, and the small changes I've made help with that. I think it's also interesting to compare what the refactored code and tests look like in different programming languages.

I use this kata as part of my work as a technical coach. I wrote a lot about the coaching method I use in this book Technical Agile Coaching with the Samman method. A while back I wrote this article "Writing Good Tests for the Gilded Rose Kata" about how you could use this kata in a coding dojo.

How to use this Kata

The simplest way is to just clone the code and start hacking away improving the design. You'll want to look at the "Gilded Rose Requirements" which explains what the code is for. I strongly advise you that you'll also need some tests if you want to make sure you don't break the code while you refactor.

You could write some unit tests yourself, using the requirements to identify suitable test cases. I've provided a failing unit test in a popular test framework as a starting point for most languages.

Alternatively, use the "Text-Based" tests provided in this repository. (Read more about that in the next section)

Whichever testing approach you choose, the idea of the exercise is to do some deliberate practice, and improve your skills at designing test cases and refactoring. The idea is not to re-write the code from scratch, but rather to practice designing tests, taking small steps, running the tests often, and incrementally improving the design.

Gilded Rose Requirements in other languages

Text-Based Approval Testing

Most language versions of this code have a TextTest fixture for Approval testing. For information about this, see the TextTests README

Translating this code

More translations are most welcome! I'm very open for pull requests that translate the starting position into additional languages.

Please note a translation should ideally include:

  • a translation of the production code for 'update_quality' and Item
  • one failing unit test complaining that "fixme" != "foo"
  • a TextTest fixture, ie a command-line program that runs update_quality on the sample data for the number of days specified.

Please don't write too much code in the starting position or add too many unit tests. The idea with the one failing unit test is to tempt people to work out how to fix it, discover it wasn't that hard, and now they understand what this test is doing they realize they can improve it.

If your programming language doesn't have an easy way to add a command-line interface, then the TextTest fixture is probably not necessary.