Java to Kotlin Gilded Rose - Part 1 Refactoring to Objects

Опубликовано: 13 Март 2026
на канале: Pairing with Duncan
5,134
119

The Gilded Rose (https://github.com/emilybache/GildedR...) is a classic refactoring kata, available in many languages. In this video series (   • Gilded Rose Refactoring Kata in Kotlin  ) we start with the Java version (https://github.com/emilybache/GildedR...) and show how to migrate it to Kotlin as well as refactoring the procedural code into both object-oriented and functional styles.

Here we take the procedural Java code, convert it to Kotlin, then refactor into an object-oriented solution using inheritance to represent the different types of item.

00:00:05 Importing the Project
00:03:01 Approval Tests
00:10:03 Introduce Kotlin
00:18:33 Refactor to Understand
00:25:46 Introduce BaseItem
00:30:46 Subclass BaseItem
00:41:26 More Method Extraction
00:47:56 Operation Ordering
00:52:31 Checking the Spec
00:53:21 Expressing the Spec
00:58:14 Simplify
01:02:36 Review

Part 2 (   • Java to Kotlin Gilded Rose - Part 2 Refact...  ) takes the inheritance solution arrived at here and refactors it to use composition.

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 (https://java-to-kotlin.dev).