Caminos Separados
Escrito por Darjus Kazakevic · revisado el
A small, honest copy can beat an integration nobody can afford.
Separate ways is the choice not to integrate. In an online shop, Support needs a list of supported countries to route tickets. Billing owns the real country service, but calling it would put Billing on Support's critical path for three fields that change twice a year. So Support keeps its own list.
Duplication has a bad name, so this option is often ignored. The test is how much you need and how often it changes. A few stable fields are worth copying; a model that changes weekly is not. Always write the decision down, or the copy looks like a mistake.
En esencia — Decide that integrating costs more than it gives, keep your own copy of the little you need, and let the two teams move at their own speed.
Cuándo recurrir a él
Recurre a él cuando
- You need a few fields that change rarely and predictably
- Integrating would put another team's service on your critical path
- The two contexts serve different users with no shared process
Reconsidéralo cuando
- The data you need changes weekly: you would maintain two models
- Both sides must agree at every moment, like a price or a balance
- The copy would grow to most of the upstream model
Conceptos clave
- No runtime link
- The contexts share no code, no API calls and no events for this data. Each can deploy, fail and change without the other.
- A small copy
- The downstream side keeps only the few fields it needs, in its own shape. It does not copy the upstream's whole model.
- Accepted drift
- The two copies may differ for a while, and the team accepts that. If they must agree at every moment, separate ways is the wrong choice.
Reglas de diseño
- Write the decision next to the copy
- Record what you copy, how often it changes and what integrating would cost, with a date. Without that note the copy looks like drift, and someone adds the dependency you chose to avoid.
- Copy the fields, not the model
- Copy the three fields you use, not the upstream structure. When you need a fourth, review the decision: the copy may now cost more than it saves.
- Never copy data that must always agree
- Prices, balances and stock levels must match everywhere at every moment. A copy gives wrong answers there, so integrate for that data, even when it costs more.
Errores habituales
- No written decision, so someone “fixes” the copy with a live call
- The copy grows field by field until it is a second model
- Copying data that must stay exact, like prices or stock