Asymmetric relationships in this lesson, you learn two new terms, upstream boundary context and downstream
boundary context, and I'll cover three patterns customer supply pattern, conformist pattern and the
anti-corruption layer pattern.
In the last lecture you learned about symmetric relationship.
In this lecture, I'll cover the details of asymmetric relationships between the bounded context in
an asymmetric relationship, one bounded context has dependency on another bounded context.
This kind of relationship is depicted by way of assigning roles to the bounded context.
The BONARD context that exposes mortals to the other bounded context is referred to be in the upstream
role, and the bounded context that is dependent on the other bounded context is referred to by the
downstream bounded context.
So this depicts a relationship in which bounded context.
It is dependent on the bounded context.
B in other words, boundary context.
It has knowledge of models and bounded context.
B And since the relationship is asymmetric boundary context B does not have any knowledge of the model
in bounded context.
It is an important thing to keep in mind here is that this relationship does not indicate the flow of
data or information.
It depicts the dependencies from the realisation perspective.
The upstream bounded context exposes some functionality and models that are consumed by the downstream
bounded context.
Now there are two options that the upstream bounded context has.
It can expose the functionality and models based on the needs of the downstream bounded context.
And the second option is that the upstream bounded context exposes certain functionality and models
without any consideration to the needs of the downstream bounded context.
These are two separate patterns.
Let's discuss these in details.
So in case of option number one, the upstream bounded context fulfilled some specific need of the downstream
bounded context.
And this pattern is referred to as the customer supply of pattern.
Think of it like a client server, Pachon, wherein the server creates the interfaces based on the needs
of the client.
From the realisation perspective, the supplier team always consults with the customer team to ensure
that the supplier servers fulfilled the needs of the customer service.
Let's discuss option number two, in which the upstream bounded context exposes models with no regard
to any downstream bounded context requirements or needs.
In the scenario, the downstream bounded context except the models exposed by the upstream bounded context.
This type of relationship is referred to as the conformist pattern.
In this pattern, the downstream boundary context conforms to the upstream bounded context models to
depict this relationship, the D next to the downstream bounded context is replaced with a seat F,
so in this diagram bounded context, it is conforming to the models exposed by the bounded context.
B One important point to note here is that both the bounded context used the same model.
To give you an example from the banking domain.
Let's say there is a bounded context credit card and a bounded context for customer management.
The team for the customer management develops and own the model for customer and the customer management
boundary.
Context acts as a upstream for the credit cards.
The credit cards team decides to adopt the model created and managed by the customer management team.
In that case, they will not be any need for the translation of the customer object between the bounded
contacts.
Not consider a scenario in which the downstream bounded context decides not to conform to the upstream
bounded context.
In other words, the team for bounded context.
It decides to create their own model instead of adopting the models for bounded context be.
In that scenario, the models from bounded context be exposed to the bounded context.
It would require some kind of a translation to convert the models from bounded context be to bounded
context.
The suggestion is to isolate this translation logic in a separate layer.
This level for the translation is referred to as the anti-corruption live, and this pattern is also
referred to as the Antichrist.
The idea behind the anti-corruption lawyer is to protect the bonded context from corruption.
This kind of relationship is depicted by replacing the ACL.
So here we are depicting a relationship between A and B within each of these bonded context, have their
own model.
They have no knowledge of each other's models except that the ACL has the required knowledge of both
the models for A and B and carries out the translation from B's morou to his model.
Let's say the customer management team decides to depict the customer with these three attributes and
the credit card team decides to call the customer the account holder in the context of credit card.
And these are the attributes that they decided to use for describing the account holder credit card
team decided to leverage some function from the customer management and contacts with the anti-corruption.
So in this scenario, the anti-corruption layer will have the translation logic for converting the customer
from the customer management context to the account holder in the credit card context.
And this would mean mapping the various attributes, such as first name, last name.
And here, as you can see, there is some kind of a government identity attribute which is mapped to
the customer SSN or Social Security number.
And this mapping also involves setting the identity type to SSN.
So this is an example of the translation logic built into the ACL or the anti-corruption layer.
So that means that the anti-corruption layer needs to have the knowledge of both the downstream models
as well as the upstream models.
But the downstream has no knowledge of the upstream bounded context, and that is how the anti-corruption
layer protects the downstream from upstream changes.
In this lesson, you learned about the asymmetric relationships between the boundary context and asymmetric
relationship.
The downstream boundary context depends on the upstream boundary context in the customer supplier pattern.
The upstream bounded context adjust the models to the needs of the downstream bounded context, whereas
in the conformists pattern, the upstream bounded context does not give any regard to the needs of the
downstream bounded context.
And so the downstream boundary context conforms to the upstream models.
In order to protect the downstream boundary context, teams will decide to use the anti-corruption layer.
This anti-corruption layer has the logic for translating the models from the upstream format to the
downstream.
Formic, that way downstream.
Bounded context has no knowledge of the upstream model context and hence there is no direct dependency.
As such, all of the code related to the dependency is isolated in the atheel.