<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Lokesh Rawal on Medium]]></title>
        <description><![CDATA[Stories by Lokesh Rawal on Medium]]></description>
        <link>https://medium.com/@rawal.lsr?source=rss-552ee52ab811------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*XxhpyL4zToirCNd1</url>
            <title>Stories by Lokesh Rawal on Medium</title>
            <link>https://medium.com/@rawal.lsr?source=rss-552ee52ab811------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 01:30:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rawal.lsr/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AI Made You Faster. Then the Context Collapsed.]]></title>
            <link>https://medium.com/@rawal.lsr/ai-made-you-faster-then-the-context-collapsed-07c5408fae0d?source=rss-552ee52ab811------2</link>
            <guid isPermaLink="false">https://medium.com/p/07c5408fae0d</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Lokesh Rawal]]></dc:creator>
            <pubDate>Thu, 07 May 2026 12:04:57 GMT</pubDate>
            <atom:updated>2026-05-07T12:04:57.945Z</atom:updated>
            <content:encoded><![CDATA[<p>You’re faster. You’re shipping more. And somewhere along the way, you quietly stopped understanding your own codebase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qrs-JMbh_gRbdjEasQPkLg.png" /></figure><h3>The Context Trap: How AI Coding Assistants Create a New Kind of Technical Debt</h3><p>You’re faster. You’re shipping more. And somewhere along the way, you quietly stopped understanding your own codebase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gfkgMneez9WSNaF6-d68Yg.png" /></figure><p>Here’s a scenario a lot of engineers won’t say out loud: you spend three days deep in an AI-assisted architecture spike. You’re building a distributed job processing system — event-driven, multiple microservices, async handoffs, the works. The AI is generating good-looking code. You’re in flow. Then you hit a problem with message ordering guarantees across two services, start a new chat to debug it, and within 20 minutes realize you can’t fully explain why the previous session made a particular architecture decision.</p><p>You scroll through six previous conversations. You piece it together. An hour later you’re roughly back to where you were. This keeps happening. That’s the trap — not “AI wrote bad code,” but “AI helped me build something I can no longer confidently own.”</p><h3>The fast lane has a speed wobble</h3><p>The productivity gains are real. For CRUD scaffolding, boilerplate, API integrations, component libraries — AI is genuinely transformative. But there’s a different class of work where things get complicated: microservices with non-trivial coordination logic, distributed systems where correctness depends on understanding failure modes, long debugging sessions where the bug is four layers deep in business logic.</p><p>In these situations, you’re still generating code quickly. But you’re accumulating something invisible: <strong>context debt</strong> — the gap between what the AI helped you build and what you actually understand about what was built.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JIfzcwtUhlogNOQuf-QlNw.png" /></figure><p>HOW CONTEXT DEBT COMPOUNDS Session generates code fast, looks correct Decision context lost chat closes, no record New session, no memory AI gives fresh answer Logic conflict silently introduced repeat until a production incident makes it visible</p><p>It compounds quietly. Every session where you didn’t fully understand the generated logic. Every architectural decision preserved in a chat window you’ll never find again. Every hallucinated implementation you accepted because it looked right and the tests passed.</p><h3>Why the context problem is worse than it looks</h3><p>Token limits get the most discussion, but they’re the least interesting part of this problem. The deeper issue is structural: AI has no persistent model of your project. Every session, you’re handing a brilliant but completely amnesiac colleague a partial snapshot and hoping they reconstruct the right mental model.</p><p>The hallucination risk in complex systems isn’t the “AI invented an API that doesn’t exist” beginner problem. Senior engineers filter those out. The dangerous hallucinations look architecturally sound — patterns valid in isolation but violating an invariant your system depends on, decided in a completely different chat three days ago.</p><p><em>Real-world scenario</em></p><p><em>You’re implementing a saga pattern across three services. In session one, you decide service B is the canonical source of truth for rollbacks. In session four, debugging a timeout, you start fresh. The AI suggests an elegant fix — but it implicitly assumes service A handles rollback coordination. Works in tests. Ships. Six weeks later: a subtle data consistency bug under load that takes two days to trace back to this exact decision.</em></p><p>This isn’t an AI failure. The AI gave a reasonable answer to the question asked in session four. The problem is the question didn’t contain the context that made it dangerous.</p><h3>The emotional cost nobody discusses</h3><p>There’s a specific frustration that comes from losing flow state mid-session because context reset. You had the mental model assembled, you were tracking five interacting components, the bug was almost visible. Then the session gets too long, or you close the wrong tab, and you spend ninety minutes just getting back to where you were.</p><p>“Multiply this by months and something worse happens: gradual dependency. You stop keeping the full system model in your own head because you’ve offloaded it to the AI.”</p><p>This works fine until it doesn’t — until you need to make a decision during an outage at 2am with no context window to lean on, or until you sit down for a serious architecture review and realize your intuitions about your own system are fuzzy. Senior engineers who’ve been doing this long enough notice they’re less comfortable diving into code built with heavy AI assistance than code they built alone. That discomfort is information.</p><h3>The survival patterns engineers quietly evolve</h3><p>After enough painful sessions, experienced developers start building compensating workflows. Not techniques from any vendor’s documentation — adaptations that only emerge after you’ve been burned enough times.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*hRl8hXmPudqykmD31knsbg.png" /></figure><p>The common thread is intentionality about what lives in your head versus what lives in the AI’s context window. Architecture understanding must stay in the human — AI handles execution, not custody of the design.</p><p>Some maintain a separate DECISIONS.md alongside every significant project, written in plain language, updated as the project evolves — not as documentation for others, but as a cognitive prosthetic for themselves. Others treat prompts like API contracts: precise, versioned, reusable. A vague prompt is a liability. A well-crafted prompt that fully restores context is an asset.</p><h3>Fast generation is not sustainable engineering</h3><p>There’s a useful distinction between <em>generating</em> a system and <em>understanding</em> one. AI accelerates generation dramatically. It does almost nothing for understanding. And in complex, long-lived systems, understanding is what you actually need when things go wrong — which they always do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3wZn8pMf9xTnKMZhTauKaA.png" /></figure><p>The risk isn’t that AI replaces experienced engineers. The risk is that experienced engineers gradually stop exercising the judgment that makes them experienced — accepting architectural decisions they’d have scrutinized more carefully if they’d made them themselves, carried forward by the momentum of fast generation.</p><h3>Using AI like a junior pair programmer</h3><p>The developers who use AI most effectively have made a conceptual shift: they don’t use it as an autonomous engineer. They use it as a very fast, very knowledgeable junior developer who needs supervision. You own the architecture. You make design decisions. You maintain the mental model. You review generated code like a PR from someone who writes good code but doesn’t know your system. The AI handles the keystrokes.</p><p>This sounds reductive but it’s actually more demanding than just prompting and accepting. You have to stay architecturally engaged even when you’re not writing every line. You have to resist letting the AI make decisions just because it makes them quickly and confidently. The payoff: when the session ends, or something breaks at 3am, you understand the thing you built.</p><h3>Getting out of the trap</h3><p>If you’ve built significant systems with heavy AI assistance and aren’t confident you fully understand them, the path out isn’t dramatic — it’s a slow process of re-engagement:</p><ul><li>Read through AI-generated code with genuine skepticism, not just a quick scan for obvious errors.</li><li>Start keeping a project brain document, even retroactively. Write down what you know. Notice what’s missing.</li><li>For your next complex feature, make architecture decisions in writing <em>before</em> prompting. The AI becomes an implementer of your design, not the designer.</li><li>When starting a new session, include the constraints and decisions already made — not just what you want built.</li><li>Regularly ask: “If this codebase were handed to a new engineer tomorrow, <strong>could I explain every major decision?</strong>”</li></ul><p>The developers who’ll use AI well long-term aren’t the ones who prompt the most or generate the most code. They’re the ones who figured out that <strong>AI changes <em>how</em> you work, but doesn’t change <em>what</em> you’re responsible for.</strong></p><p>You’re still responsible for understanding the systems you build. For the correctness of the decisions embedded in them. For being able to reason about them when something breaks.</p><p>The trap isn’t the AI. The trap is mistaking speed for understanding, and generation for ownership. The way out is the same as it’s always been: staying curious about your own systems, staying skeptical of easy answers, and keeping the judgment in the human.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=07c5408fae0d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I’m Still Learning: Lessons I’ve Learned (the Hard Way) as a New Team Lead]]></title>
            <link>https://medium.com/@rawal.lsr/im-still-learning-lessons-i-ve-learned-the-hard-way-as-a-new-team-lead-6dabde7c4ddf?source=rss-552ee52ab811------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dabde7c4ddf</guid>
            <category><![CDATA[team-leader]]></category>
            <category><![CDATA[leadership-development]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[leadership]]></category>
            <dc:creator><![CDATA[Lokesh Rawal]]></dc:creator>
            <pubDate>Fri, 19 Dec 2025 12:06:24 GMT</pubDate>
            <atom:updated>2025-12-19T12:13:58.285Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CPdpZikmWD8zhCLc" /><figcaption>Photo by <a href="https://unsplash.com/@jannerboy62?utm_source=medium&amp;utm_medium=referral">Nick Fewings</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Stepping into a team lead role for the first time? It’s exciting… and overwhelming.<br>Not because of tasks or deadlines. Not because of processes.<br>The real challenge? <strong>People.</strong></p><p>I thought leadership was about planning and execution. Turns out, it’s about patience, empathy, and communication. And honestly — I’m still learning every single day. These lessons? I learned them the hard way.</p><h3>1. Rudeness Never Works</h3><p>When things go wrong, frustration kicks in. My instinct? React.<br> But here’s the truth: rudeness kills trust faster than missed deadlines.</p><p><strong>What works instead:</strong></p><ul><li>Pause. Breathe.</li><li>Address the issue, not the person.</li><li>If you need to show disappointment, do it calmly. A composed tone leaves a bigger impact than anger ever will.</li></ul><h3>2. Seniority Doesn’t Guarantee Support</h3><p>I assumed experienced team members would always guide me. Reality check:</p><ul><li><strong>Some let their ego get in the way.</strong></li><li><strong>Some claim to know it all but rarely take initiative.</strong></li><li><strong>Some shy away from accountability altogether.</strong></li></ul><p>But there are gems — those who genuinely help you grow. <strong>Find them. Learn from them.</strong> They’ll make your journey easier.</p><h3>3. Being responsible is rare; let’s make it common.</h3><p>I’ve noticed two patterns:</p><ul><li><strong>Seniors dodge responsibility.</strong></li><li><strong>Juniors hesitate to ask questions.</strong></li></ul><p>As a lead, your job is to make ownership feel safe:</p><ul><li><strong>Encourage juniors to take charge.</strong></li><li><strong>Be approachable.</strong></li><li><strong>Show constructive dissatisfaction — not as punishment, but as guidance.</strong></li></ul><h3>4. Explaining Is Harder Than Understanding</h3><p>You might understand a task perfectly. Your teammate? Not so much.<br>Some fear asking. Some need time. Some just need patience.</p><p><strong>Lesson:</strong> Patience and clarity are leadership superpowers.<br>Guide. Explain. Repeat. Check understanding. Never let frustration show.</p><h3>5. Think Before You Speak</h3><p>Don’t be the “yes person.”<br> Before responding:</p><ul><li>Process what you heard.</li><li>State what you agree or disagree with.</li><li>Keep it professional, constructive, and confident.</li></ul><p>This applies to everyone — juniors, peers, and management.</p><h3>6. Management Wants Progress, Not Details</h3><p>Upper management doesn’t care about every tiny detail. They care about:</p><ul><li>Clear updates.</li><li>Visible progress.</li><li>No unnecessary drama.</li></ul><p>Your role? Protect your team from micromanagement while delivering results.</p><h3>7. Growth Is a Daily Grind</h3><p>Some days I fail. Some days I succeed.<br> Leadership isn’t a leap — it’s a climb.<br> Every mistake teaches something if you’re paying attention.</p><h3>Final Thought</h3><p>Being a young team lead isn’t about knowing everything.<br>It’s about learning fast, handling people wisely, and guiding with empathy.If I could share one piece of advice:</p><blockquote><strong>Lead with patience. <br>Think before you speak. <br>Make responsibility empowering — not scary.</strong></blockquote><p>I’m still learning. Every day, I get a little better. And so does my team.</p><h4>A Message to My Team</h4><p><em>If you’re reading this — thank you for walking this journey with me.<br> I’m not perfect, and I don’t have all the answers. But I promise to keep learning, keep listening, and keep leading with empathy.<br>Together, we’ll grow — not just as a team, but as individuals who support and trust each other.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dabde7c4ddf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Microservice Lifecycle: When to Split, When to Merge]]></title>
            <link>https://medium.com/@rawal.lsr/the-microservice-lifecycle-when-to-split-when-to-merge-d788c41478d3?source=rss-552ee52ab811------2</link>
            <guid isPermaLink="false">https://medium.com/p/d788c41478d3</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[monolith]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[orchestration]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Lokesh Rawal]]></dc:creator>
            <pubDate>Fri, 05 Dec 2025 11:34:13 GMT</pubDate>
            <atom:updated>2025-12-05T11:34:13.872Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Follow-up to: “</em><a href="https://medium.com/@rawal.lsr/orchestration-vs-choreography-a-guide-to-designing-tidy-microservices-f47c0fb2287f"><em>Microservices Are a Trap (If You’re Not Careful)</em></a><em>”</em></p><p><a href="https://medium.com/@rawal.lsr/orchestration-vs-choreography-a-guide-to-designing-tidy-microservices-f47c0fb2287f">Orchestration vs. Choreography: A Guide to Designing Tidy Microservices</a></p><p>In my last blog, I shared why Domain-Oriented Orchestration is a practical way to avoid microservice chaos. The idea was simple:</p><p><strong>Let microservices mind their own domain. Let orchestrators worry about the story.</strong></p><p>That solved the <strong>spaghetti</strong> problem of service-to-service calls. But here’s another challenge:</p><p><strong>How do you decide when to create a new micro service — or when to merge one back?</strong></p><p>Because here’s the truth:</p><ul><li><strong>Too few services = monolith-like bottlenecks.</strong></li><li><strong>Too many services = cost explosion and operational complexity.</strong></li></ul><p>The sweet spot?<br> <strong>Understanding the lifecycle of a microservice.</strong></p><h3>Phase 1: Start Modular, Not Micro</h3><p>Early-stage systems don’t need 15 microservices — they need <em>speed and clarity</em>.<br> Start with a <strong>modular monolith</strong> or a <em>small set of domain services</em>.</p><p><strong>Example from previous blog:</strong><br> When we designed the Library Management System, we started with:</p><ul><li><strong>User Service</strong> (handles user details, membership, status)</li><li><strong>Inventory Service</strong> (books, stock, availability)</li><li><strong>Notification Service</strong> (email, SMS, push notifications)</li></ul><p>No BorrowService, ReturnService, or MembershipService yet.</p><p><strong>Why?</strong><br> Because these workflows can be handled by an orchestrator later.</p><h3>Phase 2: Split When Domains Mature</h3><p>Create a new microservice only when these signals appear:</p><ul><li><strong>Independent Scaling Needs</strong><br> Inventory traffic spikes during peak borrowing season while User traffic stays flat.</li><li><strong>Distinct Ownership</strong><br> A dedicated team now manages Inventory separately from User.</li><li><strong>Complexity Threshold</strong><br> Inventory logic becomes too large and slows down deployments.</li></ul><p><strong>Example:</strong><br> If Inventory starts handling advanced features like dynamic stock allocation, vendor integration, and predictive analytics, splitting Inventory into:</p><ul><li><strong>Inventory Core</strong>, and</li><li><strong>Vendor Integration Service</strong></li></ul><p>might make sense.</p><h3>Phase 3: Merge When Complexity Hurts</h3><p>Yes, merging microservices is okay. Do it when:</p><ul><li><strong>Operational Overhead &gt; Business Value</strong><br> Maintaining 10 tiny services costs more than their benefit.</li><li><strong>Shared Lifecycle</strong><br> Services always deploy together and share the same scaling pattern.</li><li><strong>Feature Coupling</strong><br> Changes in one service always require changes in another.</li></ul><p><strong>Example:</strong><br> If you created BorrowService and ReturnService separately but realize they share 80% of logic and always deploy together, merge them into a single:</p><p><strong>Borrow-Return Workflow Module</strong><br> inside the orchestration layer.</p><h3>Architect’s Rule of Thumb</h3><p><strong>Split for autonomy and scalability.<br> Merge for simplicity and cost control.</strong></p><p>Microservices are tools, not trophies.</p><h3>Practical Tips</h3><ul><li><strong>Track Service Count vs. Business Value</strong><br> Every new service should justify its infra cost.</li><li><strong>Use Domain-Driven Design (DDD)</strong><br> Domains are your compass for splitting decisions.</li><li><strong>Plan for Evolution</strong><br> Design APIs and data models so merging or splitting is possible without pain.</li></ul><h3>Closing Thought</h3><p>Microservices are not a one-way street. They have a lifecycle.</p><p>The best architectures evolve — splitting when domains grow, merging when complexity hurts.</p><p>And remember:</p><p><strong>Microservices are the characters.<br>The orchestrator is the director.<br>The business flow is the movie.</strong></p><p>…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d788c41478d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Orchestration vs. Choreography: A Guide to Designing Tidy Microservices]]></title>
            <link>https://medium.com/@rawal.lsr/orchestration-vs-choreography-a-guide-to-designing-tidy-microservices-f47c0fb2287f?source=rss-552ee52ab811------2</link>
            <guid isPermaLink="false">https://medium.com/p/f47c0fb2287f</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[tech-humor]]></category>
            <category><![CDATA[microservicesarchitecture]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <dc:creator><![CDATA[Lokesh Rawal]]></dc:creator>
            <pubDate>Sun, 16 Nov 2025 12:07:09 GMT</pubDate>
            <atom:updated>2025-11-16T12:07:09.456Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>I’ll Be Honest: Microservices Are a Trap (If You’re Not Careful)</strong></p><p>On slides, microservices look beautiful. They promise Nirvana: infinite scalability, independent teams, and painless deployments.</p><p>In real life? They can become <strong>pure trauma</strong> if you’re not careful.</p><p>We all start with the same dream: <em>“Let’s break the system into small microservices so it’s scalable, independent, and easy to maintain.”</em></p><p>And then, a few months later, your beautiful diagram looks like this:</p><ul><li>User Service is calling Inventory</li><li>Inventory is calling Notification</li><li>Notification is secretly calling User again</li><li>The architecture diagram looks like someone dropped a plate of noodles on your notebook.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*NCIa0NcgT1f1NQH648URFA.png" /><figcaption>Spaghetti Microservice Loop</figcaption></figure><p>Been there. Seen that. Tried to debug it in production. <strong>Would not recommend.</strong></p><p>I want to share my design philosophy on how I structure microservices — especially when dealing with multi-step business flows — using something I call <strong>Domain-Oriented Orchestration</strong>.</p><p>No heavy theory. No <em>50</em>-page Saga research. Just a practical thought process to save you from the spaghetti.</p><p><strong>The “Cute” Microservice Design That Turns Ugly</strong></p><p>Let’s use a simple <strong>Library Management System</strong> for an example. A typical, seemingly “correct” microservice breakup:</p><ul><li><strong>User Service:</strong> Handles user details, membership, status.</li><li><strong>Auth Service:</strong> Login, tokens, permissions.</li><li><strong>Inventory Service:</strong> Books, stock, availability.</li><li><strong>Notification Service:</strong> Email, SMS, push notifications.</li></ul><p>Each service has its own database. You feel proud. You’ve done “proper microservices.”</p><p>Then reality kicks in with a simple business flow:</p><p><strong>“When a user borrows a book, check if they’re active, check their membership, reduce stock, then send them a notification.”</strong></p><h3>Where Things Start Going Wrong (The Service-to-Service Chaos)</h3><p>What do most teams instinctively do? They use a style of coordination often called <strong>Choreography</strong> (or, in practice, service-to-service direct calling):</p><ol><li>Inventory calls User to check if the user is valid.</li><li>User calls something else for membership details.</li><li>Inventory calls Notification to send an email.</li><li>Notification might call User again for the email address.</li></ol><p><strong>The result:</strong> You are now debugging a distributed monolith.</p><h3>The Hidden Costs of Direct Calling</h3><p>When services start calling each other directly, you inherit a new, worse kind of coupling:</p><ul><li><strong>Hidden Dependencies:</strong> Change one service’s response contract, and 3 other services break without warning.</li><li><strong>Latency Stacking:</strong> Four sequential API calls = slow user response, especially under load.</li><li><strong>Cascade Failures:</strong> One small service goes down, and because it’s a critical dependency in a deep chain, half the system collapses.</li><li><strong>Scattered Logic:</strong> The core business logic for <strong>“borrowing a book”</strong> is now fragmented across Inventory, User, and Notification.</li></ul><p>You stop and think: <em>“Why does this feel more coupled than a monolith?”</em> It’s because it is: <strong>it’s just distributed coupling.</strong></p><p><strong>My Approach: Domain-Oriented Orchestrator (Not God Service, Chill)</strong></p><p>There <em>is</em> a cleaner way. It relies on clearly separating <strong>Domain Rules</strong> from <strong>Workflow Logic</strong>.</p><h3>Rule 1: Let Each Microservice Mind Its Own Business</h3><p>Your domain services should be absolutely autonomous and opinionated about their data and business rules.</p><ul><li><strong>User Service:</strong> Knows everything about users. <em>Only</em> about users.</li><li><strong>Inventory Service:</strong> Knows everything about books and stock. <em>Only</em> about stock.</li><li><strong>Notification Service:</strong> Knows everything about messaging. <em>Only</em> about messaging.</li></ul><p><strong>None of them should care how a book is borrowed from a business workflow perspective.</strong> That’s not their job.</p><h3>Rule 2: Put the Workflow Logic in a Dedicated Orchestrator</h3><p>Instead of allowing the chaos of direct calls (Choreography), we introduce a dedicated coordinator (Orchestration):</p><p><strong>Service-to-Service Chaos (Choreography)</strong></p><p>Inventory → User → Notification</p><p>Logic is spread and implicit.</p><p>Low visibility, hard to debug.</p><p><strong>Domain-Oriented Orchestration</strong></p><p><em>Client → </em><strong><em>BorrowOrchestrator</em></strong></p><p><strong><em>BorrowOrchestrator</em></strong><em> → User Service</em></p><p><strong><em>BorrowOrchestrator</em></strong><em> → Inventory Service</em></p><p><strong><em>BorrowOrchestrator</em></strong><em> → Notification Service</em></p><p>This single microservice, the <strong>BorrowOrchestrator</strong>, has one job:</p><p><em>“Given this request, execute the steps of the business process in the right order.”</em></p><p>It is not storing a big database. It is not duplicating user or book logic. <strong>It is just orchestrating.</strong> I treat it like a domain workflow brain, not a “God Service.”</p><h3>Example: Borrowing a Book (The Tidy Flow)</h3><h3>Let’s take that classic flow:</h3><p>Borrow book → Check user active → Reduce stock → Notify user</p><p>With a <strong>BorrowOrchestrator</strong>, it looks like this:</p><ol><li>BorrowOrchestrator receives request : <em>userId, bookId</em></li><li>Calls <strong>User Service</strong>: <em>“Is this user active? What’s their membership? Allowed to borrow?”</em></li><li>Calls <strong>Inventory Service</strong>: <em>“Is this book available? Reduce stock by 1.”</em></li><li>Calls <strong>Notification Service</strong>: <em>“Send email/SMS to this user about successful borrowing.”</em></li><li>Returns response to the client.</li></ol><p>Everything is coordinated in one place.<br> But the <em>logic</em> of “how to validate user” or “how to adjust stock” remains in the respective services.</p><p>That’s the key difference:<br> Orchestrator owns the <strong>workflow</strong>, not the <strong>domain rules</strong>.</p><p><strong><em>“Isn’t This Just Saga?” — Kind Of, But Better</em></strong></p><p>If you’re familiar with the <strong>Saga Pattern</strong>, you’re right to see a parallel. Saga is often described in a fully event-driven, asynchronous setup (pure Choreography): services publish events, and other services react, achieving eventual consistency.</p><p>That’s great for long-running background processes.</p><p>But many critical user-facing business flows require an <strong>immediate, deterministic response:</strong></p><p><em>“User clicked borrow → we must tell them </em><strong><em>now</em></strong><em> if it succeeded or failed.”</em></p><p>For these flows, synchronous, orchestrated workflows make more sense. My approach is a practical, simplified <strong>Orchestrated Saga</strong> tailored for real-time behavior:</p><ul><li>Use an explicit Orchestrator MS.</li><li>Call services in sequence (synchronously for core steps).</li><li>Optionally mix in async events for non-critical side effects (like notifications or logging).</li></ul><p><strong>Why I Like This Approach (The Practical Benefits)</strong></p><p>This style of architecture solves the biggest pain points of distributed systems:</p><h3>1. Clean Separation of Responsibilities</h3><ul><li><strong>Domain Services:</strong> “I know my domain; don’t bother me with workflows.”</li><li><strong>Orchestrator:</strong> “I know how to combine services to achieve business goals.”</li></ul><p>You eliminate business rules leaking into multiple domain services.</p><h3>2. Easier to Change Business Flows</h3><p>Tomorrow, the product manager says: <em>“We need a fraud-check step before borrowing and only allow 2 books at once for a new membership type.”</em></p><p>You only touch the <strong>Orchestrator</strong>, and maybe update a rule in the <strong>User Service</strong>. You avoid having to refactor a chain of microservices calling each other like a chaotic WhatsApp family group.</p><h3>3. Better Control &amp; Debugging</h3><p>When something goes wrong, you are not jumping between 5 services to reconstruct what happened.</p><ul><li>You can log the entire workflow in one place.</li><li>You can implement retries, fallbacks, and basic compensation logic centrally.</li></ul><h3>4. Still Real-Time and Deterministic</h3><p>The user gets an immediate, concrete response:</p><ul><li>Borrow succeeded</li><li>Borrow failed — membership inactive</li><li>Borrow failed — book not available</li></ul><p><strong>But Wait, Won’t the Orchestrator Become a Monster?</strong></p><p>This is a valid fear. The key is how you size the orchestrator:</p><p><strong>Do not create a single “Orchestrator for the entire universe.”</strong></p><p>I prefer specialized, small orchestrators based on the <strong>Domain Use Case:</strong></p><ul><li>BorrowOrchestrator</li><li>ReturnOrchestrator</li><li>MembershipOrchestrator</li></ul><p>This keeps them small, understandable, and testable. You effectively avoid the “God Service” anti-pattern by focusing each orchestrator on a highly specific business story.</p><h3>My Design Philosophy in One Line</h3><p>If I had to sum it up:</p><p><strong>Let microservices mind their own domain. Let orchestrators worry about the story.</strong></p><p>Microservices are the <strong>characters.</strong><br>The orchestrator is the <strong>director</strong> .<br>The business flow is the <strong>movie</strong>.</p><p>You don’t want every actor directing each other on set — that’s how chaos happens.</p><p>If you’ve also suffered personally from microservice madness, this style of architecture might feel like a breath of fresh air. It’s a sane, practical way to design microservices that scales as your system and team grow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f47c0fb2287f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>