Kotlin Refactoring - Adding Operators to Value Classes

Опубликовано: 09 Август 2022
на канале: Pairing with Duncan
431
31

After we used Kotlin Value Classes (previously Inline Classes) to implement Tiny Types, we ended up having to defereference the value inside our NonNegativeInt to do maths. In this episode we add operations to the type so that code is less tedious to write and easier to read.

This is Part 33 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 sub-series on Value Classes is also a playlist
   • Kotlin Value Classes (Tiny Types)  

You can read more about tiny types and partial functions on my blog http://oneeyedmen.com/failure-is-not-...

If you like this, you’ll probably like the book Java to Kotlin, A Refactoring Guidebook
http://java-to-kotlin.dev. Chapter 19 covers error handling.


Смотрите видео Kotlin Refactoring - Adding Operators to Value Classes онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Pairing with Duncan 09 Август 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 431 раз и оно понравилось 31 людям.