1

I will use the typical e-commerce system as an example of my problem here.

The e-commerce system has bounded contexts like Sales, Shipping, Identity and Access.

The Sales could be a core bounded context. The Shipping is a supporting bounded context. And the Identity and Access is a generic bounded context.

The core bounded context should be self-built, but the supporting bounded context and the generic bounded context could use the third-party system.

Let's say we only use a third-party system for Identity and Access bounded context.

Since each bounded context should have its own database, when the new user is registered in Indentity and Access bounded context, we have to create a new buyer, shipper, etc.

But the third-party system has its own definition of user data and when it changes, the UI and the server have to change too. This causes a lot of trouble when building a big system.

How would you integrate the third-party system to this system?

1 Answer 1

1

Since each bounded context should have its own database, when the new user is registered in Indentity and Access bounded context, we have to create a new buyer, shipper, etc.

Why do we have to create a buyer/shipper etc? According to your boundaries, only Indentity and Access should care about the user. Shipping and sales care about shipping and sales, not about users. Sure, shipping will need an address that may be stored as part of user data, but this should be handed over to the shipping system for each delivery. The tracking ID may also be stored as part of the user data, but this would only serve as a reference back to the shipping system.

But the third-party system has its own definition of user data and when it changes, the UI and the server have to change too.

If some new field or property is added to the user, the UI or server does not necessarily need to change. For example, if you start tracking time of each login for fraud prevention purposes, there might not need to be any UI change.

Of course some features might require changes to multiple components, but I really do not see how this can be avoided. A component, or bounded context, cannot completely avoid interacting with other components, the goal is usually to make these interactions as few and as well defined as possible.

6
  • We have to create buyer, shipper because the Identity and Access only cares about authenticating and authorizing the user, but not other information like address, dateOfBirth, etc. Dec 1, 2021 at 13:09
  • @ Ngọc Nguyễn I would argue that address and dataOfBirth could be part of my "Identity". Of course, you could also split authenticating/authorization from other kinds of user data. But storing actual user data inside the shipping system sounds like a domain violation to me.
    – JonasH
    Dec 1, 2021 at 13:37
  • I think if everything could be stored in the user data, then it will be very hard to decouple them into microservices. Dec 1, 2021 at 13:52
  • 1
    @Ngọc Nguyễn Why? As I mentioned in the answer, a tracking id could be stored as part of the user data for each order, but all other data about the shipment could be stored in the shipping system. I.e. the address used for that specific delivery, delivery company used, type of delivery, tracking link to third party service etc. You will need some way to associate the shipping data with the user, so making the systems completely independent is not realistic.
    – JonasH
    Dec 1, 2021 at 14:01
  • So for another typical example, Product Catalog and Sales bounded context. The Product Catalog stores the product information but price. The price of a product is stored in Sales to also manage its price history, right? Following that, I think the data should be stored separately in this user case too. I am pretty new to domain-driven design and don't understand this clearly. Could you please explain this to me? Dec 1, 2021 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.