<?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 Utku Apaydin on Medium]]></title>
        <description><![CDATA[Stories by Utku Apaydin on Medium]]></description>
        <link>https://medium.com/@utkuapaydin?source=rss-22a6b972ed2f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wdJfV9BUv2PB_qJRgyRNJA.jpeg</url>
            <title>Stories by Utku Apaydin on Medium</title>
            <link>https://medium.com/@utkuapaydin?source=rss-22a6b972ed2f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 09:21:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@utkuapaydin/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[Knowledge and Mechanism]]></title>
            <link>https://utkuapaydin.medium.com/knowledge-and-mechanism-ea3023825038?source=rss-22a6b972ed2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea3023825038</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[harness-engineering]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[developer-tools]]></category>
            <dc:creator><![CDATA[Utku Apaydin]]></dc:creator>
            <pubDate>Mon, 19 Oct 2026 09:41:21 GMT</pubDate>
            <atom:updated>2026-10-20T05:02:28.929Z</atom:updated>
            <content:encoded><![CDATA[<h4>Engineering an Agent Harness That Doesn’t Know What Your Business Does</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*STczqhvUJW3bnSfT4-T6CA.png" /></figure><h3>The fight</h3><p>Every engineering organisation that adopts AI agents hits the same argument. One camp says the agent’s harness — the rules, the context, the scaffolding around the model — should be built for our business: load it with our domain, our workflows, our specifics, so the agent knows what we do. The other camp says the harness should stay generic, and the business knowledge should live somewhere else. This sounds like a philosophical preference. It isn’t. <strong>It’s an architectural decision</strong>, and like most architectural decisions, getting it wrong is expensive in ways you don’t see until later. This is the story of why I put the business knowledge outside the harness, and the benchmark that showed me what that choice actually buys — and what it doesn’t.</p><h3>The thesis</h3><p>Here is what I ended up doing, and why it has held up. A harness, as I use it, has one job: to govern the workspace. It knows which repositories exist, who owns each one, how they talk to each other, and what an agent should check before it touches anything. That is mechanism, and it changes for engineering’s reasons. Business knowledge is different. It changes when the business decides, <strong>it belongs to people who never read the harness</strong>, and it needs to be reviewed, versioned, and reused on its own terms.</p><p>When we started, nobody called this a harness. Inside the company we called it <strong>AI infrastructure</strong>. We wrote skills, instructions, and agent files, and we put them where it felt natural: inside each repository. Every service carried its own rules. It didn’t work — not because the agent did bad work, but because of what it cost to make it do good work. Anything that spanned repositories, a flow across services or a contract with a database schema that lived in a repository of its own, had no place to live. So the agent did the right thing: it stopped and asked. And we answered, every time, by hand — new prompts, new instructions, new documents, for every new task — unless we had already gathered those documents into the repository we were working in. Which meant the same knowledge got copied into repository after repository, because that was the only place the agent could see it. The knowledge existed, but it existed in people and in scattered copies, and we were re-explaining it at every step.</p><p>That is what pushed us to a workspace above the repositories, and it’s what taught me where the split belongs. The harness carries how work is done. Knowledge about what the business is lives outside it, in a governed home of its own — and it earns that home when it describes a contract across a boundary a single repository cannot see: another service, or a database whose history no single service carries. That last case turned out to be the one that mattered most.</p><h3>What governing the workspace means</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LghDVJ2nZEAJIRT-R-bdiQ.png" /><figcaption><strong>The harness writes the blue and reads the green. It never touches the rest</strong></figcaption></figure><p>Governing the workspace is less mysterious than it sounds. In practice it comes down to five things the harness keeps, and that no single repository could keep for itself.</p><ul><li>The first is a <strong>registry</strong>: every repository, where it lives, and what it is built with, read from its build files rather than guessed. The agent never scans the tree to find out what exists.</li><li>The second is <strong>ownership</strong>. Every repository has an owner, and touching another team’s repository means stopping and confirming first. In an organisation with an architecture committee and a regulator, that line is not optional.</li><li>The third is a <strong>self-description</strong> at the root of each repository, owned by that repository. Change the service and you update the description in the same task. A stale description is worse than none.</li><li>The fourth is a <strong>domain map</strong> of how the repositories talk to each other. A contract change is a map change. It lives nowhere else.</li><li>The fifth is being <strong>provider agnostic:</strong> this is harder to see from inside a single repository, the workspace does not belong to one agent. We run more than one provider, and they share the same workspace at the same time. A typical task starts with one agent planning it in one terminal; a second agent, in another terminal on the same workspace, implements that plan; the first one reviews the result. Each reads the same registry, the same ownership rules, the same handoff and memory, so the plan one agent writes is the plan the other one executes. And when a quota runs out mid-task, the work simply continues in the other window.</li></ul><p>Here is the part that matters for the argument. The harness works with any agent, on any machine, for any business — and we arrived at all three the same way. The platform one is the least glamorous: the harness ships its own tooling, and that tooling has to behave identically on a Windows laptop and a Mac, or the rules are only real for half the team. The agent one we learned the day a quota ran out mid-task. In both cases, tying the harness to one agent or one machine had an immediate, obvious cost, so we removed the dependency. Tying it to one business costs just as much — it just arrives later, after the copies have already spread.</p><p>Notice what is not on this list. There is no business rule here. No campaign logic, no tariff, no eligibility flow. The harness knows that a service exists, who owns it, what it exposes, and who calls it. It does not know what the business means by any of it. That is deliberate, and the next section is about where that meaning went.</p><h3>The database boundary</h3><p>Every example so far is about repositories talking to repositories. The case that taught me the most is about something the repositories can’t tell you cheaply, even though they contain it.</p><p>The system we are transforming isn’t one application. It’s several, built over fifteen years in different technologies — distributed, but never by design. We are gathering them into one microservice environment. The database side is versioned too: schema, procedures, views, all in a repository our own team governs. Nothing is missing from version control. What’s missing is the understanding. The longest-serving person on the team has been here five years. The first ten years of decisions are in the repositories, and nobody is left who can read them quickly.</p><p>An agent can read all of it, and it reads fast. The question is whether it should have to, every time. Pointed at a service that reads a legacy table, the agent will happily walk fifteen years of scripts to find out what one attribute key means — and burn most of its context on a question answered a decade ago. Agents can do anything. The point of the harness is that they shouldn’t have to.</p><p>So that knowledge got a governed home outside the harness: a <strong>knowledge base</strong>, one separate repository cloned into the workspace, with its own owner and its own review — branch, lint, secret scan, pull request, like any code.</p><p>Four parts matter for our transformation, and they share one property: none of them can be seen from inside a single repository.</p><ul><li>The database: which tables matter, how they are keyed, what the odd ones actually encode. Several services read the same tables; no one of them owns that knowledge.</li><li>The new architecture: how the services talk and how business flows are achieved across them. A flow that crosses five services lives in none of the five.</li><li>The legacy applications: how they handle those same flows today, with references into the actual code so the agent reads the source when it needs to, not before.</li><li>The transformation decisions: how legacy code becomes new code, where one synchronous call from years ago often has to become an asynchronous flow across several services. Those decisions are mine as the architect, and they are specific to this team and this business — which is precisely why they live here and not in the harness. Written once, they are what my colleagues follow and what the agent follows.</li></ul><p>That shared property is also the rule of thumb for what goes in. If a piece of knowledge is <strong>wholly contained by one service</strong> — how the entry gateway authenticates and routes, how the notification service talks to its providers — it stays in that service’s own repository, where its owner reviews it. The knowledge base is for what no single repository can see: <strong>a flow that crosses services</strong>, a table that several of them read, a decision that reshapes more than one of them. Crossing a boundary is what earns a fact its place there.</p><p>The harness knows the knowledge base exists and tells the agent when to look there. It knows nothing about what’s inside. That’s the whole division of labour in one sentence: the agent knows where to look before it has to work out what to look for. And that is the case the benchmark turned on.</p><h3>The evidence</h3><p>I wanted to know what the split actually bought, so I measured it. Three tasks, each a real feature in our transformation: expose one piece of legacy behaviour through a new endpoint in one of the microservices. Same model, same prompts, three runs per setup. Every solution was reviewed blind by two independent reviewers who saw scrubbed diffs and no setup names.</p><blockquote><strong>Four setups:</strong></blockquote><ul><li><strong>Bare agent.</strong> The twenty-five repositories side by side and nothing else — no workspace, no rules, no knowledge base, sandboxed so it could reach nothing beyond its folder.</li><li><strong>Knowledge only.</strong> The same bare agent, with one addition: the knowledge base dropped next to the repositories as a plain folder. Nothing pointed to it.</li><li><strong>Original harness.</strong> The full workspace harness as it stood when I started.</li><li><strong>Updated harness.</strong> The same workspace after one change, described below.</li></ul><figure><img alt="Knowledge improves correctness. Guardrails limit overreach." src="https://cdn-images-1.medium.com/max/1024/1*9XHAcOpjqnn7ZIfa7UJSBw.jpeg" /><figcaption><strong>Knowledge improves correctness. Guardrails limit overreach.</strong></figcaption></figure><p>The change came out of the first round itself. With the original harness, reviewers kept flagging the same two things: an agent switching off security enforcement in the target service because a neighbouring service had it off, and an agent deleting an endpoint nobody mentioned because a rule seemed to imply it. The harness already had a rule against guessing names and a rule that dead endpoints should be cleaned up. The problem was that it didn’t say when. So I added two lines: never weaken security unasked — if a test needs it off, scope it to the test — and apply clean-up rules only when the user asks for clean-up, not as a side effect of another task. Notice what that is: a rule about how an agent behaves, not about what the business is. Nothing in the knowledge base changed. That distinction matters for what follows.</p><p>The three tasks turned out to be three different experiments.</p><p>The first task needed nothing the repositories didn’t already contain. The rule under test — stored logic only through the wrapper service — is demonstrated by existing code a few files away. All four setups scored within a point of each other. When the code already carries the knowledge, nothing you add on top makes a measurable difference.</p><p>The second task tested discipline. The architectural rule was documented in a neighbouring repository, and every setup found and followed it. What separated them was everything they did that nobody asked for. The bare agent switched off security enforcement in the target service, copying a setting from a neighbour, all three times. The original harness did the same, and one run also deleted an existing endpoint, citing a rule. The agent with only the knowledge base was the worst of all: the knowledge base’s architecture decisions pushed it to act, and with nothing bounding how far it acted, it switched security off, deleted endpoints, and sprinkled rule identifiers across two repositories. It scored lowest of any setup on any task. The updated harness was the only one that kept security on, explained the consequence for callers, and tested it. Knowledge without discipline is worse than neither.</p><p>The third task tested knowledge. The feature needed a value from a legacy contract table that uses an attribute-keyed design — one row per attribute, and the value sits under two specific attribute identifiers. That fact is written in exactly one place: the knowledge base. I verified it appears in none of the twenty-five repositories, in any commit, ever. The bare agent invented plausible column names three times out of three; all three said in their own notes they were guessing. Their builds were green and their tests passed, because the tests mock the database. Every one would have failed on first contact with the real one. The agent with just the knowledge base folder found it unprompted, within its first few tool calls, and got the schema right three times out of three — on fewer tokens than any other setup. The two harness arms got it right too. The knowledge closed the gap almost entirely on its own; the harness added a point on top.</p><p>Put the three together. Where the repositories already know, nothing helps. Where the fact lives outside the repositories, the knowledge base is what makes the code correct — and it does so with no harness at all. Where the agent has to be trusted not to overreach, the harness is what makes the result safe — and the knowledge base alone makes that worse. Correctness comes from knowledge. Safety comes from mechanism. They are separable, and I measured each one alone.</p><p>Two more things, because they belong in the record. The scoring criteria changed between the first review round and the last, and the later criteria target exactly the defects the first round exposed. The ranking of the setups is the same under both rubrics and under the mechanical checks, but I’d rather you heard that from me. And on the first task, all twelve solutions — every setup — logged a raw customer identifier at INFO level, when the sibling endpoint beside them masks it. Neither the rules nor the knowledge base prevented that. It’s the next check to add, and I’ll come back to why that’s the point.</p><h3>The cost</h3><p><strong>None of this is free</strong>, and the benchmark put numbers on the parts that aren’t.</p><p>The first cost is tokens — input tokens, specifically, since that’s where the harness spends: it has to read a registry, an ownership file, a self-description and a domain map before it touches code. Output was almost unchanged. On the first two tasks the harness arms used roughly <strong>15% to 30%</strong> <strong>more</strong> input tokens than the bare agent. On the third they used the same, and finished faster, because the bare agent spent its tokens searching twenty-five repositories for a schema that was never there. So the overhead is real but bounded, and it inverts exactly where the fact lives outside the code. The honest reading is that the harness is a tax on easy work and insurance on hard work, and the tax is smaller than I expected.</p><p>The second cost is that the harness is never finished. Every round of review has found a behaviour nobody wrote a rule for, because nobody had seen it yet. The first round found security being switched off. The last one found a raw identifier in the logs, in every setup, which no rule and no knowledge base had anything to say about. That check goes in next, and another one will follow it. This is the part the business-specific camp gets right: the harness has to keep changing. What they get wrong is what changes. Every rule I have added is about how an agent behaves — what it may remove, what it may weaken, what it may guess. Not one has been about what the business is.</p><p>The third cost is the quietest. The knowledge base holds decisions as well as facts, and the benchmark showed what decisions do: they make the agent act. The same architecture rules that made the knowledge-only agent correct on the third task made it reckless on the second. That is not a flaw in the knowledge base; it’s what a decision is for. But it means the knowledge base is not a passive reference. It is a governance surface with an owner, a review, and a blast radius, and it has to be treated like one. The harness bounds how far an agent acts on it. Nothing bounds what you write into it except the review you put in front of it.</p><h3>The payoff</h3><p>So what did the split buy, beyond the scores?</p><p>Three things, and none of them show up in a benchmark.</p><p>The first is versioning. The harness and the knowledge base change for different reasons, on schedules nobody could align. The harness ships a version or two a week, because a harness is a tool and tools have a life: a new behaviour rule, a feature, better context and token management, an indexing change, a bug found and fixed. None of it touches a business fact. The knowledge base changes when the business does — three times in one week, then not for a month, on the decisions of people who have never seen the harness. When the two lived together, every business change was a harness change, and every harness change risked the business content. Now a wrong line in the knowledge base is a wrong fact — reviewed by the person who owns that fact, reverted like any commit — and it cannot break the mechanism that keeps the agent safe.</p><p>The second is reuse. The harness has no idea what our business is, which means it has nothing to say about anyone else’s either. The same installer, the same registry, the same ownership rules work on a workspace with none of our repositories in it. Another team with a different domain, a different database and different politics can take the harness as it is and bring their own knowledge base. If the business had been inside it, they would have taken a copy and started editing, and in six months there would have been two harnesses and nobody maintaining either. The copies I described in in the thesis section were a symptom of exactly that.</p><p>The third is the one that matters most where I work. Everything the agent is allowed to do is written down in the harness, and the harness is small, generic and stable, so it can be read in an afternoon by someone who has never seen our code. Everything the agent knows about the business is written down in the knowledge base, and every line of it has an author, a reviewer and a date. When an architecture committee asks why an agent made a change, there are two places to look, and they are different places. The rule it followed is in one, the fact it relied on is in the other, and neither is a prompt someone typed into a terminal and lost.</p><p>That is the real argument against building the harness for the business. Not that it fails — it works, for a while. It’s that the moment it works, you have fused the thing that governs how agents behave with the thing they know, and from then on you cannot change, review, reuse or explain either one without touching the other. I separated them for the same reason I separate anything: they have different responsibilities, different owners and different rates of change. The benchmark didn’t make that decision. It told me what the decision was worth — and, just as usefully, where it was worth nothing at all.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea3023825038" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Harness Engineering: Turning Wild AI Power Into Reliable Software Delivery]]></title>
            <link>https://utkuapaydin.medium.com/harness-engineering-turning-wild-ai-power-into-reliable-software-delivery-c50e8db677fd?source=rss-22a6b972ed2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c50e8db677fd</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[harness-engineering]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[enterprise-technology]]></category>
            <dc:creator><![CDATA[Utku Apaydin]]></dc:creator>
            <pubDate>Mon, 15 Jun 2026 07:03:00 GMT</pubDate>
            <atom:updated>2026-06-15T07:03:00.537Z</atom:updated>
            <content:encoded><![CDATA[<p>AI coding agents are becoming incredibly powerful.</p><p>They can read code, generate features, refactor modules, explain legacy systems, write tests, summarize logs, and even operate across tools. But every developer who has used them seriously has seen the same problems: you explain the architecture once and the agent forgets it ten minutes later, you ask the same question twice and get two completely different solutions, it confidently changes files outside the intended scope, or it generates code that looks correct until you discover it ignored a critical business rule. Raw capability is impressive, but consistent and reliable delivery is a very different challenge.</p><p>That is the core problem: AI agents are powerful, but power alone does not create reliable software delivery.</p><p>This is where <strong>harness engineering</strong> enters the conversation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*BvzB_Mt9xjvRZehYonpfQQ.png" /></figure><p>A wild horse has power, speed, and instinct. It can run far. It can reach places quickly. But without direction, it may overshoot the destination, injure itself, or create chaos around it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*xhQ2NYzXAdMBUWfrJ4ODzA.png" /></figure><p>A champion horse is not less powerful. It is trained, guided, constrained, and synchronized with the rider. The harness does not remove its strength. The harness makes that strength useful.</p><p>AI agents are similar.</p><p>The model is the horse.<br>The harness is the system that makes its power safe, repeatable, and aligned with engineering goals.</p><blockquote><strong>This article does not try to redefine harness engineering from scratch. It explains how I think about applying it in real enterprise software delivery, especially when multiple agents and multiple repositories are involved.</strong></blockquote><h3>From Prompt Engineering to Harness Engineering</h3><p>The first wave of AI usage in software was mostly about <strong>prompt engineering</strong>.</p><p>We asked: “How should I phrase the request so the model gives a better answer?”</p><p>Then we moved toward <strong>context engineering</strong>.</p><p>We asked: “What information should the model see before it acts?”</p><p>That was a huge improvement. Instead of expecting the model to magically know our codebase, we started giving it architecture documents, examples, API contracts, coding conventions, logs, tickets, and domain knowledge.</p><p>But once AI agents started doing more than answering questions, context alone became insufficient.</p><p>When an agent can modify files, run commands, create branches, open pull requests, call tools, and interact with systems, we need a broader engineering discipline.</p><p>That discipline is harness engineering.</p><p>Harness engineering asks a different question:</p><blockquote><strong>What system must surround the AI agent so that its work becomes observable, controllable, verifiable, and safe?</strong></blockquote><h4>Agent = Model + Harness</h4><p>The model provides intelligence.<br>The harness provides structure.</p><p>Without the harness, the agent is powerful but unpredictable. With the harness, the agent can operate inside a defined engineering system.</p><h3>Harness Engineering in the Real World</h3><p>Let’s get to the practical side of things.</p><p>In our day-to-day work, most of us do not rely on a single AI agent. We might use Claude for architecture discussions, Codex for implementation tasks, Copilot for in-editor assistance, or other specialized agents depending on the situation.</p><p>The challenge is that every agent comes with its own way of working.</p><p>Each agent has different instructions, memory mechanisms, workflows, context handling approaches, and preferred formats. Some use files such as AGENTS.md, others rely on workspace rules, custom prompts, or platform-specific configurations. While many of these concepts are similar, they were designed with different assumptions and goals in mind.</p><p>As engineers, however, our delivery standards do not change just because we switch agents.</p><p>We still need to follow the same architectural principles. We still need to satisfy security requirements. We still need to produce the same level of quality, documentation, testing, and traceability regardless of which AI assistant helped generate the work.</p><p>This raises several practical questions:</p><ul><li>How do we maintain consistent engineering standards across different agents?</li><li>How do we automate our quality checklist instead of repeating it manually?</li><li>How do we track what has already been completed and what remains to be done?</li><li>How do we preserve context between sessions and tasks?</li><li>How do we switch between agents when we hit token limits, usage quotas, or platform restrictions without losing momentum?</li></ul><p>This is where harness engineering becomes valuable.</p><p>A well-designed harness creates a layer above individual AI tools. Instead of depending on the behavior of a specific agent, the team defines a common operating model that every agent must follow.</p><p>The harness becomes the source of truth.</p><p>It defines the standards, workflows, checkpoints, documentation structure, task tracking, validation rules, and quality gates. Whether the work is performed by Claude, Codex, Copilot, or the next generation of AI agents, the expectations remain the same.</p><p>In this model, agents become interchangeable workers operating within a shared engineering system.</p><p>The harness tracks progress.<br>The harness enforces standards.<br>The harness preserves context.<br>The harness validates outcomes.<br>The harness ensures continuity when switching between tools.</p><p>This is one of the most important reasons harness engineering is gaining attention. It is not only about making a single AI agent more effective. It is about creating a repeatable engineering framework that allows multiple agents to contribute while maintaining the consistency, quality, and governance required in real-world software delivery.</p><p>This is the important shift:</p><blockquote>We are no longer only designing prompts.<br>We are designing the working environment of the agent.</blockquote><h3>What the Harness Looks Like in Practice</h3><p>A harness does not have to be a single product, framework, or platform.</p><p>In practice, it can be a combination of files, rules, workflows, automation, and checkpoints that shape how agents work inside a software project.</p><p>For example, an agentic development workspace may include a structure like this:</p><pre>workspace/<br>├── WORKSPACE_INDEX.md<br>├── workspace.yml<br>├── repos/<br>│   ├── service-a/<br>│   ├── service-b/<br>│   └── frontend-app/<br>├── shared/<br>│   ├── memory/<br>│   │   ├── store.json<br>│   │   ├── MEMORY.md<br>│   │   └── active-context.md<br>│   ├── todo/<br>│   │   └── TODO.md<br>│   └── metrics/<br>├── docs/<br>│   ├── sessions/<br>│   ├── plans/<br>│   └── architecture/<br>└── agents/</pre><p>This structure may look simple, but it solves a very real problem.</p><p>AI agents suffer from session amnesia. They may forget what was decided yesterday, repeat completed work, lose track of constraints, or start solving a task without understanding the current state of the project.</p><p>A workspace harness gives the agent a place to start and a way to continue.</p><p>WORKSPACE_INDEX.md tells the agent what to read first.<br>workspace.yml provides a machine-readable map of the environment.<br>/repos contains the actual source code repositories the agent may inspect or modify.<br>The memory folder stores durable decisions and reusable facts.<br>The active context file explains what is happening right now.<br>The todo folder tracks what is done, what is pending, and what must not be forgotten.<br>The architecture folder preserves the rules that should shape every implementation decision.</p><p>That means the agent is not dropped blindly into a repository and expected to understand everything from the code alone. It enters through the workspace, reads the operating rules, understands the current task, checks the shared memory, and only then works inside the relevant repository. This is especially important in complex microservice environments, where understanding service <strong>boundaries</strong>, <strong>dependencies</strong>, <strong>shared contracts</strong>, and <strong>cross-repository context</strong> is often just as important as understanding the code within any single repository.</p><p>In this model, /repos is the execution area.</p><p>The surrounding files are the control system.</p><p>The model decides what code to write.<br>The harness governs where it writes, how far it goes, what rules it follows, and how it proves the work is complete.</p><p>Without a harness, the agent behaves like a talented developer who joins the project with no onboarding, no architecture guide, no task tracking, and no review process.</p><p>With a harness, the agent works inside an engineering system.</p><blockquote>It knows the scope.<br>It knows the constraints.<br>It knows the evidence expected from it.<br>It knows how to leave the workspace clean for the next session.</blockquote><p>That is the difference between using AI as a chat assistant and using AI as part of a software delivery lifecycle.</p><h3>Guides and Sensors</h3><p>A practical way to understand harness engineering is to separate it into two parts: <strong>guides</strong> and <strong>sensors</strong>.</p><p>Guides act before and during the agent’s work.</p><p>They tell the agent what good looks like. They define the rules of the project. They describe architecture principles, coding standards, naming conventions, testing expectations, documentation rules, and forbidden actions.</p><p>In a real software project, guides may look like this:</p><ul><li>Always read WORKSPACE_INDEX.md before starting.</li><li>Work only inside the relevant repository under /repos.</li><li>Check shared memory before making architectural assumptions.</li><li>Do not bypass the gateway when calling internal services.</li><li>Do not place business logic in the controller layer.</li><li>Use the shared client library for outbound REST calls.</li><li>Every bug fix must include a regression test.</li><li>Every new API must include documentation.</li><li>Do not change database schema without a migration script.</li></ul><p>These rules are not just “nice to have” instructions.</p><p>They are how we transfer engineering standards into the agent’s operating environment.</p><p>Sensors act after or during the agent’s work.</p><p>They check whether the result is actually acceptable. They catch mistakes, regressions, security risks, architectural drift, missing tests, broken contracts, and low-quality output.</p><p>Examples of sensors include:</p><ul><li>Unit tests</li><li>Integration tests</li><li>Contract tests</li><li>Static analysis</li><li>Linting</li><li>Build verification</li><li>Security scans</li><li>Code coverage checks</li><li>Architecture tests</li><li>Pull request review</li><li>Runtime smoke tests</li><li>Deployment quality gates</li></ul><p>Guides without sensors are just advice.</p><p>Sensors without guides create a frustrating loop where the agent keeps making avoidable mistakes and the system keeps rejecting the output.</p><p>A strong harness needs both.</p><p>The guides shape the behavior of the agent.<br>The sensors verify the outcome of the work.</p><p>This is where harness engineering becomes more than documentation. It becomes an operating model for AI-assisted software delivery.</p><h3>Further Reading and Influence</h3><p>This article builds on the growing discussion around harness engineering in AI-assisted software development.</p><p>OpenAI’s article, <a href="https://openai.com/index/harness-engineering/">“Harness engineering: leveraging Codex in an agent-first world”</a>, helped popularize the idea that engineering work is moving toward environments, feedback loops, repository knowledge, and control systems around coding agents.</p><p>Birgitta Böckeler’s article on Martin Fowler’s site, <a href="https://martinfowler.com/articles/harness-engineering.html">“Harness engineering for coding agent users”</a>, provides a useful mental model of guides and sensors as a way to build trust in AI-generated code.</p><p>Anthropic’s article, <a href="https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents">“Effective harnesses for long-running agents”</a>, highlights the importance of persistent context, state, and structured continuation when agents work across longer tasks.</p><p>The open-source course <a href="https://github.com/walkinglabs/learn-harness-engineering">“Learn Harness Engineering” by Walking Labs</a> is also a useful resource for anyone who wants to explore harness engineering more deeply.</p><p>My focus here is slightly different: how these ideas apply inside enterprise software teams that use multiple AI agents, multiple repositories, microservice boundaries, shared architecture rules, and delivery governance. In that context, the harness becomes more than a tool-specific configuration. It becomes the common operating model that allows different agents to work inside the same engineering standards.</p><h3>Closing Thought</h3><p>AI agents are not replacing engineering discipline.</p><p>They are increasing the need for it.</p><p>The more powerful the model becomes, the more important the harness becomes. A weak model with a strong harness can still produce useful and controlled outcomes. A strong model without a harness can easily become unpredictable, inconsistent, or even risky in real software delivery.</p><p>That is why harness engineering matters.</p><p>It is not about limiting AI.</p><p>It is about making AI useful inside the realities of software engineering: architecture, quality, security, traceability, maintainability, and production responsibility.</p><p>The future of AI-assisted development will not only belong to the teams using the most powerful models.</p><p>It will belong to the teams that know how to guide that power.</p><blockquote>Because in the end, the question is not whether the horse can run.<br>The question is whether we can guide it toward the right destination.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c50e8db677fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event-Driven Architecture: Design Patterns and Anti-Patterns from the Trenches]]></title>
            <link>https://utkuapaydin.medium.com/event-driven-architecture-design-patterns-and-anti-patterns-from-the-trenches-92c411ede5a8?source=rss-22a6b972ed2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/92c411ede5a8</guid>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Utku Apaydin]]></dc:creator>
            <pubDate>Mon, 14 Apr 2025 12:20:25 GMT</pubDate>
            <atom:updated>2025-04-14T12:20:25.897Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fk84FqsLUOMDLxnAhXIY_Q.png" /></figure><h3>Why Events? Why Messaging?</h3><p>As software systems grow in complexity and scale, the need for asynchronous, decoupled communication between services becomes critical. Event-driven architecture (<strong>EDA</strong>) addresses this challenge by enabling services to react to events, rather than relying solely on direct, synchronous interactions like REST APIs.</p><p>In our own journey of modernizing a legacy monolithic application, we quickly realized that merely breaking down the monolith into smaller services was not enough. We also had to rethink how those services would communicate. Messaging systems such as Apache Kafka and RabbitMQ became foundational to this shift. They empowered our services to become more resilient, scalable, and loosely coupled.</p><p>This article reflects on our real-world experience implementing EDA using messaging systems. We’ll explore patterns that helped us succeed, the anti-patterns that slowed us down, and the practical lessons we learned along the way.</p><h3>Core Concepts Recap</h3><p>Before diving into patterns, a quick recap of essential concepts:</p><ul><li><strong>Event</strong>: A record of something that happened, typically immutable.</li><li><strong>Producer/Consumer</strong>: Services that emit or react to events.</li><li><strong>Topic/Queue</strong>: Logical channel where events/messages are published.</li><li><strong>Partition/Shard</strong>: Scalable unit for parallel message processing (platform-specific).</li><li><strong>Offset/Sequence ID</strong>: Identifier for message ordering (platform-specific).</li><li><strong>Consumer Group</strong>: Multiple consumers sharing the load of processing messages from a topic or queue.</li></ul><h3>Design Patterns We Adopted</h3><h4>Combining Choreography and Orchestration</h4><p>One of the most important realizations we had was that choreography and orchestration are not mutually exclusive. Real-world systems often benefit from a hybrid approach depending on the complexity and criticality of the workflow.</p><p>In many of our flows, we used <strong>choreography</strong> — where each service reacts to events it is interested in. For instance, when an OrderPlaced event is emitted, services like InventoryService, BillingService, and NotificationService respond independently.</p><p>However, in more critical or tightly coordinated workflows, such as payment processing, we adopted <strong>orchestration</strong>, where a central orchestrator service dictates the sequence of actions and handles retries or compensation logic.</p><p>In our case, we also had an existing enterprise orchestration platform based on <strong>BPEL (Business Process Execution Language)</strong>. Since BPEL follows a choreography-driven model, we had to integrate some of our newly developed event-based flows into this platform. This hybrid model allowed us to reuse existing infrastructure while also introducing more scalable and flexible designs.</p><p>That said, adopting a hybrid approach requires a clear understanding of <strong>flow ownership and boundaries</strong>. In complex enterprise systems, one flow may trigger another that is managed by a completely different subsystem. For example, a sales workflow might end with a successful transaction event, but this could then initiate a separate billing flow managed by a different process engine. Each flow needs to maintain its own lifecycle and responsibilities, even when interconnected. Overlooking these boundaries can lead to tangled dependencies and unclear ownership, which undermines the benefits of modularity and loose coupling.</p><p><strong>Choreography Pros:</strong></p><ul><li>Loose coupling</li><li>High scalability</li></ul><p><strong>Orchestration Pros:</strong></p><ul><li>Better control over flow and error handling</li><li>Easier to visualize and monitor complex workflows</li></ul><p><strong>Key Takeaway:</strong> A hybrid model allows for flexibility. Use choreography where autonomy and simplicity are preferred; use orchestration when flow control and consistency are more important. In many organizations, legacy or centralized orchestration engines like BPEL may still play a vital role alongside newer event-driven patterns. Regardless of the approach, it’s essential to analyze the big picture and clearly define responsibilities for each flow.</p><h4>Single Writer Principle (With Caveats)$1Key Insight:</h4><p>In our current transformation project, where we are migrating from a legacy monolithic system to a microservices architecture, we’ve encountered several situations where responsibilities could not be easily separated. This is often the result of tightly coupled workflows in the legacy monolith, where multiple teams have historically shared or overlapped responsibilities across the same functional areas.</p><p>Sometimes, due to team resistance or business constraints, we were unable to fully decompose responsibilities right away. In these scenarios, we found it necessary to be pragmatic and slightly bend architectural principles like the Single Writer Rule to keep the momentum of the migration effort alive.</p><p>It’s important to recognize that transformation is an iterative process. Temporary exceptions can be acceptable as long as there’s a clear plan to evolve the architecture towards more autonomy and better separation over time.</p><p>Rather than blindly applying the Single Writer Principle, it’s important to evaluate domain ownership holistically. Clear communication between teams, event versioning, and schema validation become essential when multiple services influence the same business entity.</p><h4>Event Sourcing (When It Makes Sense)$1Why we didn’t use it:</h4><p>We chose not to adopt event sourcing in our architecture for several reasons. Most notably, our organization already had mature internal practices around data versioning and reporting, deeply integrated into our relational database infrastructure. These capabilities were considered business-critical, and leadership made a conscious decision not to disrupt them during the transition.</p><p>Additionally, the complexity and overhead associated with implementing event sourcing did not justify its benefits in our specific context. We found that patterns like the outbox pattern and change data capture (CDC) provided sufficient support for traceability and auditability without requiring a full shift in data modeling or processing.</p><p><strong>Typical use cases (for teams considering it):</strong></p><ul><li>Audit trails</li><li>Replaying domain logic</li></ul><p><strong>Caution:</strong></p><ul><li>Overhead in storage and replay logic</li><li>Not all domains need full event sourcing</li></ul><h4>Saga Pattern for Distributed Transactions</h4><p>For multi-step business flows (e.g., order -&gt; payment -&gt; shipment), we explored several approaches to implement the Saga pattern effectively.</p><p>Initially, we evaluated out-of-the-box solutions like <strong>Axon Framework</strong>, <strong>Eventuate</strong>, and others, but due to organizational constraints and the need to avoid introducing external dependencies, we decided to implement an internal solution.</p><p>In the early phases of our transformation, we deliberately designed our workflows to avoid complex transaction management. This helped us move forward without being blocked by distributed transaction concerns.</p><p>As complexity grew, we developed a custom synchronous solution using Spring Boot. This solution handled rollback scenarios for failed transactions automatically and followed the principles of a <strong>choreographed saga</strong>, but executed synchronously within the service boundary.</p><p>Later, for scenarios where the synchronous model was insufficient, we introduced an <strong>asynchronous choreographed saga</strong> using Kafka-based event messaging. This approach allowed services to react to events and coordinate state changes in a decoupled and resilient manner.</p><p>We continue to maintain both models depending on the workflow requirements — synchronous for simpler or tightly coupled flows, and asynchronous for distributed, cross-domain interactions.</p><h3>Anti-Patterns We Faced (and How We Fixed Them)</h3><h4>Fat Events</h4><p>We initially included full object graphs in events, making them heavy and tightly coupled. Later, we adopted minimal, intent-focused payloads with references.</p><h4>Emitting Events Post DB Commit (Outbox Pattern Needed)</h4><p>Relying on code to emit events after DB operations caused message loss when the service crashed post-commit. We adopted the <strong>Outbox Pattern</strong> to atomically persist events within the same transaction and publish them asynchronously.</p><h4>No Topic Naming Convention</h4><p>Without a consistent naming pattern, topics quickly became difficult to manage and understand across teams. We established a naming convention that followed the format: &lt;domain&gt;.&lt;application&gt;.&lt;business-event&gt;. This structure helped us align messaging with team ownership and made it easier to trace the origin and intent of each event.</p><h4>Commands as Events</h4><p>We mistakenly used event topics to trigger actions, blurring command-event boundaries. Refactoring helped us separate:</p><ul><li>Commands: “Do this”</li><li>Events: “This happened</li></ul><h3>Observability and Debugging</h3><p>Understanding what happens in an event-driven system is crucial. We adopted:</p><ul><li><strong>Message headers</strong> for trace IDs</li><li><strong>Distributed tracing (Dynatrace, Jaeger, OpenTelemetry)</strong></li><li><strong>Dead Letter Queues</strong> to capture failed events</li><li><strong>Metrics &amp; dashboards</strong> to detect lagging consumers</li></ul><h3>Lessons Learned and Recommendations</h3><p>Reflecting on our experience, several key lessons emerged that continue to guide how we design and evolve our event-driven architecture:</p><ul><li><strong>Principles should serve progress, not block it.</strong> While architectural principles like the Single Writer Rule or strict service boundaries are important, transformation efforts often require pragmatic flexibility — especially when dealing with legacy systems and cross-functional ownership.</li><li><strong>Hybrid models are a reality.</strong> In enterprise systems, choreography and orchestration often coexist. Recognizing where each is appropriate, and designing for clear flow ownership, helps avoid tangled responsibilities and accelerates delivery.</li><li><strong>Not every use case justifies full event sourcing.</strong> In our case, the existence of well-established versioning and reporting systems built on relational databases made it unnecessary — and even risky — to introduce event sourcing.</li><li><strong>Start simple, scale gradually.</strong> Our approach to sagas evolved from avoiding transaction management altogether to building synchronous rollback mechanisms, and eventually, asynchronous sagas over Kafka. Incremental adoption prevented architectural overengineering early on.</li><li>Visibility is non-negotiable. Without tracing, headers, dead-letter queues, and dashboards, debugging event-driven systems becomes guesswork. Dynatrace and OpenTelemetry played critical roles in enabling transparency.</li><li><strong>Naming and structure matter.</strong> Adopting a consistent naming convention (e.g., &lt;domain&gt;.&lt;application&gt;.&lt;business-event&gt;) helped align technical implementation with organizational structure and ownership.</li><li><strong>Event modeling is not schema modeling.</strong> Careful attention is needed to design event payloads for long-term stability and consumption.</li></ul><p>Above all, evolving an architecture is not a one-time exercise — it’s a living, iterative journey. Trade-offs are inevitable, but with conscious design and continuous feedback, it’s possible to move fast without losing stability.</p><h3>Conclusion</h3><p>Event-driven architecture has proven to be more than just a technical shift — it’s a strategic transformation in how systems communicate, scale, and evolve. While tools like Kafka and RabbitMQ serve as reliable foundations, the true challenge lies in applying architectural principles in a pragmatic and context-aware manner.</p><p>Throughout our journey, we learned that theoretical best practices often meet real-world complexity. Legacy constraints, team structures, and business priorities require adaptable solutions. We saw this in our selective use of orchestration and choreography, our decision to forgo event sourcing, and our incremental adoption of saga patterns.</p><p>What made the difference was not blind adherence to patterns, but conscious, iterative decision-making grounded in our system’s and organization’s reality. We prioritized business continuity, minimized disruption, and always aimed to build for future flexibility.</p><p>If there’s one takeaway, it’s this: event-driven systems require more than just publishing and consuming messages — they demand clear boundaries, observable flows, collaborative ownership, and above all, a mindset shift.</p><p>The work continues. But today, we operate on a foundation that’s more resilient, scalable, and better aligned with our evolving business landscape.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92c411ede5a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Developer’s Insight: Updating and Modernizing Legacy Systems]]></title>
            <link>https://utkuapaydin.medium.com/a-developers-insight-updating-and-modernizing-legacy-systems-52d0d2e0fb0c?source=rss-22a6b972ed2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/52d0d2e0fb0c</guid>
            <category><![CDATA[technology-transformation]]></category>
            <category><![CDATA[developer-experience]]></category>
            <category><![CDATA[technical-leadership]]></category>
            <dc:creator><![CDATA[Utku Apaydin]]></dc:creator>
            <pubDate>Thu, 06 Jun 2024 11:06:36 GMT</pubDate>
            <atom:updated>2024-06-06T11:06:36.654Z</atom:updated>
            <content:encoded><![CDATA[<p>As a software engineer, one of the most daunting yet rewarding challenges is leading a transformation project that migrates an old technology stack to a new one. This process requires a deep understanding of not just the current codebase, but also the underlying data structures and business logic. If you’re fortunate, you’ll have a team to delegate tasks to; if not, the journey can be even more demanding.</p><p>In my case, I was involved in two significant transformation projects: the first was a 15-year-old .NET Framework project, and the second was a 10+ years Spring Framework project. Both were monolithic architectures. It’s been two and a half years since I started working on these projects, and I’d like to share some insights and tips from my experience.</p><h3>The Overwhelming Start</h3><p>For tech enthusiasts like us, the initial months of a transformation project can feel like being a child in a candy shop. The vast array of technologies, tools, and methodologies can be overwhelming. It’s easy to get lost in the excitement of exploring what’s best and what’s not. However, it’s crucial to understand the limitations and boundaries of your scope. Focusing on something that cannot be implemented or integrated can lead to months of wasted effort.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g6Lu3cCjPPtpRpB6YKMPsw.jpeg" /></figure><h3>Selecting the Right Tools and Technologies</h3><p>One of the most critical steps in a transformation project is selecting the right tools and technologies. As the lead developer in my transformation projects, I was responsible for researching new technologies, creating Proofs of Concept (POCs), testing various concepts, and ultimately deciding what to use. Here’s how I approached this process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cAEsSALWEWB7EjwUgL0TtQ.jpeg" /></figure><h4><strong>Research and Exploration:</strong></h4><p>· <strong>Stay Informed:</strong> Keep up-to-date with the latest trends and advancements in technology. This involves reading articles, attending webinars, and participating in industry forums.</p><p>Some valuable resources include:</p><ul><li><strong>Websites and Blogs:<br>- </strong><a href="https://dzone.com/">DZone</a>: Offers articles, tutorials, and news on various programming topics and technologies.<br>- <a href="https://techcrunch.com/">TechCrunch</a>: Provides updates on the latest technology trends and innovations.</li><li><strong>Webinars and Online Courses:<br>- </strong><a href="https://www.oreilly.com/">O’Reilly Media</a>: Hosts a variety of live online training courses and webinars on software development and architecture.<br>- <a href="https://www.coursera.org/">Coursera</a>: Provides courses from top universities and companies on modern software development and architecture.</li><li><strong>Industry Forums and Communities:<br>- </strong><a href="https://stackoverflow.com/">Stack Overflow</a>: A community where developers can ask questions and share knowledge on a wide range of programming topics.<br>- <a href="https://www.reddit.com/r/programming/">Reddit — r/programming</a>: A subreddit for discussing programming news, trends, and best practices.<br>-<a href="https://dev.to/">Dev.to</a>: A community of software developers sharing ideas and tutorials.</li></ul><p>· <strong>Identify Needs:</strong> Understand the specific needs of your project. Different projects might require different sets of tools and technologies based on their unique requirements and constraints.</p><h4><strong>Proof of Concepts (POCs):</strong></h4><p>· <strong>Create POCs:</strong> Develop small-scale POCs to test the viability of different technologies. This allows you to evaluate their performance, compatibility, and ease of integration with the existing system.</p><p>· <strong>Evaluate Results:</strong> Assess the results of each POC based on predefined criteria such as scalability, maintainability, performance, and ease of use.</p><h4><strong>Collaborative Decision Making:</strong></h4><p>· <strong>Engage the Team:</strong> Present your findings and suggestions to other experienced developers on your team. Collaborative discussions can provide valuable insights and help refine your choices.</p><p>· <strong>Management Buy-In:</strong> Prepare a High-Level Solution (HLS) design that outlines your technology choices and their benefits. Present this to management to get their buy-in and approval for moving forward.</p><h4><strong>Documentation and Planning:</strong></h4><p>· <strong>Document Decisions:</strong> Keep thorough documentation of your research, POCs, and the rationale behind your technology choices. This is crucial for future reference and for onboarding new team members.</p><p>· <strong>Plan for Implementation:</strong> Develop a detailed implementation plan that outlines how the new technologies will be integrated into the existing system. This should include timelines, resource allocation, and potential risks.</p><h3><strong>Legacy Application’s Requirements and Defects</strong></h3><p>You can’t escape technical debt, defects, and new requirements. Even if management wants you to overhaul the entire structure of a live project with no apparent time limit, there will inevitably be moments when you’ll need to pause the transformation to address urgent problems or develop new features. Balancing these competing demands is part of the challenge.</p><p>When new requirements arrive, it’s essential to evaluate them carefully. Ask your team if the requirements are truly necessary and if the KPI is viable. Inform management that if new requirements keep coming, you will need to implement them in both the old and the new projects. This dual effort can significantly impact the project timeline and resource allocation.</p><p>Here’s how you can manage this effectively:</p><ul><li><strong>Evaluate the Requirement:<br>- Necessity:</strong> Determine if the new requirement is critical for business operations or if it can be postponed until the transformation is further along.<br>- <strong>Impact:</strong> Assess how the new requirement will affect both the legacy system and the ongoing transformation. This helps in understanding the full scope of work needed.</li><li><strong>Communicate with Management:<br>- Set Expectations:</strong> Clearly communicate the implications of continuous new requirements to management. Highlight that each new addition may require parallel implementation in both the legacy and the new systems.<br>- <strong>Regular Updates:</strong> Keep management informed about the progress and any potential delays caused by new requirements. Transparency helps in aligning expectations.</li><li><strong>Plan for Parallel Implementation:<br>- Dual Development:</strong> If a requirement is urgent, plan to implement it in both the legacy system and the new system. This ensures that the business can continue operating smoothly while the transformation progresses.<br>- <strong>Resource Allocation:</strong> Ensure that your team has the necessary resources to handle the increased workload. This might mean temporarily reallocating team members or bringing in additional help.</li></ul><p>By addressing new requirements methodically and communicating effectively with all stakeholders, you can keep the transformation project on track while managing the ongoing needs of the business.</p><h3>Navigating the Learning Curve and Management Pressure</h3><p>The learning curve is a crucial factor when choosing new technologies or methodologies for a transformation project. My team, skilled at learning new techniques effortlessly, faced significant challenges in the department, particularly with our microservice transformation project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZvHi3-MeNdvLa8iFPxbaIA.jpeg" /></figure><h4>Overcoming Transaction Management Problems</h4><p>One of the first major hurdles we encountered was transaction management. In a monolithic architecture, transactions are typically managed within a single database. However, microservices often require distributed transactions, which can be complex to handle. We explored several solutions and created Proofs of Concept (POCs) to evaluate their suitability for our needs. Eventually, we found a solution that was perfect for us. This solution not only addressed our transaction management issues but also provided a platform for implementing Domain-Driven Design (DDD), which could further improve our business flows.</p><p><strong>The Promise and Challenge of DDD: </strong>DDD offers a structured approach to designing software, emphasizing the alignment of the software model with business goals. It’s particularly beneficial in complex domains where clear definitions and boundaries are essential. However, implementing DDD comes with its own set of challenges:</p><ul><li><strong>High Learning Curve</strong>: The principles of DDD are sophisticated and require a deep understanding of the business domain. It takes time and effort for the team to grasp these concepts fully.</li><li><strong>Cost</strong>: The platform we identified was not cheap. The licensing and implementation costs were significant, which brought us to a critical decision point.</li></ul><p><strong>Management’s Reluctance: </strong>Despite the potential benefits, we faced resistance from management. Our company, accustomed to legacy projects built on synchronous flows, had never used DDD. The management was skeptical about embedding such a platform into the core of the CRM project I was assigned to transform. Their concerns, which we discussed earlier, included the high learning curve and significant cost.</p><p>In the end, despite our enthusiasm and the clear technical advantages of DDD — such as improved business flow alignment, better handling of complex domains, and enhanced software architecture — management decided against adopting the new platform. This experience highlighted a common challenge in transformation projects: balancing the ideal technical solution with practical business constraints.</p><h3>Balancing Innovation with Practicality</h3><p>When selecting new tools and methodologies, it’s crucial to strike a balance between innovation and practicality. Here are some tips to navigate this balance:</p><ul><li><strong>Evaluate the Learning Curve</strong>: Consider the time and resources required for your team to learn new technologies. Ensure that the team has the capacity to manage this without compromising ongoing work.</li><li><strong>Cost-Benefit Analysis</strong>: Weigh the costs against the potential benefits. Sometimes, the immediate financial outlay can be justified by long-term gains in efficiency and capability.</li><li><strong>Pilot Projects</strong>: Implement new technologies on a smaller scale first. This allows you to manage risks and demonstrate value to management before a full-scale rollout.</li><li><strong>Stakeholder Communication</strong>: Maintain open lines of communication with management. Clearly articulate the benefits and provide evidence from POCs to support your recommendations.</li><li><strong>Incremental Adoption</strong>: Consider a phased approach to adopting new technologies. This can help manage the learning curve and spread costs over time.</li></ul><p>By carefully managing the learning curve and addressing management concerns, you can increase the chances of successfully adopting new technologies and methodologies in your transformation projects.</p><h3>Dealing with the Turnover Effect</h3><p>Turnover is inevitable. It’s a reality that team members may leave for better opportunities or personal reasons. While it’s natural for colleagues to move on, the challenge lies in managing the impact of their departure on your project. As a technical lead, you must be prepared for this situation to ensure continuity and maintain project momentum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ycrapqQ3yXur7K9M94pXQ.jpeg" /></figure><h4>Mitigating Know-How Loss</h4><p>When a team member leaves, they take with them a wealth of knowledge and experience. The immediate questions that arise include:</p><ul><li>How will you fill the gap in know-how?</li><li>Will there be enough time to onboard a new colleague effectively?</li><li>How will this impact your project deadlines and workload?</li></ul><p>These questions can be daunting, but there are strategies to mitigate the impact:</p><p><strong>Comprehensive Documentation</strong>: Documentation is crucial at every step of the project, from design and development to deployment. While documentation may seem tedious, it is an invaluable tool in managing turnover. Consider the following approaches:</p><ul><li><strong>Video Recordings</strong>: Record sessions where you explain High-Level Solutions (HLS) and key design decisions.</li><li><strong>Confluence Pages</strong>: Use Confluence or similar tools to document design processes, decisions, and project plans.</li><li><strong>Code Comments and Documentation</strong>: Ensure that code is well-documented with comments explaining the logic and purpose behind complex sections.</li></ul><p><strong>Clear Coding Practices</strong>: Clear and maintainable code is essential. When documentation is lacking, the code itself should be self-explanatory. Encourage your team to adhere to SOLID principles, which promote maintainable and scalable code:</p><ul><li><strong>Single Responsibility Principle</strong></li><li><strong>Open/Closed Principle</strong></li><li><strong>Liskov Substitution Principle</strong></li><li><strong>Interface Segregation Principle</strong></li><li><strong>Dependency Inversion Principle</strong></li></ul><p>Here is a helpful resource on SOLID principles: <a href="https://www.baeldung.com/solid-principles">SOLID Principles</a></p><p><strong>Pair Programming</strong>: Pair programming can be highly effective in sharing knowledge across the team. It ensures that at least two people are familiar with any part of the codebase, reducing the risk of knowledge loss when one person leaves. If your company does not have an official policy on pair programming, take the initiative to implement it within your team.</p><p><strong>Regular Knowledge Sharing</strong>: Foster a culture of continuous learning and knowledge sharing. Regularly scheduled meetings or “lunch and learn” sessions can provide opportunities for team members to share insights and updates on their work.</p><h4>Being Prepared for Turnover</h4><p>Unfortunately, turnover is an inevitable part of professional life. However, by being prepared and implementing these strategies, you can minimize its impact on your projects. Here are some additional tips:</p><ul><li><strong>Onboarding Plan</strong>: Have a structured onboarding plan for new team members to bring them up to speed quickly.</li><li><strong>Cross-Training</strong>: Encourage team members to learn multiple areas of the project, so that knowledge is not siloed.</li><li><strong>Backup Planning</strong>: Always have a backup plan for critical roles and responsibilities within the team.</li></ul><p>By anticipating turnover and preparing accordingly, you can ensure that your project remains on track and your team stays resilient in the face of change.</p><h3><strong>Wrapping Up</strong></h3><p>Embarking on a journey to transform legacy code is both challenging and rewarding. It requires a careful balance of selecting the right tools and technologies, managing the learning curve, addressing management concerns, and being prepared for turnover. Throughout my experience with transformation projects, I learned the importance of thorough research, clear documentation, collaborative decision-making, and maintaining a flexible yet focused approach.</p><p>Key takeaways from my journey include the necessity of continuous learning and adaptation, the value of clear and maintainable code, and the critical role of communication with all stakeholders. While technical challenges are inevitable, they can be managed effectively with proper planning and the right mindset.</p><p>To anyone embarking on a similar journey, my advice is to stay informed, be patient, and always be prepared for the unexpected. Embrace the process, learn from every challenge, and celebrate each milestone along the way. The transformation of legacy code is not just about updating technology; it’s about building a more robust, scalable, and future-proof system that can drive your business forward.</p><p>By sharing these insights and strategies, I hope to provide a roadmap for fellow software engineers and teams facing similar challenges. Remember, the journey of transformation is as important as the destination, and each step you take brings you closer to a more modern and efficient architecture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52d0d2e0fb0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamic Database connection (On-Prem) with MongoDB in a Microservice Environment]]></title>
            <link>https://utkuapaydin.medium.com/dynamic-database-connection-on-prem-with-mongodb-in-a-microservice-environment-6a3620863c64?source=rss-22a6b972ed2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a3620863c64</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[on-premise]]></category>
            <dc:creator><![CDATA[Utku Apaydin]]></dc:creator>
            <pubDate>Thu, 19 Nov 2020 17:09:19 GMT</pubDate>
            <atom:updated>2020-11-19T17:09:19.576Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JUJdxoOEOZsdWUA29ek9zw.jpeg" /></figure><p>If you are developing a SaaS application you probably trying to create a loosely coupled microservice architecture. Easy to adapt, easy to test, scalable, etc. Which requires one database for each service. This is good right? Since other services is not depending on other database everything is possible…</p><p>But what if one of your customer wants to use your service but maintain their data in their own servers, and other customers trusts you to protect your data.<br>Can we create a dynamic system using MongoDB for such requirements?</p><p>This was the case in one of my old company and here how I manage to achieve this.</p><p>Scenario: We have a SaaS application with multiple microservice. Only one microservice needs to be dynamically configured for CRUD tasks. Every tenant can choose where to save their data at the registration phase of the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hpfyjnvSJdwo3Ncy1utsMQ.png" /><figcaption>High Level design of the requirement</figcaption></figure><p>As you can see we need to handle the direction of incoming from Tenant 2 for Microservice 1. In the system, when I create a service to service request, any microservice passes the user information to another. So every service has access to the request owner’s tenant information. This will allow us to dynamically update any microservice MongoTemplate which allow us to configure request direction for collections in MongoDB.</p><p>To Achieve this we need to create our own MongoTemplate and write every request for related collection. It is a little bit work but in the end we will be able to redirect requests for that collection dynamically.</p><p>The following steps are the solution I created for this problem;</p><h4>Tracking Tenant Configuration</h4><p>Microservice 1 Should keep trach of the tenant configurations, I used a map (<strong>tenantMongoTemplateMap</strong>)to keep trach of the current tenant configuration on the memory, Map</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b793ef9c2544196bd1829eee1a295b07/href">https://medium.com/media/b793ef9c2544196bd1829eee1a295b07/href</a></iframe><p>As you can see I am mapping MongoTemplates for every Tenant (including normal tenants whom allows us to keep their data in our cloud). This code snipped shows how I managed to override the MongoTemplate for Car collection. The default URI is used if the tenant is not configured for on premise database.</p><p>Now we need to configure Spring for our custom MongoTemplate</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/897ebbbe82001e983291e50c992a918e/href">https://medium.com/media/897ebbbe82001e983291e50c992a918e/href</a></iframe><p>As you can see I am using <strong>default </strong>key for non-configured tenants.</p><h4>Handling Request and Updating Tenant Context</h4><p>Every request should be handled, and MongoTemplate should be updated. So we need to check every user’s tenant information. I am using the following TenantContext to keep track of the request’s target.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/063ac6e9f9ccb35121d5b61066b0e628/href">https://medium.com/media/063ac6e9f9ccb35121d5b61066b0e628/href</a></iframe><p>Since we are using ThreadLocal, we can use it in our Controller to update tenant information.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cdb0a1035be379fe7c952a296bac696b/href">https://medium.com/media/cdb0a1035be379fe7c952a296bac696b/href</a></iframe><p>After this we do not have to do anything else other than calling the related method from the service. Eventually, the request will end up at our CarRepositoryImpl.</p><h4>CarRepositoryImpl and CustomMongoTemplate</h4><p>Since we are using custom MongoTemplate, we can’t use repository interface every query should be created manually. As you can see below, I autowired the MongoTemplate to my repository implementation. Since my <strong>CarMongoTemplate </strong>is an extension of MongoTemplate and i configured the spring to create a bean from that everything just works!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8b9d2ff4d3190c9c5969b5beea9b950/href">https://medium.com/media/d8b9d2ff4d3190c9c5969b5beea9b950/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a3620863c64" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>