Video description
The Gilded Rose is a classic refactoring kata, available in many languages at https://github.com/emilybache/GildedRose-Refactoring-Kata. In this video series we start with the Java version and show how to migrate it to Kotlin as well as refactoring the procedural code into both object-oriented and functional styles.The rules of the exercise are here.
Part 1 takes the procedural Java code and ends with a nice OO solution, using inheritance to represent the different types of item. Part 2 replaces the inheritance with composition, getting perhaps closer to the heart of the domain. Part 3 removes the mutation inherent in the procedural code to give a nice functional solution. Part 4 is a bonus refactoring, starting from the beginning to see how far the update code can be improved while making no changes to any other files.
The code is available at https://github.com/dmcg/gilded-rose-kata. This video content supplements the O'Reilly book Java to Kotlin, A Refactoring Guidebook.
Table of Contents
Part 1: Refactoring to Objects
Part 2: Refactoring to Composition
Part 3: Refactoring to Functional
Part 4: Procedural Refactor