Timeline for Exceptions in DDD
Current License: CC BY-SA 4.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Mar 3 at 0:00 | history | suggested | ancyrweb | CC BY-SA 4.0 |
Fixed typo
|
| Feb 28 at 13:30 | review | Suggested edits | |||
| S Mar 3 at 0:00 | |||||
| Oct 9, 2020 at 17:37 | comment | added | user3347715 | @JordanWalker I added an edit. But yes, that is precisely where the logic belongs. | |
| Oct 9, 2020 at 17:36 | history | edited | user3347715 | CC BY-SA 4.0 |
added 71 characters in body
|
| Oct 9, 2020 at 16:53 | comment | added | Jordan Walker | Fair enough. So do you think the logic to check for uniqueness belongs in the repository implementation (within the infrastructure layer)? | |
| Oct 9, 2020 at 16:32 | history | edited | user3347715 | CC BY-SA 4.0 |
added 71 characters in body
|
| Oct 9, 2020 at 16:30 | comment | added | user3347715 | @JordanWalker Yes. Unfortunately, I cannot edit a comment. | |
| Oct 9, 2020 at 12:26 | comment | added | Jordan Walker | @king-side-slide what do you mean repository implementations are part of the domain? It’s the interfaces that are part of the domain. Implementation is part of the infrastructure layer, otherwise the domain wouldn’t be isolated from persistence concerns. | |
| Nov 19, 2018 at 18:04 | comment | added | user3347715 |
@Arash couples your Repository, User, and this invariant and therefore does not achieve the purist vision you are pushing for anyway. Repository implementations are part of the domain, and therefore can be given certain responsibilities.
|
|
| Nov 19, 2018 at 17:59 | comment | added | user3347715 |
@Arash Set validation is tricky, and often doesn't play well with DDD. You are left with either choosing to validate that some process will work before attempting that process (adding a User), or accepting that this specific kind of invariant won't be neatly encapsulated in your domain. The former represents a separation of data and behavior resulting in a procedural paradigm. This is less than ideal. Validation should exist with data, not around data. Furthermore, what benefit is there to create a domain service that only serves to check this one rule? Ostensibly, this service ...
|
|
| Nov 19, 2018 at 11:29 | comment | added | Arash | Moving Domain Logic To Repository is wrong . you should enforce domain rule by aggregate root in domain layer . | |
| Sep 3, 2018 at 14:26 | comment | added | user3347715 |
“Upwards” means towards your application layer (think of a layered architecture). I touched on this above, but the reason moving rules upwards is a sign of an anemic model is that it represents the separation of data and behavior in a way that defeats the entire purpose of having a core domain model. If validating an email is in a separate module than sending an email, your Email model must be a bag of data that is inspected for invariants before sending. See: softwareengineering.stackexchange.com/questions/372338/…
|
|
| Sep 2, 2018 at 23:40 | comment | added | Anyname Donotcare |
Could I ask what do you mean by Moving rules "upwards" is generally a sign of an anemic model? Upwards means to the application layer ? or to the domain model ?
|
|
| Mar 2, 2018 at 22:22 | history | edited | user3347715 | CC BY-SA 3.0 |
added 1 character in body
|
| Mar 2, 2018 at 22:14 | history | answered | user3347715 | CC BY-SA 3.0 |