RE: How-to implement the e-Commerce-System found in the "IDDD" book

Mauro Servienti <[email protected]>
Newsgroups gmane.comp.programming.domain-driven-design
Message-ID <0D71C042265E7B4D871B59569C7774D75A4C26CD@AMXPRD0310MB390.eurprd03.prod.outlook.com>
I would create 3 IntelliJ projects products, orders and invoices.

An order would be only associated with a product by a simple product-ID.

An invoice would only know about its order by means of a order-ID.

[.m] not really, you need to de-normalize in the order and in the invoice the basic info of the "related" item, for 2 reasons:

-          History: invoices and orders cannot change once emitted, so I f the product description changes the description on the invoice should not change;

-          Independency: Order-BC should not depend on the availability of the Product-BC to work;



Let me just go through two usecases:



Use-case "Deleting an Order."



With the first implementation this is very easy.

I just need to call the order's delete method which also just deletes its contained invoices.



With the second implementation I probably need some kind of event-system so that the invoice subdomain can react on a  Order-Delete Event.

[.m] yes, I agree



Use-case "Reporting of all invoices grouped by a catalog item"



In the first implementation I would find all products of an catalog and then find the  associated  orders.

I would  then just iterate over the invoices to produce the report.



In the second implementation I would do basicly the same steps. But since I'll have to deal with three systems the "services" have to do internally a lot of lookups based on product and order IDs. So I do expect to performance-wise to need to tune here a lot.

[.m] or you have a fourth BC, the stats one, that reacts to all events in the system and creates the stats data ready for managers queries.



.m
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.