Eric Evans book - an example of shipping
I'm studying the book that forms the basis of DDD, and I'm a bit stuck understanding the example about Cargo Shipping in chapter 7.
Specifically, I have the following question; Wat is the real target of "Delivery History"? In my opinion this is just a collection of event handling. But if so, why does it have its own entity object? Especially since the completion time is part of the processing event, I don't understand the added value in the shipping history ...
Any help from smart people than me is greatly appreciated.
source to share
Usage Delivery History - Provide journal type. For example, when you track a package on the Internet, you can see the last entry in the Delivery History , and this is the last event that happened in the delivery history of the package.
In the real world, a company can call a shipping company and say, "Where is my load? It should have been delivered last Tuesday!", The operator can use software to locate the load and from the Delivery History . The operator can find out by looking at the last entry that the cargo is delayed in transit, etc.
Evans also states that a delivery can be considered complete if the Delivery History is consistent with the Delivery Specification purposes . This information is important, so to ensure that the information is correct, correct and important, it must have business logic in order to be saved. This is why Delivery History is the essence.
The delivery history reflects what actually happened to the shipment, as opposed to the delivery specification, which describes the purpose. The delivery history object can calculate the current location of the cargo by analyzing the last load or unloading and assigning the appropriate Carrier Movement. A successful delivery would end with a Delivery History that met the delivery goals Specification.
--- Eric Evans, Domain Driven Design: The Challenge of Complexity at the Heart of Software
In the diagram of the Cargo class, it looks like the History Delivery class has references to handling events. In this case, the delivery history can exist as:
Provide a good place to put business logic to query the delivery history.
It may retain the generic term (and possibly a physical artifact) used in the Omnipresent Cargo Handling Domain Language.
The delivery history also has access to carrier transfer events, so it knows when the Carrier reached the destination port, etc.
To specify a specific delivery history code in processing events would violate the single responsibility principle.
source to share