Customer-Supplier
In the hierarchy of Strategic Design relationships, Customer-Supplier is one of the most collaborative patterns. It describes a situation where two teams have a strong dependency on each other, but unlike the Shared Kernel, they do not necessarily share the same code.
Instead, the relationship is defined by coordinated planning and prioritization.
1. What is Customer-Supplier?
In this relationship, the Downstream (Customer) and Upstream (Supplier) work together to ensure that the Supplier's output meets the Customer's needs.
- The Power Dynamic: The Downstream team (Customer) has a seat at the table during the Upstream team's (Supplier) planning sessions.
- The Commitment: The Upstream team is officially tasked with meeting the requirements of the Downstream team.
- The Integration: The teams must agree on a set of Automated Acceptance Tests to ensure that the Supplier's changes do not break the Customer's system.
Key Difference: In Conformist, the Upstream doesn't care about you. In Customer-Supplier, the Upstream is required to care about you.
2. Cinema Example: Booking & Promotions
Imagine the Booking Context (Customer) needs to apply discounts created in the Promotion Context (Supplier).
- The Request: The Booking team needs a way to validate a promo code before the user pays.
- The Supplier's Action: Even if the Promotion team didn't have this feature planned, they add it to their sprint because their "Customer" (the Booking team) requires it to function.
3. .NET Core Implementation Strategy
In a Customer-Supplier relationship, the technical implementation often involves a Contract-First approach or Consumer-Driven Contracts (CDC).
A. The Shared Contract (Published Language)
The teams agree on a DTO (Data Transfer Object) in a shared library or a Git submodule.
C#
B. The Automated Acceptance Test
The Customer writes a test that the Supplier must pass before they can release a new version. This prevents "breaking changes" from reaching production.
C#
4. Comparison Table
| Feature | Shared Kernel | Customer-Supplier | Conformist |
| Code Sharing | High (Shared Library) | Low (Separate projects) | None (Consumer adapts) |
| Communication | Very High (Daily) | High (Planning/Sprints) | Low (Read the Docs) |
| Autonomy | Low | Medium | High |
| Risk | Breaking shared code | Supplier missing a deadline | Upstream changing the model |
5. When to Choose Customer-Supplier?
- Internal Teams: Use this when both teams work for the same company and have aligned business goals.
- Strategic Core: Use this when the Downstream context is a "Core Domain" that needs specific data from a "Supporting Domain."
- Trust Level: Use this when there is enough trust to negotiate priorities but enough technical separation that you don't want to share a codebase.