Slide 35
Slide 35 text
実際のコード表現
改善前
val conference = Conference(id = 1L, status = 1, name = "Scala
関西Summit 2018",
limit = 5000, participants = Seq.empty)
val newConfernece = conference.copy(participants =
conference.participants.copy(participants =
conference.participants + 10L /* userAccountId */)
)
)
改善後
val conference = Conference(id = ConferenceId(1L), status = ConferenceStatus.Private,
name = ConferenceName("Scala
関西Summit 2018", en = "Scala Kansai Summit 2018),
limit = PerticipantLimit(5000), paticipants = Participants.empty)
val newConference = conference.addParticipants(Particitpant(userAccountId = 10L))
Scala
でのドメインモデリングのやり方
Scala
関西Summit 2018 33 / 40