Timeline for How to implement state machine pattern on aggregate root
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 23, 2018 at 8:08 | comment | added | Vadim Samokhin | Now I use a repository for each aggregate type. | |
May 23, 2018 at 3:40 | comment | added | F21 |
Do you use a repository for each aggregate type (CheckedForFraudTransactionRepo , RegisteredTransactionRepo , etc) or just 1 repository that handles all aggreate types?
|
|
Feb 1, 2018 at 11:04 | comment | added | guillaume31 |
+1 this also has the benefit of type safety on operations (instead of throwing InvalidOperationException s)
|
|
Jan 31, 2018 at 8:38 | comment | added | Vadim Samokhin | I would carefully consider whether those implementation are the same by coincidence or by design. Are they the same because they really model the same behavior, or they just happen to coincide in a certain moment of time? Very often I find that code duplication is not really a duplication, but a coincidence, that some pieces of code look the same. But If you're quite sure about duplication, well, generally, you have two options: inheritance and composition. | |
Jan 30, 2018 at 23:56 | comment | added | Fernando Gómez | Thanks for the response. A question, for several states I have functionality that is repeated, that is, states that can invoke the same method. With your proposal, how would you avoid repeating yourself? | |
Jan 30, 2018 at 7:20 | history | answered | Vadim Samokhin | CC BY-SA 3.0 |