Timeline for Can objects outside the Application Layer hold references to Aggregate Roots
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 27, 2021 at 18:37 | vote | accept | Zymus | ||
| Feb 23, 2021 at 16:12 | comment | added | Zymus | Yes, apologies, stayed up later than I meant to. The command was AddItemToShop, which results in an ItemAddedToShop event. For this particular model, I don't need the extra discriminator, as each Item can only exist in a Shop once, with a specific price. So I wouldn't end up in a case where I have two Potion Items, sold for different prices. In a slightly different Player Shop model, Players can choose the Items they sell, and the prices to sell them for, so the extra discriminator is more useful there, for the exact reason you mentioned. | |
| Feb 23, 2021 at 16:03 | comment | added | Flater | @Zymus: (2 continued) That being said, if you need an extra discriminator, then obviously you can add it. For example, only deleting the $2 potatoes from the shop and not the $1 ones. As you can see, the unit price is in this case part of the identifier that you need to recognize the correct item(s) to remove. But whether you need this or not is heavily contextual and I can't just answer this for every possible game structure out there. The average RPG has a very different shop system to an economy simulator, there is no one-size-fits-all answer here. | |
| Feb 23, 2021 at 15:56 | comment | added | Flater | @Zymus (1) ItemAddedToShop is not a command, it is an event. Or it's wrongly named. (2) "where the properties necessary to add are also necessary to remove" This doesn't make sense. I can request data needed for the creation of a resource (e.g. name), but the deletion only requires an identifier. I wouldn't add more to the delete command, for the exact issue you point out: it implies (or begs the question) that the behavior is different if a certain property value is different, which is not functionally relevant to a delete action. | |
| Feb 23, 2021 at 15:34 | comment | added | Zymus | .. any insight as to how to determine which properties are suited for different commands like this? I've thought about mirroring them, where the properties necessary to add are also necessary to remove; but keep feeling that there may be cases where we simply want to remove it, regardless of what new state it may have taken. What indicators can I look for to help make a better decision? | |
| Feb 23, 2021 at 15:29 | comment | added | Zymus | Thanks for the insight. I hadn't considered the option of specifying all parameters in the command. What I mean is, I had been leaving some properties up to be inferred from the Aggregate. For instance, the ItemAddedToShop command I have takes in the ShopId, the ItemId, CurrencyId, and Price. But my ItemRemovedFromShop command only had a ShopId and ItemId; not the CurrencyId, or Price. This does illustrate that a command may come in with incorrect assumptions; for instance, if an Item was priced with Dollars, but it was removed with Coins or something, can it execute the command? Do you have.. | |
| Feb 23, 2021 at 13:40 | history | answered | Flater | CC BY-SA 4.0 |