...
- If we use a builder pattern (RequisitionBuilder), that should be the interface to build up a Requisition object. Requisition methods should be package private so that requisition objects are primarily constructed through the builder.
- DDD (domain-driven design) has something called Value Objects, which are similar to DTOs, but have a bit more behavior in them; a Value Object can be used as a DTO
- The RequisitionBuilder can have Value Objects passed to it in order to do the received quantity logic. The ProofOfDeliveryDto could be converted into a Value Object like ReceivedData or StockData
- The LineItemFieldsCalculator is close to a domain layer service; its methods look more like functions. To make it a domain layer service, we might add properties like currentRequisition and previousRequisitions and the methods could work on those objects to do the calculations and set the values in the currentRequisition
Application Services
- Handles external communication
Domain Layer Services
- This is different from a domain object because it handles logic where it is necessary to know about multiple domain objects.
- This can also know about the domain repository (RequisitionRepository), but only the interface, not the details (it shouldn't have to deal with things like entity managers)
- No external communication
...