Sunday, 18 October 2009

Cargo routing service

For those who do not know DDDSample, cargo routing service is a domain service which is responsible for finding best routes for delivering cargo from its origin to destination. The term 'best' is out of scope of this blog post. I would like to focus on the design of the sample.

In the original code the service is defined as an interface in the domain layer. Its implementation defines an anti corruption layer between the cargo booking and handling bounded context and the routing bounded context. That is OK. But the other side of the anti corruption layer is totally neglected. There is only a simple fake algorithm which operates on pre-defined in-memory kept data.

I understand this is because DDDSample project is focused on cargo booking and handling, not routing. But since we build our .NET version from scratch and have some degree of freedom, I would like to create a cohesive solution for the routing part. For me cohesive means that data in the voyage aggregate (which is basicly all the carrier voyages available for moving cargos around) is in synch with data in the routing bounded context no matter if we are using an in-memory (fake) or real database.

I think that the best, from the DDDSample.Net educational function perspective, solution would be to build at least a part of routing BC by the book and would be responsible for maintaining the voyage and publishing voyage related data to all the interested parties (such as cargo booking and handling BC). 

No comments:

Post a Comment