Part 19 of an exploration of where a Test Driven Development implementation of the Gilded Rose stock control system might take us in Kotlin. You can see the whole series as a playlist • All Gilded Rose Episodes and the code on GitHub https://github.com/dmcg/gilded-rose-tdd
This time we add yet another magical item, Backstage Passes, making everything just a little worse in the process. Then, with the tests passing, we can refactor away some of the nastiness.
We also find a problem with representing items as a data class - the generated copy methods allow us to build invalid combinations of properties - so we make Item a plain old class instead.
If you like this, you’ll probably like the book Java to Kotlin, A Refactoring Guidebook http://java-to-kotlin.dev. Chapter 3 has another example of a class (Money) that doesn't work well as a data class.
Смотрите видео Kotlin TDD - Extend and Refactor онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Pairing with Duncan 14 Май 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 163 раз и оно понравилось 18 людям.