Face the Brutal Truth: Merging Code and Distributed Transaction Are Not Just Technical Problems

Face the Brutal Truth: Merging Code and Distributed Transaction Are Not Just Technical Problems

Why Ownership, Business Logic, and Conflict Archaeology Define Modern Engineering


Introduction: The Illusion of Control

Engineers love to believe they can fix anything with tools: git merge to reconcile code, "Sagas" to paper over distributed failures. But this is delusion. The hardest problems in software aren’t technical—they’re human collisions masquerading as technical debt.

Forcing a merge between a gas engine and an electric engine isn’t just impractical—it’s philosophically absurd. Yet teams do battling over conflicting code branches and retrofitting compensations for distributed failures. The truth? Merging code and rolling back transactions can be ownership failures, not engineering ones.


1. The Myth of Mergeability: Code as Politics

The Gas Engine vs. Electric Engine Problem

Imagine two teams:

  • Team A builds a gas-powered car (legacy monolith).
  • Team B designs an electric engine (cloud-native microservices).

Both are "cars," but their architectures reflect irreconcilable visions. Merging their codebases would require rewriting physics. Yet lot of companies try this regularly, demanding DevOps "fix" branch conflicts that are really strategic disagreements.

Example: A startup splits into two factions:

  • Branch X: Prioritizes speed, stripping GDPR checks to ship faster.
  • Branch Y: Adds compliance for EU markets.

Git merges their code mechanically, but the result is a Frankenstein app that’s neither fast nor compliant. The real issue? Leadership failed/refused to choose a direction.

The Brutal Truth:

  • Code merges can be power struggles.
  • Tools like Git are enablers, not arbiters.
  • The fix: Kill branches (business decision) or rewrite (engineering execution).


2. Distributed Transactions: The Theater of Rollbacks

When "Undo" is a Fantasy

Consider a food delivery app:

  1. Payment succeeds ($100 charged).
  2. Restaurant cancels the order (no refund policy).
  3. Inventory service rolls back.

Engineers call this a "Saga." Customers call it theft.

The Illusion:

  • Saga frameworks orchestrate retries and compensations.
  • The reality? Once money leaves a user’s account, "rolling back" is a lie. You’re not undoing—you’re asking the business to compensate: 1) Refund (finance team’s decision). 2) Coupon (marketing’s budget). 3) Priority reorder (product’s UX).

The Brutal Truth:

  • Distributed transactions expose business logic gaps, not technical ones.
  • Product owners must design compensations upfront. Engineers just automate them.


3. BDD: Conflict Archaeology

Digging Up Disputes Before They Fossilize

Behavior-Driven Development (BDD) isn’t about testing—it’s about forcing stakeholders to argue early, or fail really fast.

Example: A product owner insists, "Users get loyalty discounts after 3 purchases." Engineers ask:

  • "What if they return an item?"
  • "Do subscriptions count?"

BDD codifies these rules as executable specs:

Scenario: Loyalty discount after returns  
  Given a user has 3 purchases and 1 return  
  When they check out  
  Then they see NO discount          

Impact:

  • Conflicts surface at design time, not during a midnight merge.
  • Failing tests become business logic audits, not bugs.

The Brutal Truth:

  • BDD scenarios are prenuptial agreements for code.
  • If your tests pass but the product fails, blame the specs—not the code.


4. The Ownership Hierarchy

Who Owns the Truth?

Example: A travel app’s payment succeeds, but the hotel booking fails.

  • Engineers implement a Saga to undo steps.
  • Product Owners decide: Refund? Free upgrade? Partner voucher?
  • BDD Spec:

Scenario: Compensate for failed bookings  
  Given payment succeeds  
  But hotel booking fails  
  Then offer a 10% discount on next booking          

The Brutal Truth:

  • Tools without ownership create accountability vacuums.
  • DevOps can’t fix a merge conflict between "discounts" and "flat pricing."


5. When Coexistence Beats Merging

The Hybrid Car Principle

Gas and electric engines can’t merge, but they can coexist (hybrid cars). Similarly:

  • Feature Flags: Run conflicting code paths side-by-side.
  • Parallel Systems: Let legacy and modern stacks interact via APIs.
  • Forks: Accept irreconcilable differences (e.g., React vs. Vue teams).

Example: Netflix’s chaotic migration to microservices:

  • Old DVD billing system ran alongside cloud infrastructure for years.
  • Teams built adapters, not merges.

The Brutal Truth:

  • Forced merges can be violence. Coexistence is strategy.


Conclusion: Stop Hiding Behind Tools

The hardest questions in software are unanswerable by tools alone:

  • Should we prioritize speed or compliance?
  • Do we refund angry users or offer coupons?
  • Gas, electric, or both?

Engineers: Stop calling all merge conflicts "technical debt." They could be leadership debt.

Product Owners: Stop hiding behind Jira tickets. Write BDD specs that reflect reality.

Final Rallying Cry:

The next time you’re stuck in a merge hell or retrofitting compensations, ask: "Are we arguing about code—or the business logic we refused to clarify?"

Tools won’t save you. Only ownership will.


Call to Action:

  • Audit your BDD specs: Do they reflect real business rules, or token tests?
  • Host a "Conflict Archaeology" workshop: Surface disputes before coding begins.
  • Kill branches that represent dead-end visions.

要查看或添加评论,请登录

杨刚的更多文章

其他会员也浏览了