0

Let me assume that I have the 2 aggregates as below.

data class Order(
    val id: OrderId,
    val shipmentIds: Set<ShipmentId>
) : BaseAggregate() {}
data class Shipment(
    val id: ShipmentId,
    var fromAddress: ShippingAddress,
    var toAddress: ShippingAddress
) {}

In the Order class, I reference a set of shipments by Aggregate root id. and I named it as shipmentIds. I assume we can just name it as shipments rather than putting *ids as suffix.

Could you guys let me know there would be any potential issue with this approach?

Jay Ahn
  • 73
  • 5
  • It should be fine, although you might want to consider if introducing a Shipments type (as a replacement for Set) has favorable benefits vs cost. – VoiceOfUnreason Aug 30 '21 at 23:43
  • @VoiceOfUnreason Hi thanks for your comment! I'm not sure what you mean by `shipments type`. could you explain more? :) – Jay Ahn Sep 01 '21 at 20:30
  • 1
    Notice how your example includes a specific type for OrderId? and how a Shipment is composed of a ShipmentId and two ShippingAddress? It might also make sense to include another type for Shipments. "Set", as far as I know, is not taken from the language of Orders and Shipping.... – VoiceOfUnreason Sep 01 '21 at 21:54

0 Answers0