Starting code for the GildedRose Refactoring Kata in many programming languages.
Go to file
2023-11-03 15:36:54 +01:00
.github Change PR close comment 2023-08-29 13:07:54 +02:00
abap starting code and tests for ABAP 2016-03-21 10:57:47 -05:00
Ada Renames README files consistently. 2018-12-02 20:39:39 +01:00
c99 Add CMake and Unity test framework for c99 2018-10-30 18:29:14 +01:00
C only need one item in array 2021-10-12 11:19:56 +02:00
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
common-lisp-parachute Update gilded-rose.lisp 2023-07-27 11:55:50 +02:00
commonlisp added functional version. 2022-01-20 08:53:01 +01:00
cpp Updated googletest to release-1.12.1 and catch2 to v3.3.2 2023-06-09 14:21:43 +02:00
cpp-catch2 Update catch2 version in CMakeLists.txt 2023-06-20 09:14:54 +02:00
csharp Add Microsoft.NET.Test.Sdk NuGet package 2023-10-16 20:49:58 +02:00
csharpcore csharpcore use .NET7 2023-10-28 07:03:22 +02:00
csharpcore-Verify.xunit update .net version 2022-12-07 08:23:51 +01:00
d Add D language version 2018-05-09 18:23:31 +02:00
dart Add sdk constraint and update test deps 2021-04-09 10:50:03 +05:30
Delphi Add .res files to .gitignore 2020-01-20 11:54:27 +00:00
elixir Add initial failing test for Elixir 2021-09-08 17:26:38 -04:00
elm Remove License 2020-01-22 12:46:01 -05:00
erlang fix JetBrains erlang link 2021-10-27 09:57:22 -07:00
fortran Adding missing call to update_quality in GildedRose_unity_test 2021-05-26 21:45:07 +02:00
fsharp add fsharp version 2015-10-26 13:38:45 +01:00
fsharp-core Upgrade to F#6 2021-12-26 17:16:07 +01:00
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 chore(haskell): update base and add stack file 2018-10-22 23:07:04 +02:00
janet updated tests and added README, based on review feedback. 2023-07-13 11:01:41 +01:00
Java add convenience script to run texttests 2023-11-03 13:06:02 +00:00
Java-Approvals Migrated to apache maven wrapper 2022-01-03 22:18:08 +01:00
Java-Cucumber Migrated to apache maven wrapper 2022-01-03 22:18:08 +01:00
Java-Spock Upgraded gradle and spock 2021-10-02 11:25:45 +05:30
jq jq ci: compare to 30 days texttest stdout 2023-02-07 17:13:45 +00:00
js-jasmine Update dependencies for JavaScript 2021-05-14 11:22:05 +02:00
js-jest Get texttests working for Javascript-Jest 2023-11-03 15:36:54 +01:00
js-mocha Update dependencies for JavaScript 2021-05-14 11:22:05 +02:00
julia make julia compatible with texttests 2023-06-12 16:41:55 +03:00
Kotlin Upgrade build to: Kotlin 1.9.10, Gradle 8.x, JUnit 5.10.0 2023-10-10 21:33:32 +02:00
lfe failing unit test with 'fixme != 'foo' 2022-01-23 19:06:42 +01:00
Matlab Add Matlab files 2023-09-21 21:47:48 +02:00
ocaml Support texttest with OCaml 2023-10-24 14:04:28 +02:00
pascal Port to (Turbo) Pascal. Feeling retro ;-) 2017-12-08 15:53:56 +01:00
perl add texttest fixture for Perl 5 code 2014-05-02 12:25:12 +02:00
perl6 Moves language specific Git ignores into language subfolders. 2018-12-02 20:31:26 +01:00
php Bump to PHP 8.0+ 2023-01-07 17:19:35 +00:00
plantuml added a slide-deck for a workshop 2019-12-31 14:17:03 +01:00
plpgsql typo 2020-01-23 19:53:15 +01:00
plsql Updated gilded rose to utplsql version 3 2019-07-02 15:40:46 +02:00
python tweak docs 2023-11-03 15:26:54 +01:00
R Eclipse/StatET R environment configuration (can be imported as existing 2014-12-05 20:09:51 +01:00
rescript adding yarn texttest 2023-09-07 17:07:56 +09:30
ruby Change line separator from CRLF to LF 2020-09-25 16:45:40 +02:00
rust Make rust loop worse to make it closer to the original 2023-05-21 10:36:45 +02:00
scala Update ScalaTest version to 3.1.1 2020-04-05 13:17:19 +02:00
scheme Fixes bug in Scheme version, not deeply nested enough. 2018-12-03 22:45:26 +01:00
Smalltalk Fixes encoding Smalltalk source. 2018-12-02 21:48:42 +01:00
sql Add SQL (without test support) 2019-12-18 21:58:10 +01:00
swift a - Apply SwiftFormat 2022-06-10 11:30:11 -07:00
texttests Get texttests working for Javascript-Jest 2023-11-03 15:36:54 +01:00
TypeScript Get the TypeScript TextTests working more conveniently 2023-11-03 15:26:43 +01:00
vbnet Add VB.NET implementation 2022-03-16 20:35:25 -04:00
xslt Description how to run the XSLT. 2018-12-07 23:53:54 +01:00
.gitignore add convenience script to run texttests 2023-11-03 13:06:02 +00:00
GildedRoseRequirements_de.md improve language 2022-02-11 21:08:27 +01:00
GildedRoseRequirements_es.md Update GildedRoseRequirements_es.md 2018-03-03 12:24:57 +01:00
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_it.md Update Italian translation: 2023-09-06 12:38:04 +02:00
GildedRoseRequirements_jp.md Update GildedRoseRequirements_jp.md 2020-08-17 10:47:34 +09:00
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 Update GildedRoseRequirements_pt-BR.md 2017-07-13 18:46:22 -03:00
GildedRoseRequirements_ru.txt Added requirements specification in russian language. 2016-06-11 23:53:18 +04:00
GildedRoseRequirements_th.md Update GildedRoseRequirements_th.md 2021-03-16 15:28:32 +07:00
GildedRoseRequirements_zh.txt Update GildedRoseRequirements_zh.txt 2020-09-25 13:05:39 +08:00
GildedRoseRequirements.txt fix typo in requirements 2016-01-25 20:42:55 +01:00
license.txt added MIT license 2015-07-07 19:46:17 +02:00
README.md Update Italian translation: 2023-09-06 12:38:04 +02:00
start_texttest_from_python.bat Update convenience texttest scripts for windows and docs 2023-11-03 13:42:00 +00:00
start_texttest.bat Update convenience texttest scripts for windows and docs 2023-11-03 13:42:00 +00:00
start_texttest.sh Add convenience shell script for running texttests 2023-11-03 14:08:40 +01:00

Gilded Rose Refactoring Kata

You can find out more about this exercise in my YouTube video Why Developers LOVE The Gilded Rose Kata.

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 Approval tests provided in this repository. (Read more about that in the section "Text-based Approval Testing").

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 taking small steps, running the tests often, and incrementally improving the design.

Please don't send me a pull request with your solution. It can be a bit confusing since GitHub encourages you to do so! Please only send me pull requests if you have a correction or improvement to the starting position. You don't want to spoil the fun of doing the exercise for other people!

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

History of the exercise

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.

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.