Slide 31
Slide 31 text
Review committee: Report example
Smell: sealed class without “a child specific property”
sealed class AccountType(val accountId: Long, val accountName: String) {
class NormalAccount(accountId: Long, accountName: String) :
AccountType(accountId, accountName)
class PremiumAccount(accountId: Long, accountName: String) :
AccountType(accountId, accountName)
}
Fixed code: extract type as enum
class AccountModel(val id: Long, val name: String, val type: AccountType)
enum class AccountType { NORMAL, PREMIUM }