<?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 Taras Kohut on Medium]]></title>
        <description><![CDATA[Stories by Taras Kohut on Medium]]></description>
        <link>https://medium.com/@taraskohut?source=rss-a9bdde3bffd6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*k6kbpMvBJ7Om1KKV</url>
            <title>Stories by Taras Kohut on Medium</title>
            <link>https://medium.com/@taraskohut?source=rss-a9bdde3bffd6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 05:29:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@taraskohut/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[A Modern GitOps Guide for Multi-Team Organizations | Part 3: Full Automation]]></title>
            <link>https://taraskohut.medium.com/a-modern-gitops-guide-for-multi-team-organizations-part-3-full-automation-2009d7174137?source=rss-a9bdde3bffd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2009d7174137</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Taras Kohut]]></dc:creator>
            <pubDate>Mon, 16 Mar 2026 22:38:33 GMT</pubDate>
            <atom:updated>2026-03-16T22:38:33.599Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lAk1z4aMPB_l6qJJlxq73Q.png" /></figure><p><strong><em>The Roadmap:</em></strong></p><p>Part 1 — <a href="https://taraskohut.medium.com/a-modern-gitops-guide-for-multi-team-organizations-part-1-anti-patterns-d9e8f98403bc"><strong>Anti-Patterns</strong></a><br>Part 2 — <a href="https://medium.com/@taraskohut/a-modern-gitops-guide-for-multi-team-organizations-part-2-e53ee32306e3"><strong>The Foundation</strong></a><strong> </strong><br>Part 3 — <strong>Full Automation </strong>(you are here)</p><p>In Part 2, we built a deployment process that consists of only three steps: merge, tag, and promote. That’s a very clean foundation. But we can do even better.</p><p>There are still manual decisions in the workflow. The developer still chooses a version number, creates a tag, and creates a production merge request. Each of these is a small friction point. But even small frictions prevent true Continuous Delivery.</p><p>This post covers the final evolution: fully automated versioning, single-artifact promotion, and automated production merge requests. The goal is simple — every merge to main flows through to production with zero manual intervention except for code review and approval.</p><h3>Automating Versioning</h3><h4>The Problem With Manual Versions</h4><p>In the Part 2 workflow, the developer still had to choose a version number and create a git tag to trigger a release. This seems minor, but it has practical consequences.</p><p>It adds pipeline time. A tag triggers a separate build. That’s another CI run — minutes of pipeline time that exist only because of the manual versioning step, not because of any technical necessity.</p><p>And it also fragments artifacts. The artifact deployed to dev is built from the merge to main, while the staging artifact is built from the tag. The code is identical, but these are technically different artifacts, and there is always a small chance that things go wrong.</p><h4>Do You Actually Need Semantic Versioning?</h4><p>Semantic Versioning was designed to communicate compatibility to external consumers. If you publish a library and bump the major version, downstream users know they need to adapt. That communication channel has real value.</p><p>But for internal backend services that only your own platform talks to, it’s a bit different. Breaking changes in internal APIs are handled through API versioning, feature flags, and backward-compatible rollouts — not through the service’s version number.</p><p>For most internal services, the version number is metadata. It needs to be unique, sortable, and traceable. It does not need to carry semantic meaning.</p><h4>Choosing a Versioning Scheme</h4><p>Once you accept that the version is metadata rather than a communication tool, the design space opens up. Technically, it could be anything — an incrementing integer, a string, a timestamp. The only real requirements are uniqueness and sortability.</p><p>That said, if the version can carry useful information for free, that’s a bonus. A scheme worth considering is a SemVer-compatible calendar version:</p><p>YY.MM.PIPELINE_ID</p><p>For example: 26.03.48291</p><p>This tells you at a glance when the artifact was built (March 2026) and gives you a pipeline ID for traceability. It’s sortable, unique, and compatible with any tooling that expects SemVer format.</p><p>In practice, the specific scheme matters less than the principle: the version is generated by the pipeline, not chosen by a human. Whether you use CalVer, auto-incremented SemVer with conventional commits, or something else entirely, the key decision is to take humans out of the loop.</p><h4>The Implementation</h4><p>With automated versioning, the CI pipeline generates the version on every merge to main. The same version is applied consistently across all build artifacts:<br>The application build receives the version as a build parameter — reflected when calling the service’s version endpoint.<br>The Docker image is tagged with the same version.<br>The Helm chart is published with the same version.</p><p>This consistency is intentional. A single version across all artifacts simplifies troubleshooting.</p><p>Once the artifacts are published, Flux automatically deploys the new version to dev.</p><h3>Automated Promotion Between Environments</h3><p>In Part 2, Flux was configured to watch the Helm chart registry and automatically deploy the latest release version to staging. <br>That worked because release tags were created intentionally — a developer tagging a commit was an explicit signal that the artifact was ready for staging.</p><p>Now that every merge to main produces a versioned, release-tagged artifact, we need a different mechanism to promote it to staging.</p><p>This is where a promotion script comes in. The concept is straightforward: a script that takes a service name and a target environment, looks up the currently deployed version in the source environment, and updates the target environment’s version to match.</p><p>The key design decision is that the developer triggering the promotion doesn’t need to know the version. It is resolved automatically. For example, Promote service X from dev to staging— the job reads the current version from the dev config, updates the staging config, and commits the change. Flux picks up the change and deploys.</p><p>The promotion chain looks like this:</p><p><strong>Merge to main</strong> → auto-deployed to dev <br><strong>Promote </strong><strong>dev → </strong><strong>staging</strong> → triggered manually or automatically (depending on team preference) → auto-generates a merge request to the prod config repo.</p><p>The promotion script itself can be wrapped in whatever interface suits your organization. For example, it could be a Slack bot. The implementation is simple — a Python script that reads the current HelmRelease version from the source environment folder, updates the target environment&#39;s file, and commits the change back to the config repo.</p><h3>Extending the Pipeline: Integrations</h3><p>Once you have automated versioning and promotion, your pipeline knows exactly which version is being deployed, when, and where. That knowledge can feed other systems in your organization.</p><p>A practical example is issue tracker integration. When code is merged to main, a CI job can extract the ticket ID from the commit message (assuming your team follows a commit convention), create a fix version in the issue tracker matching the generated release version, and assign the ticket to that version with an “<strong>unreleased</strong>” status.</p><p>When Flux successfully deploys the new version to production, it sends a notification event. A listener job picks up that event and updates the ticket status to “<strong>released</strong>.”</p><p>The result: project managers and stakeholders can see exactly which tickets are included in which version, and whether that version has been deployed — without anyone manually updating anything. The deployment pipeline becomes the source of truth for release status.</p><h3>The Final Workflow</h3><p>Let’s look at the complete developer experience from start to finish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S1rsixX42m_N9W0TaSiHUg.png" /></figure><p><strong>Step 1: Merge to main</strong>. The developer merges their code, tests, and environment configuration changes. The pipeline builds the artifact, generates a version automatically, and publishes the Docker image + Helm chart. Flux deploys to dev. Jira is updated with the fix version and marks the ticket as “<strong>unreleased</strong>”.</p><p><strong>Step 2: Promote.</strong> When validated in dev, the developer (or an automated trigger) promotes to staging. Each promotion is a single action — no version to remember, no config to edit. The same artifact moves through environments.</p><p><strong>Step 3: Approve production.</strong> The promotion job auto-generates a merge request to the prod config repo. The team reviews and approves. Flux deploys to production. The ticket status is updated to “<strong>released</strong>.”</p><p><strong>Rollback</strong> follows the same mechanism as promotion. Because every environment’s version is a committed value in the config repo, reverting to a previous version is either a git revert of the last promotion commit or a manual edit of the version field back to the previous value. There’s no special rollback tooling — the audit trail is the git history.</p><p>From the developer’s perspective, the only real work is writing code and getting it reviewed. Everything after the merge is automated or a single-click action.</p><p>And looking further ahead, once your team builds confidence in the automated pipeline and your test coverage justifies it, the production approval step itself can be automated. At that point, the process becomes true <strong>Continuous Deployment</strong>: every merge to main flows all the way to production without any human intervention. The three-step workflow becomes a one-step workflow. Merge your code, and the system handles the rest.</p><h3>Measuring the Impact</h3><p>Claiming your new process is better isn’t enough. Here are the metrics that actually prove it</p><p><strong>Release frequency.</strong> How often does each team deploy to production? If your framework is working, this number should increase significantly. More frequent releases mean smaller changesets, faster feedback, and lower risk.</p><p><strong>Lead time for changes.</strong> How long from “code merged” to “running in production”? With the automated pipeline, this should drop from days (or weeks, in manual-heavy processes) to hours.</p><p><strong>Failed deployment rate.</strong> Manual processes introduce human error. Automation doesn’t forget steps. Track how often deployments fail or require rollback, and compare before and after.</p><p><strong>Onboarding time.</strong> How quickly can a new developer deploy confidently? This is the litmus test from Part 1. If the answer changes from “a few weeks with guidance” to “their first day,” the framework is doing its job.</p><p>Pro tip: You may clap 👏 up to 50 times for a story that connected with you 😉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2009d7174137" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Modern GitOps Guide for Multi-Team Organizations | Part 2: The Foundation]]></title>
            <link>https://taraskohut.medium.com/a-modern-gitops-guide-for-multi-team-organizations-part-2-e53ee32306e3?source=rss-a9bdde3bffd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e53ee32306e3</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[continuous-delivery]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Taras Kohut]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 18:11:46 GMT</pubDate>
            <atom:updated>2026-03-16T22:39:28.376Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sCiFB7leOC57EmPvoj-gUw.png" /></figure><p><strong><em>The Roadmap:</em></strong></p><p>Part 1 — <a href="https://taraskohut.medium.com/a-modern-gitops-guide-for-multi-team-organizations-part-1-anti-patterns-d9e8f98403bc"><strong>Anti-Patterns</strong> </a><br>Part 2 — <strong>The Foundation</strong> (you are here) <br>Part 3 — <a href="https://medium.com/@taraskohut/a-modern-gitops-guide-for-multi-team-organizations-part-3-full-automation-2009d7174137"><strong>Full Automation</strong></a></p><p>In Part 1, we identified anti-patterns that break deployment processes in multi-team organizations. Now let’s build something better.</p><p>This post covers the design principles, the architecture, and the resulting developer experience. By the end, you’ll have a blueprint for a deployment process that takes a feature from merge to production in three simple steps.</p><h3>Defining the Requirements</h3><p>Before choosing any tools or drawing any architecture diagrams, it helps to define a high-level vision of the process we would like to build. These are the principles that should guide every decision.</p><p><strong>Minimize developer touchpoints.</strong> Every manual step in a release process is a context switch. Context switches cost time and introduce errors. The ideal deployment process is one where the developer’s job ends when the code is merged. Everything after that should be automated.</p><p><strong>Enable independent releases.</strong> As covered in Part 1, coupling teams through a shared deployment lifecycle defeats the entire purpose of microservices. Each team should be able to release on their own schedule, at their own pace, without being blocked by anyone else.</p><p><strong>Make configuration visible and diffable.</strong> Engineers should be able to answer “what’s different between dev and prod?” easily. If answering that question requires diffing across branches, switching between repositories, or asking a DevOps engineer, the architecture is working against you.</p><p><strong>Prefer platform complexity over developer friction.</strong> When choosing between two approaches, prefer the one that pushes complexity to the infrastructure side — even if it’s harder to set up. Platform complexity is a one-time cost maintained by a small team. Developer friction is a recurring cost multiplied by every engineer, on every release, forever.</p><h3>The Architecture</h3><p>With those principles in mind, here are the key structural decisions.</p><p><strong>Environment configuration lives in the service repository.</strong></p><p>This is a fundamental shift from the centralized model. Instead of storing environment configuration in a separate shared repository (where it becomes someone else’s problem and no one’s responsibility), it lives right next to the application code.</p><p><strong>Why this matters: </strong>When a developer adds a new environment variable or changes a resource limit, they update the config files in the same merge request as the code change. The configuration change is reviewed alongside the code by the same people who understand the context. There’s no second MR to a different repo, no “I’ll update the config later” that gets forgotten. The framework itself helps developers to think about environment configuration as part of their normal workflow.</p><p><strong>Deployment configuration with folder-based separation.</strong></p><p>Instead of branch-based environment separation, the new structure uses folders.</p><p><strong>Application repository</strong> — the service repo contains a helm/ folder with the chart definition, and a separate values file per environment: values-dev.yaml, values-staging.yaml, values-prod.yaml. These files hold only what actually differs per environment — replica counts, resource limits, and ingress hostnames. The defaults live in the chart&#39;s base values.yaml. A developer adding a new environment variable updates the relevant values files in the same MR as the code change.</p><p><strong>Config repositories</strong> — there are two: one for non-prod environments, one for production (access control is the reason for the split). Within each, the structure is flat and predictable, for example:</p><pre>dev/<br>  service-a/<br>    helmrelease.yaml<br>  service-b/<br>    helmrelease.yaml<br>staging/<br>  service-a/<br>    helmrelease.yaml</pre><p>Each helmrelease.yaml is a Flux HelmRelease manifest pointing to a specific chart version and using values file for a specific env. Each app also requires image automation to be configured, so Flux automatically updates the version.</p><p><strong>Why folders instead of branches?</strong> This directly addresses Anti-Pattern 1 from Part 1. With folders, you can open dev and staging directories side by side and instantly see what’s different. And now that env-specific configuration is part of the deployed artifact itself, promotion is usually just a version bump.</p><h3>The Developer Experience</h3><p>Here’s what the actual workflow looks like for a developer releasing a feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qdb4y2M8MOjyV04iRd5AdA.png" /></figure><p><strong>Step 1: Merge to main.</strong></p><p>The developer creates a merge request with their code changes, tests, and any configuration updates for all environments. Everything is in one MR, in one repo. When the MR is merged, the CI pipeline builds the artifact, publishes the Docker image, and Helm chart. Flux detects the new version and automatically deploys it to dev.</p><p>The developer’s feature is now running in dev. No manual redeployment. No switching to another repo to bump a version.</p><p><strong>Step 2: Tag a release.</strong></p><p>When the feature is validated in dev and ready for staging, the developer tags the commit with a release version (e.g., 1.2.0). Flux detects the new version and deploys it automatically.</p><p>The service is now running in staging with a versioned release.</p><p>This step still has room for improvement. The version tag is a manual decision — the developer has to choose the number and create the tag. We’ll automate this entirely in Part 3. There’s also a subtle concern worth noting: the artifact deployed to dev was built from the merge to main, while the artifact deployed to staging is built from the tag. Part 3 addresses this as well by ensuring a single artifact is built once and promoted across environments.</p><p><strong>Step 3: Merge to production.</strong></p><p>When the feature is validated in staging, the developer creates a merge request to the prod config repo, bumping the service version in the production HelmRelease file. This MR goes through the standard production review and approval process. When merged, Flux deploys the new version to production.</p><p>That’s it. Three steps. Merge, tag, promote to prod.</p><h3>Why This Works</h3><p><strong>Developer experience comes first.</strong> The developer works in their own repo for 90% of the process. Config changes are part of the normal code review. The only time they touch a different repo is for the production promotion, which is a single version bump in a single file.</p><p><strong>Minimal manual steps.</strong> The developer interacts with their own service repo and, for production, one config repo. There are no shared chart repos to update, no branches to promote between, and no pipelines to trigger manually.</p><p><strong>Independent releases.</strong> Because each service has its own Helm chart and its own HelmRelease files in the config repos, teams release independently. Team A’s deployment has zero impact on Team B. No shared umbrella chart, no release trains, no coordination meetings.</p><p><strong>Configuration is visible.</strong> Want to know what version is running in staging? Open the staging folder in the non-prod config repo. Want to compare dev and prod configs for your service? Open the two values files side by side in your service repo. No branch switching required.</p><h3>What This Enables</h3><p>With a clean, automated base process, you unlock possibilities that are impossible with a manual-first approach.</p><p>If deploying is cheap, developers deploy more often. Smaller deployments mean smaller diffs, easier debugging, and lower risk. The feedback loop tightens. Features reach users faster. And now you are ready to adopt Continuous Delivery.</p><p>But we’re not done. There are still manual decisions in this workflow: choosing a version number, creating a tag, writing the production MR. Each of these is a small friction point, and small frictions add up. In Part 3, we’ll eliminate them all. As a result, the final release process will have a fully automated versioning and automated promotion between environments, so every merge to main flows through to production with zero manual intervention.</p><p><em>Next up: Part 3 — </em><a href="https://medium.com/@taraskohut/a-modern-gitops-guide-for-multi-team-organizations-part-3-full-automation-2009d7174137"><em>Full Automation</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e53ee32306e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Modern GitOps Guide for Multi-Team Organizations | Part 1: Anti-Patterns]]></title>
            <link>https://taraskohut.medium.com/a-modern-gitops-guide-for-multi-team-organizations-part-1-anti-patterns-d9e8f98403bc?source=rss-a9bdde3bffd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9e8f98403bc</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[continuous-delivery]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[gitops]]></category>
            <dc:creator><![CDATA[Taras Kohut]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 23:17:19 GMT</pubDate>
            <atom:updated>2026-03-21T10:49:57.353Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pSs4f0qokX47Q5AGrreyTg.png" /></figure><p><strong><em>The Roadmap:</em></strong></p><p>Part 1 — <strong>Anti-Patterns</strong> (you are here) <br>Part 2 — <a href="https://medium.com/@taraskohut/a-modern-gitops-guide-for-multi-team-organizations-part-2-e53ee32306e3"><strong>The Foundation</strong></a><strong> </strong><br>Part 3 — <a href="https://medium.com/@taraskohut/a-modern-gitops-guide-for-multi-team-organizations-part-3-full-automation-2009d7174137"><strong>Full Automation</strong></a></p><p>If you’re a backend or platform engineer who would like to <strong>improve the way your organization deploys software</strong>, this series is for you. Everything here comes from real experience building deployment processes across multiple teams.</p><h3>How Deployment Friction Kills Engineering Velocity</h3><p>I’ve seen well-architected deployment frameworks fail adoption not because of technical flaws, but because the team that designed them never asked a simple question: <em>what does the developer’s day actually look like</em>?</p><p><strong>Release frequency is a function of release friction.</strong> If deploying a service takes 30 minutes of manual work across multiple repos, developers will batch changes into large, infrequent releases. Large releases are riskier, harder to debug, and more stressful. The deployment framework just created the exact problem it was supposed to solve.</p><p><strong>Manual steps are error-prone.</strong> If a developer needs to remember which branch to update in which repo, in which order, and which pipeline to trigger, they will make mistakes.</p><p><strong>Onboarding reveals everything.</strong> If a new developer can’t deploy confidently within their first week, the process is too complex. When you need a complicated manual and a senior engineer walking someone through their first release, the framework has failed at its primary job.</p><p>This post covers the most common anti-patterns I’ve encountered. If your deployment process suffers from any of these, the rest of the series will show you how to fix them.</p><h3>Anti-Pattern 1: Using Branches to Separate Environments</h3><p>This is probably the most widespread mistake in Kubernetes deployment setups. The idea is straightforward: your dev branch holds dev configuration, your staging branch holds pre-production, and main represents production. Clean and intuitive.</p><p><strong>Why teams do it:</strong> It mimics the traditional software development lifecycle. Developers are already used to “promoting” code through branches, so it feels natural to apply that same mental model to infrastructure and configuration.</p><p><strong>Why it fails:</strong></p><p><strong>Branches are for temporary divergence, not permanent difference.</strong> Git branches are designed to be merged eventually. However, environments are <em>permanently</em> different. Your dev environment might have 1 replica and a NodePort, while prod has 10 replicas, an Ingress, and different resource limits. Because these differences are permanent, you can never truly merge one branch into another without overwriting the very configurations that make that environment unique.</p><p>You lose visibility. With folder-based separation, you can open two files side by side and instantly see how environments differ. With branches, you need to diff across branches, which most developers won’t do routinely. Configuration drift becomes invisible until something breaks.</p><p>Promotion becomes manual and error-prone. You cannot promote a configuration change from dev to staging via a merge or cherry-pick because the files themselves are structurally different. If you merge staging into prod, you risk dragging along staging-specific endpoints, lower security constraints, or test credentials.</p><p><strong>What to do instead:</strong> Use a folder structure within a single branch. One folder per environment. All configuration is visible in one place, diffs are trivial, and promotion is a straightforward copy-and-modify operation. We’ll cover this architecture in detail in Part 2.</p><h3>Anti-Pattern 2: Coupled Deployment</h3><p>In an effort to centralize management, many organizations fall into the trap of coupling independent services into a single deployment lifecycle. An example of this mistake might be the <strong>Shared Umbrella Chart</strong>.</p><p>An Umbrella Chart bundles multiple sub-charts (microservices) into one parent Helm chart. Used purely for templating or standards enforcement — where teams still own their own deployment lifecycle — this is a legitimate pattern. The anti-pattern is using the umbrella chart as the <em>primary deployment unit</em> for an entire platform, where every team’s release flows through the same chart.</p><p><strong>Why teams do it:</strong> Centralization feels clean. One repo, one deployment pipeline, one source of truth. It also makes it easier for a platform or DevOps team to manage and enforce standards.</p><p><strong>Why it fails:</strong></p><p><strong>Teams become coupled</strong>. If Team A pushes a broken chart change, Team B can’t deploy. I’ve seen this happen repeatedly — a message appears in the shared dev channel: <em>“Our pipeline is failing because of a Helm chart issue with component X. Can someone take a look and unblock us?”</em> Your code is tested, your feature is ready, but you’re blocked by someone else’s config mistake in a shared repo.</p><p><strong>Release independence disappears</strong>. The whole point of microservices is independent deployability. Bundling services reintroduces the coupling that microservices were supposed to eliminate. You can’t release your service without coordinating with every other team that shares the repo.</p><p><strong>Ownership is unclear</strong>. When charts and values live in a shared repo, who’s responsible for what? “Someone” merges the release branch. “Someone” creates the production MR. When a process depends on undefined ownership at critical steps, things fall through the cracks.<br>Also, as the number of services grows, the complexity of the shared config files explodes. What started as a simple bundle becomes a massive, brittle configuration object that is terrifying to modify.</p><p><strong>What to do instead:</strong> The goal is <strong>independent deployability</strong>. Each service should have its own deployment lifecycle.</p><h3>Anti-Pattern 3: Manual Version Management</h3><p>If your release process requires developers to manually edit a version in pom.xml, bump a Helm chart version, then tag a release by hand, you have a manual versioning problem. This is a subtle but persistent tax on your engineering velocity.</p><p><strong>Why teams do it:</strong> When releases are infrequent, spending five minutes to manually increment a version feels like a negligible cost. Because the pain is infrequent, it remains invisible. The problem only surfaces when the organization tries to scale or move toward Continuous Delivery.</p><p><strong>Why it fails:</strong></p><ul><li><strong>The &quot;Speed Limiter&quot; Effect:</strong> Manual versioning is the enemy of Continuous Deployment. If every merge requires a human to pause and decide on a number, you can never achieve a truly automated path to production.</li><li><strong>Artifact Overwriting:</strong> Humans make mistakes. Let’s imagine the following scenario: <br>A developer updates a Helm chart’s configuration but forgets to bump the version number in Chart.yaml.<br>The CI pipeline runs and pushes a new package to your registry using the <em>same version tag</em> (e.g., v1.0.5). Meanwhile, production also uses v1.0.5. <br>When the production cluster scales up or restarts, it pulls updated v1.0.5 and suddenly receives untested configuration changes.</li><li><strong>Semantic Versioning Overhead:</strong> SemVer was designed to communicate “breaking changes” to external consumers. But for an internal API that only <em>your</em> other services talk to, this provides almost no actionable information. Breaking changes in backend services are handled in a completely different way.</li></ul><p><strong>What to do instead:</strong> Automate versioning entirely. Let the machine handle the “what number is next” so the developer can focus entirely on “what feature is next.”</p><h3>The Cumulative Effect</h3><p>Put these three patterns together, and you get something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bkzQyLq-CP5hIzgYhKMrcg.png" /></figure><p>If your environments are separate branches <em>and</em> you’re manually editing versions, promoting a change becomes a multi-step ritual of cherry-picking, editing a file, and tagging.</p><p>Because everyone is coupled in one chart, you can’t automate a version bump without risking a break for five other teams. This fear leads to <em>“Release Trains”</em>, killing the dream of independent microservices.</p><p>Eventually, the team naturally starts releasing <em>less often</em> to avoid the pain. Releases become “events” that require coordination meetings. Larger, riskier deployments inevitably break more things, reinforcing the (false) belief that you need <em>more</em> manual oversight.</p><h3>What Comes Next</h3><p>Now that we’ve identified what doesn’t work and why, the next step is to define what a good deployment process should actually look like. In Part 2, I’ll walk through the requirements and design principles that should guide your architecture.</p><p><em>Next up: Part 2 — </em><a href="https://taraskohut.medium.com/a-modern-gitops-guide-for-multi-team-organizations-part-2-e53ee32306e3"><em>The Foundation</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9e8f98403bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Unexpected Things I Discovered as a Backend Developer Trying Indie Game Development]]></title>
            <link>https://taraskohut.medium.com/5-unexpected-things-i-discovered-as-a-backend-developer-trying-indie-game-development-23c04b7d91bc?source=rss-a9bdde3bffd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/23c04b7d91bc</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[lessons-learned]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Taras Kohut]]></dc:creator>
            <pubDate>Sun, 21 Sep 2025 14:28:55 GMT</pubDate>
            <atom:updated>2025-10-09T19:01:51.811Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-lGEGjH6TwRKjDVgemTSVw.png" /></figure><p>I’ve spent over a decade building backend systems that are clean, scalable, and maintainable. A while ago, I decided to try game development as an indie developer. Creating a small game seemed like the perfect opportunity to own the entire product while facing fresh technical challenges that would reignite my passion for learning. I knew that a few areas would be completely new to me, like game art, level design, and audio creation. Programming was supposed to be the easy part — it’s what I do every day. Except game code doesn’t work like backend code, and that difference hit me harder than expected. Here are the top five things that surprised me most.</p><h3>1. You Don’t Need Dependency Injection Framework</h3><p>This might be controversial, especially considering <a href="https://taraskohut.medium.com/vert-x-micronaut-do-we-need-dependency-injection-in-the-microservices-world-84e43b3b228e">my previous article about DI</a>, but let me explain. Most backend development approaches heavily rely on dependency injection frameworks. They help us test, scale, and manage complexity because typical backend projects are large, complicated, and maintained by multiple people. But most indie projects don’t need DI — in fact, it often slows you down. Service locator pattern or scriptable objects in Unity work better. Looking back, the time I spent learning, tuning, and maintaining <a href="https://github.com/modesttree/Zenject">Zenject</a> (a DI Framework for Unity) wasn’t worth it. When I started my next game, the answer to “Should I use DI again?” came immediately: no. Sometimes the best tool is the one that gets out of your way, and in solo game development, simplicity often beats architectural elegance.</p><h3>2. Developers Tend to Underestimate. Game Developers Underestimate Way Beyond That.</h3><p>It is a well-known fact that developers habitually underestimate the work required to implement software. But game devs underestimate ten times worse. I thought I could build <a href="https://medium.com/@taraskohut/star-point-game-you-need-some-space-media-kit-63c22cc4e28f">my minimalist game “Star Point”</a> in a few months. A year later, I was still debugging edge cases and adding levels. Games are inherently unpredictable. Players react in ways you can’t foresee, and small tweaks can break the balance. A simple change like increasing player speed by 10% might affect all the levels. Backend systems rarely face this kind of complexity. Also, most developers severely underestimate the marketing effort required to build an audience for their game. Marketing isn’t something you start when development wraps up — it needs to begin on day one and become part of your development routine. The following section explores the critical importance of game marketing in greater detail.</p><h3>3. Making a Game Isn’t Hard. Making a Good Game Is Hell.</h3><p>Anyone can prototype a basic game in a weekend using Unity or Godot. But creating a polished, fun, and balanced experience is brutally hard. Then comes the toughest part: promotion. Even excellent games disappear without marketing. On Steam alone, over 18,000 new games launched in 2024. Competition on mobile is even higher — over 74,000 new games were released in the same year. With thousands of new games hitting Steam and mobile platforms, you need a strategy to make sure your game doesn’t get lost in the crowd. The statistics paint a sobering picture of just how brutal this competition really is. According to recent analysis, only around 0.5% of indie games released in 2024 can even begin to be financially viable, while research shows that only 2.44% of games reached the 1,000 review benchmark typically considered successful. On Steam specifically, 75% of the games released in 2024 have fewer than 50 reviews, suggesting they never managed to break through the platform’s information noise.</p><h3>4. Micro-Optimizations Are Not Micro Anymore</h3><p>On the backend, the common bottlenecks are database queries, network latency, disk I/O, and inefficient algorithms. Tuning variable types or changing the way you iterate over objects makes virtually no difference in performance, and can feel absurd. Game development flips this mindset. Especially if we are talking about mobile games. Small inefficiencies that seem irrelevant in the backend can destroy the player experience. Now you have to remember that the code you write runs 60 times per second. You would never expect that <a href="https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/types/boxing-and-unboxing">boxing and unboxing variables</a> should be avoided, because even this is expensive and creates additional garbage. Would you ever use <em>list.Clear();</em> instead of re-creating it with <em>list = new List&lt;&gt;(); </em>to avoid garbage generation? Even a tiny amount of garbage that is created in the method might trigger a garbage collector more often, and this will be noticeable. A 10 ms input delay makes controls feel sluggish. Small tweaks — memory pre-allocation, object pooling, avoiding foreach loops — matter a lot, especially if the game runs on a slow device. It’s not about premature optimization; you should still use a profiler to identify what slows the game down. It’s just about the fact that game developers worry about things that a backend developer would never think of.</p><h3>5. Code Quality Is Overrated</h3><p>Another controversial take. I tried to write really good code and even did a big refactoring in the middle of development. It was fun, but considering the size of the codebase and no signs that it would grow significantly, it wasn’t very meaningful. In solo indie development, code quality takes a backseat. You’ll rewrite mechanics multiple times anyway. What matters is iteration speed. The irony is that perfect code doesn’t make perfect games — sometimes the messy prototype that lets you test five ideas in a day is worth more than the elegant system that takes weeks to implement. The faster you test an idea, the sooner you know if it’s fun. Of course, you need balance — truly bad code will slow you down. You have to know the rules before you can break them.</p><h3>Conclusion</h3><p>Despite all the challenges I’ve outlined, game development is absolutely worth trying. It’s one of the few fields where you can combine technical skills with storytelling, art, and human psychology. Backend development teaches you to think in terms of scale, maintainability, and long-term reliability. Every design decision looks ahead to years of maintenance and dozens of engineers touching the code. Game development, especially solo, forces you to rethink priorities. What really matters here is how quickly you can test a mechanic, how smooth the player experience is, and how much your investment in quality will pay off later.</p><p>Pro tip: You may clap 👏 up to 50 times for a story that connected with you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23c04b7d91bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Star Point game — you need some space! (Media kit)]]></title>
            <link>https://taraskohut.medium.com/star-point-game-you-need-some-space-media-kit-63c22cc4e28f?source=rss-a9bdde3bffd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/63c22cc4e28f</guid>
            <category><![CDATA[games]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[game-design]]></category>
            <category><![CDATA[mobile-gaming]]></category>
            <category><![CDATA[mobile-games]]></category>
            <dc:creator><![CDATA[Taras Kohut]]></dc:creator>
            <pubDate>Tue, 01 Jun 2021 20:15:35 GMT</pubDate>
            <atom:updated>2022-06-04T15:03:20.786Z</atom:updated>
            <content:encoded><![CDATA[<h3>Star Point game — you need some space!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6juDcN4qUNoz1pcZofPOlQ.png" /></figure><p>Star Point is a minimalist game with original mechanics and a beautiful design. Ride a planet to discover new colorful places in space full of constellations. Reach the finish quickly without falling out of constellations, and collect as many stars as possible! Master simple two-action controls <br>and get bonuses for collecting all the stars on a level, including the ones that are tricky to reach!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Io0_r8oOHS-A6vxeEjyhNw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fd1CK4YUr3XpHgPSC1YgVQ.png" /></figure><h3>Factsheet:</h3><p><strong>Release date:</strong> May 2021</p><p><strong>Platforms:</strong></p><ul><li>Android:<br><a href="https://play.google.com/store/apps/details?id=com.lazygraypixel.starpoint"><strong>https://play.google.com/store/apps/details?id=com.lazygraypixel.starpoint</strong></a></li><li>iOS:<br><a href="https://apps.apple.com/app/star-point-explorer/id1564601081"><strong>https://apps.apple.com/app/star-point-explorer/id1564601081</strong></a></li><li>Web(demo), PC, Mac:<br><a href="https://lazy-gray-pixel.itch.io/star-point"><strong>https://lazy-gray-pixel.itch.io/star-point</strong></a></li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FwbklLYqM1Kw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DwbklLYqM1Kw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FwbklLYqM1Kw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c146bc11e38efa9442bf1a939fb26005/href">https://medium.com/media/c146bc11e38efa9442bf1a939fb26005/href</a></iframe><h3>Features</h3><ul><li>Colorful space theme</li><li>Beautiful minimalist design</li><li>Relaxing gameplay</li><li>45 hand-crafted levels</li><li>12 awesome planets to choose</li><li>Available on an Android/IOS and PC/Mac</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ICGHIDye62MKY0mEqVtJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2qZHE94U1o-C4jiZLoZyrw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WtCXL0Kx9wyYYP5AUE7Xvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zpkz9ppvYwcC9Dm1oUVBAA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IjSnVAMj9kqRWQ874c_iJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_BLBYEk9mWIlpUbs-dYsig.png" /></figure><h3>Who made Star Point?</h3><p>We are a two-person micro-team from Lviv, Ukraine, consisting of a Software Developer and a Graphic Designer.</p><p>We love space, because of its beauty, of constellations, stars, moons, planets, and nebulas. And we believe that a lot of people love space as much as we do. <br>So it was not hard to come up with the game idea — a colorful minimalist game with a beautiful space theme that is relaxing and fun to play. We started by targeting mobile devices, but then extended the list of supported platforms with standalone ones, as it appeared that it is very pleasant to play the game on a big screen as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*drShxVGXt_JkvS928Dbqlg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fd1CK4YUr3XpHgPSC1YgVQ.png" /></figure><h3>Contact:</h3><ul><li><a href="https://www.facebook.com/StarPointGame/"><strong>https://www.facebook.com/StarPointGame/</strong></a></li><li><a href="https://twitter.com/LazyGrayPixel"><strong>https://twitter.com/LazyGrayPixel</strong></a></li><li><a href="https://www.instagram.com/lazygraypixel/"><strong>https://www.instagram.com/lazygraypixel/</strong></a></li></ul><h3>Press kit media files:</h3><p><a href="https://drive.google.com/drive/folders/1pOh5GZ19WIWysn1HD9qAbD8dko3ghqot?usp=sharing">https://drive.google.com/drive/folders/1pOh5GZ19WIWysn1HD9qAbD8dko3ghqot?usp=sharing</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63c22cc4e28f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vert.x + Micronaut — Do We Need Dependency Injection in the Microservices World?]]></title>
            <link>https://taraskohut.medium.com/vert-x-micronaut-do-we-need-dependency-injection-in-the-microservices-world-84e43b3b228e?source=rss-a9bdde3bffd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/84e43b3b228e</guid>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Taras Kohut]]></dc:creator>
            <pubDate>Wed, 12 Feb 2020 21:48:06 GMT</pubDate>
            <atom:updated>2025-10-09T19:02:42.511Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vert.x + Micronaut — Do We Need Dependency Injection in the Microservices World?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WzarFwxmk6eiyMyxTbEJSQ.png" /></figure><h3>Why even bother?</h3><p>In the Spring world, DI is given as a default option. That’s why for most developers a question about using DI may sound a little bit weird.</p><p>It becomes more reasonable when the conversation is about microservices. As we usually want to have them small and ready for quick start-up, we could decide not to introduce additional overhead. Furthermore, some frameworks don’t force a developer to use any specific components and let to choose what is needed instead.</p><p>A good example is Vert.x — extremely fast and small non-blocking framework that is broken down to components in a way similar to Spring, but without DI in the core. It looks like a good candidate for high loaded microservices.</p><p>There are several options on how to introduce DI to a Vert.x based project, but doing this just because it feels right is not a good idea. Dependency Injection is a tool, and every tool is used to solve some problems. Let’s identify the usual problems that the Vert.x project without DI has, and see if introducing one does solve them.</p><p><em>Most of the examples and conclusions could be used for any other microservice project with different frameworks/languages.</em></p><h3>DI pros and cons in general</h3><p>Before we get started, let’s summarize the good and bad sides of the tool we are going to use</p><h4>Advantages</h4><ul><li>Code is clean, more readable/maintainable/reusable</li><li>Easier unit testing</li><li>Easier implementation switching</li><li>Following good design principles (SRP, Loose Coupling, Dependency Inversion)</li></ul><h4>Disadvantages</h4><ul><li>Could increase the number of classes</li><li>Could affect startup performance</li><li>Could be an overhead for small projects</li><li>Code is coupled to the Dependency Injection Framework</li></ul><h3>Demo Project</h3><p>Let’s create a small application to see the real example.</p><p>The following Vert.x project can store customers in DB and return them using an HTTP endpoint. The first scheduler is constantly adding a new customer to DB, while the second one is sending them a notification message.</p><p>There are 3 verticles:</p><ol><li><strong>HttpServerVerticle</strong> — listens port 8080 and returns a JSON with customers</li><li><strong>CustomerProducerVerticle</strong> — adds a new customer every 5 seconds</li><li><strong>CustomerNotificationVerticle</strong> — sends a notification to each customer every 10 seconds</li></ol><p><strong>CustomerService</strong> is responsible for getting/adding customers, and it uses <strong>CustomerRepository</strong> which talks to DB.</p><p><strong><em>Full source code is available here:</em></strong> <a href="https://github.com/tarasrng/customers-notification/tree/without-di"><strong><em>without DI</em></strong></a><strong><em>, </em></strong><a href="https://github.com/tarasrng/customers-notification/tree/master"><strong><em>with DI</em></strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lw9RaszFmG30VZTlLhttYg.jpeg" /></figure><h3>What problems DI can solve for the project?</h3><p>When the application is small, DI is seen as not needed. But then the codebase grows, and it leads to problems that are not easy to refactor, so it’s better to think about it early.</p><p><strong>Some of the typical code smells that usually can be spotted when there is no DI:</strong></p><ul><li>Overuse of singletons with global state</li><li>Instantiating dependencies that are not logical part of the dependent class itself so they should be passed from outside instead</li><li>A lot of boilerplate code to pass some heavy objects during dependency creation, bloated method/constructor parameters list</li><li>[Vertx] Sharing stateful singleton objects (like connection pool) between different verticles — although the only way for inner-verticle communication that is emphasized in documentation is event bus (or service proxies, which are just wrappers over event bus)</li><li>The code is harder to test and reuse</li></ul><h4>Direct dependency instantiation</h4><p>Instantiating dependencies by the class itself is the violation of the first SOLID principle. If in the future dependency will be changed — dependent classes should be reworked.</p><pre>public class CustomerProducerVerticle extends AbstractVerticle {</pre><pre><strong>CustomerService customerService = new CustomerService();</strong></pre><p>With this approach, unit testing is harder — it’s not easy to mock private members.</p><pre>public class CustomerService {</pre><pre><strong>private CustomerRepository customerRepository = new CustomerRepository();</strong></pre><p>The following example demonstrates that <strong>CustomerNotifier</strong> uses hard-coded <strong>EmailNotifier</strong> implementation. It means that we can’t flexible switch to <strong>SMSNotifier</strong> implementation if needed.</p><pre>public class CustomerNotificationVerticle extends AbstractVerticle {</pre><pre><strong>private CustomerNotifier notifier = new EmailNotifier();</strong></pre><h4>Getting singleton dependencies from the static method</h4><p>A code that uses static methods is hard to test. But we know the solution, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*HY2BXzFaiREjSuJJ6VZIeg.jpeg" /></figure><p>Actually, in Vert.x it’s hard to test this code even with PowerMock because of the conflicts between Vert.x and the current Junit5 version.</p><pre><strong>MySQLPool pool = PoolManager.<em>getPool</em>();</strong></pre><pre>vertx.setPeriodic(5000, id -&gt; pool.getConnection(conn -&gt; addCustomer(conn.result())));</pre><p>Going further, verticle should isolate its state and behavior to provide a thread-safe environment. The only way to communicate with it is through an event bus.</p><p>Sharing the same pool between verticles could cause unexpected behavior. Instead, every verticle should have its small pool that is a singleton for its scope.</p><h4>Getting dependencies from outside requires some boilerplate code</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Bq20u0Xwn6nf9NwlMjNxw.jpeg" /></figure><p>Trying to remove creational logic and pass dependencies through constructors or methods is a good idea, but it requires a lot of boilerplate code that will create dependency tree. This could increase the methods parameter list and affect readability.</p><p>E.g. connection object is created in HttpServerVerticle and passed to the service:</p><pre><strong>pool.getConnection</strong>(res -&gt; {</pre><pre>if (res.succeeded()) {<br>customerService.getCustomers(0, 0, <strong>res.result()</strong>)</pre><p>Then service passes it to the repository:</p><pre>public class CustomerService {</pre><pre>public Future&lt;List&lt;Customer&gt;&gt; getCustomers(int offset, int limit, <strong>SqlConnection connection</strong>) {</pre><pre>return customerRepository.getCustomers(offset, limit, <strong>connection</strong>);}</pre><p>And finally, the repository uses it:</p><pre>public class CustomerRepository {</pre><pre>public Future&lt;List&lt;Customer&gt;&gt; getCustomers(int offset, int limit, <strong>SqlConnection connection</strong>) {</pre><h3>DI options available</h3><ul><li><strong>Weld</strong> — oriented for Enterprise level application, providing a lot of features that are not needed for microservices.</li><li><strong>Spring </strong>— based on reflection, so affects startup time/memory.</li><li><strong>Google Guice</strong> — lightweight dependency injection framework. Uses reflection at runtime — affects startup time/memory.</li><li><strong>Dagger2</strong> — Lightweight(&lt;100kb), fast compile-time DI. Based on JSR-330. Designed primarily with Android in mind, but can be used for any Java project as well. It looks overcomplicated in the beginning.</li><li><strong>Micronaut DI </strong>— Inspired by Dagger, fast compile-time DI. Based on JSR-330. Implemented by developers formerly from Spring project.</li></ul><h4>Micronaut</h4><p>Before we will see why Micronaut DI looks like the winner here, let’s take a look at the framework itself.</p><ul><li>Developed by Grails team</li><li>JVM based — <strong>Java/Groovy/Kotlin</strong></li><li>Supports reactive and non-blocking apps</li><li>Fast startup time — low memory consumption</li><li>Smallest Micronaut Hello World JAR is <strong>12 MB</strong> (14MB in Groovy)</li><li>Can be run with <strong>10MB</strong> Max Heap (20MB for Groovy)</li><li>Startup time sub-second. <strong>20ms</strong> and <strong>18MB</strong> memory consumption on GraalVM!</li><li>Killer feature — <strong>all Dependency Injection, AOP and Proxy generation happens at compile time</strong></li></ul><h4>Micronaut DI</h4><p>Micronaut is a pretty new framework, that was created for microservices, taking into consideration all the disadvantages of existing solutions. That&#39;s why it fits best for our case. And Micronaut DI is completely independent of the framework itself.</p><p>Let’s summarize the cool features of this tool:</p><ul><li>Uses compile-time data to implement dependency injection — reduced application startup time and memory consumption that are not bound to the size of the codebase.</li><li>JSR-330</li><li>Java/Groovy/Kotlin, Maven/Gradle plugins</li><li>Easy to use</li></ul><h4>Integration with Micronaut Inject</h4><p>So now we have a simple Vert.x project. Let’s add some Micronaut to it.</p><p>We need to add a dependency and plugin for annotation processing:</p><pre>&lt;dependency&gt;<br>  &lt;groupId&gt;io.micronaut&lt;/groupId&gt;<br>  &lt;artifactId&gt;micronaut-inject&lt;/artifactId&gt;<br>  &lt;version&gt;${micronaut.version}&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;plugin&gt;<br>  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;<br>  &lt;version&gt;3.8.0&lt;/version&gt;<br>  &lt;configuration&gt;<br>    &lt;source&gt;11&lt;/source&gt;<br>    &lt;target&gt;11&lt;/target&gt;<br>    &lt;annotationProcessorPaths&gt;<br>      &lt;path&gt;<br>        &lt;groupId&gt;io.micronaut&lt;/groupId&gt;<br>        &lt;artifactId&gt;micronaut-inject-java&lt;/artifactId&gt;<br>        &lt;version&gt;${micronaut.version}&lt;/version&gt;<br>      &lt;/path&gt;<br>    &lt;/annotationProcessorPaths&gt;<br>  &lt;/configuration&gt;<br>&lt;/plugin&gt;</pre><h3>Refactored code</h3><p>Micronaut is <strong>JSR-330</strong> compatible, so we can easily turn our dependencies into beans using <strong>@Singleton</strong> or <strong>@Named</strong> annotation.</p><pre><strong>@Singleton<br></strong>public class CustomerRepository {</pre><p>Usually, there is one composition root where root dependencies are obtained from the context.</p><p>It could be useful to have one context per verticle when using Vert.x. This way we are isolating verticles completely, without worrying about some non-thread safe singleton beans being used from the different verticles, which could lead to unexpected behavior.</p><pre>public<strong> </strong>CustomerNotificationVerticle() {</pre><pre>BeanContext beanContext = BeanContext.<em>run</em>();<br><strong>this</strong>.<strong>customerService </strong>= beanContext.getBean(<strong>CustomerService.class</strong>);<br><strong>this</strong>.<strong>notifier </strong>= beanContext.getBean(<strong>CustomerNotifier.class</strong>);<br>}</pre><p><strong>BeanContext.<em>run</em>() </strong>creates a new isolated bean context for CustomerNotificationVerticle.</p><p>We should do the same with other verticles as well.</p><p>The last thing to implement is a factory that will provide an implementation of <strong>CustomerNotifier </strong>interface and factory for connection pool creation.</p><pre><strong>@Factory</strong><br>public class<strong> </strong>NotifierFactory {</pre><pre><strong>@Singleton</strong><br>CustomerNotifier notifier() {return new<strong> </strong>EmailNotifier();}<br>}</pre><pre><strong>@Factory</strong><br>public class<strong> </strong>PoolFactory {</pre><pre>private static<strong> </strong>MySQLConnectOptions <em>connectOptions </em>= new<strong> </strong>MySQLConnectOptions()<br>.setPort(InMemoryDBHandler.<em>PORT</em>)<br>.setHost(&quot;localhost&quot;)<br>.setDatabase(InMemoryDBHandler.<em>DB</em>)<br>.setUser(InMemoryDBHandler.<em>USER</em>)<br>.setPassword(InMemoryDBHandler.<em>PASSWORD</em>);</pre><pre>private static PoolOptions <em>poolOptions </em>= new PoolOptions()<br>.setMaxSize(5);</pre><pre><strong>@Singleton</strong><br>MySQLPool createPool() {</pre><pre>return<strong> </strong>MySQLPool.<em>pool</em>(VertxSingletonHolder.<em>vertx</em>(), <em>connectOptions</em>, <em>poolOptions</em>);}<br>}</pre><p>Now the pool can be injected where it’s needed easily.</p><pre><strong>@Singleton</strong><br>public class CustomerRepository {<br>   <strong>private MySQLPool pool;</strong></pre><pre>public CustomerRepository(<strong>MySQLPool pool</strong>) {<br>       this.pool = pool;<br>   }</pre><p>There is no need to pass pool/connection through the methods — method parameter list is smaller and more readable.</p><pre><strong>@Singleton</strong><br>public class CustomerService {<br>   private CustomerRepository customerRepository;<br>...<br>   public Future&lt;List&lt;Customer&gt;&gt; getCustomers(<strong>int offset, int limit</strong>) {<br>       return customerRepository.getCustomers(<strong>offset, limit</strong>);<br>}</pre><h4>How much overhead?</h4><p>The average project startup time without DI was <strong>500ms</strong>. After adding Micronaut Inject startup time increased to <strong>~700ms</strong>.</p><h4>Startup performance with growth of dependencies</h4><p>Micronaut team claims that startup performance won’t be affected by codebase growth. To check this, some new beans were generated. Every bean was created as a prototype and injected using a constructor.</p><p>As we see, even with ~7000 dependencies(that is a huge amount), startup time increased to <strong>~1100ms</strong> — and that’s with 3 separate bean contexts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*3C2X4WkvUH1uyGZwPZ8iGg.png" /></figure><h3>Do we still have disadvantages?</h3><blockquote>- Could increase the number of classes</blockquote><p>Not an issue, if we do not need additional abstraction — there is no need to add new classes for no reason</p><blockquote>- Could affect startup performance</blockquote><p>Because of compile-time DI resolution, the startup performance impact is insignificant, and it won’t be much bigger with the codebase growth. The same is true for memory consumption.</p><blockquote>- Could be an overhead for small programs</blockquote><p>As we discovered, even the microservice benefits a lot from using DI, so it’s usage is absolutely reasonable</p><blockquote>+- Code is coupled to the Dependency Injection Framework</blockquote><p>As Micronaut implements JSR-330 it could be replaced by any other JSR-330 compliant framework in the future. The only coupling to the framework is bean creation logic (@Factory).</p><h3>Benefits summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t7gSwVAqb6NUcDHxsZV5WA.jpeg" /></figure><h4>Clean code</h4><p>As we discovered, DI makes writing clean code a lot easier.</p><p>Is it worth the cost?</p><p>Bad code design gives a small initial boost initially, but as time goes on it gets harder to add features. Even small changes require more time and could cause unexpected regression.</p><blockquote><em>Over the span of a year or two, teams that were moving very fast at the beginning of a project can find themselves moving at a snail’s pace. Every change they make to the code breaks two or three other parts of the code. No change is trivial. Every addition or modification to the system requires that the tangles, twists, and knots be “understood” so that more tangles, twists, and knots can be added</em></blockquote><blockquote><em>- Robert C. Martin</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*ITRpSyHitNyMfwCo-UyVPg.png" /><figcaption><a href="https://martinfowler.com/articles/is-quality-worth-cost.html">https://martinfowler.com/articles/is-quality-worth-cost.html</a></figcaption></figure><h4>Maintenance</h4><p>DI makes code more readable. <br>Writing readable code is significantly more cost-effective strategy than the alternative strategy of writing code as quickly as possible.</p><p>By creating maintainable code a developer is optimizing for the 70% of the time and cost of maintaining code rather than the 30% of the time and cost of creating code.</p><h4>Developer’s performance</h4><p>The side effect of clean code that could improve performance as well is that developers working in a clean code base are going to enjoy it much more than developers working in a messy codebase.</p><h4>Testability</h4><p>As DI encourages a developer to write the code that is not creating dependencies by itself, it’s a lot easier to test it in isolation.</p><p>It means that it reduces the time for writing tests, and gives an ability to test more cases, so it also reduces the number of defects.</p><p>As was shown in previous examples, some classes are very hard to test even with PowerMock (because of Vert.x compatibility issues).</p><p>Looking for workarounds could dramatically increase the time for testing such code.</p><h4>Isolating verticle’s state</h4><p>As was mentioned before, verticle communication should be implemented using an event bus.</p><p>Passing the same instance to different verticles directly breaks this rule and could lead to unexpected behavior.</p><p>When using DI we can not only resolve this issue but make it easier to write safe code without even thinking about it.</p><h3>Summary</h3><p>As we discovered, adding DI to microservice is completely reasonable. It improves productivity, makes testing faster, reduces defects count, improves maintainability and makes adding new features easier.</p><p>Investing time into writing a good code actually reduces the cost of software development.</p><h3>Bonus:</h3><p>Now that we know DI is totally worth using for microservices, do you think we can say the same about game development, especially when it’s a single-person project? <br>Check <a href="https://taraskohut.medium.com/5-unexpected-things-i-discovered-as-a-backend-developer-trying-indie-game-development-23c04b7d91bc">5 unexpected lessons from my journey into indie game development</a>.</p><p>Pro tip: You may clap 👏 up to 50 times for a story that connected with you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84e43b3b228e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>