Hacker News new | ask | show | jobs
by pbourke 1957 days ago
Very interesting - thanks for posting this.

> By enforcing immutability on the domain services, we ensure discipline with how the UI state services must consume the model

Could you expand on that part? Do you mean that your domain services use an append-only approach to manage state?

1 comments

Not necessarily append-only, but making sure that when we get a copy of something from a method - i.e. GetUser(), that the UI or its state services cannot cause mutations to propagate back down into the store without first going through another explicit method like UpdateUserName().

We don't play around with event sourcing right now, but it might be feasible at and above the UI state services if we wanted to do things like replay a user interaction with our app. The only caveat is that our domain services are very very messy in terms of side effects, so the practical utility is bounded to isolated UI testing.