speed_star
02/18/2021, 3:44 PMEntity for domain of DDD in Kotlin. Is my field definition correct?
I use val for id because this field is immutable. And I use var for name and status because they are mutable fields. All fields are private to prevent to be updated directly from the outside.CLOVIS
02/18/2021, 4:07 PMenum for the status instead of a String.speed_star
02/18/2021, 4:13 PMMoritz Mücke
02/18/2021, 4:13 PMspeed_star
02/18/2021, 4:17 PMvalue object. Because data class is the same as the value object because it is considered the same object if all the fields are the same.
Data class can also be used for Entity?nanodeath
02/18/2021, 4:57 PMCLOVIS
02/18/2021, 5:16 PMvalue class is a future syntax, data class just means “please generate toString, hashCode and a few other convenient things (copy, componentN...)”. You can still override those you don't like.speed_star
02/18/2021, 5:36 PMkqr
02/18/2021, 6:07 PM