<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Blog on sadensmol</title><link>https://sadensmol.com/posts/</link><description>Recent content in Blog on sadensmol</description><generator>Hugo</generator><language>en-us</language><copyright>sadensmol</copyright><lastBuildDate>Wed, 05 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://sadensmol.com/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>Learning System Design #13: To RAG or not to RAG</title><link>https://sadensmol.com/posts/2026/08/learning-system-design-13-to-rag-or-not-to-rag/</link><pubDate>Wed, 05 Aug 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/08/learning-system-design-13-to-rag-or-not-to-rag/</guid><description>&lt;p&gt;Part #13 of the &amp;ldquo;Learning System Design&amp;rdquo; series! This time — RAG, &lt;strong&gt;Retrieval-Augmented Generation&lt;/strong&gt;. The three letters everyone drops into every AI architecture diagram, usually right next to a vector database nobody in the room can quite explain the need for. I kept nodding along in those meetings until I actually sat down and built the thing — and it turns out RAG is far less mysterious, and far more of a plain old search problem, than the hype makes it sound.&lt;/p&gt;</description></item><item><title>Learning System Design #12: Understanding JWT</title><link>https://sadensmol.com/posts/2026/06/learning-system-design-12-understanding-jwt/</link><pubDate>Mon, 29 Jun 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/06/learning-system-design-12-understanding-jwt/</guid><description>&lt;p&gt;Part #12 of the &amp;ldquo;Learning System Design&amp;rdquo; series! This time it&amp;rsquo;s JWT — three Base64 strings everybody copy-pastes from a tutorial and almost nobody can explain when something goes wrong. I&amp;rsquo;ve debugged enough &amp;ldquo;Hash invalid&amp;rdquo; and &amp;ldquo;token expired but it&amp;rsquo;s not expired&amp;rdquo; incidents to think it&amp;rsquo;s worth slowing down and looking at what&amp;rsquo;s really going on.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/learning-system-design-12-understanding-jwt-hero.jpg" alt="Understanding JWT"&gt;&lt;/p&gt;
&lt;p&gt;The mental model I keep coming back to is a stamped passport. It&amp;rsquo;s self-contained, it carries claims about you, any border agent can verify it without phoning the country that issued it — and it expires. That&amp;rsquo;s a JWT.&lt;/p&gt;</description></item><item><title>Learning System Design #11: The Many-Factor App — Why 12 Factors Are Not Enough in 2026</title><link>https://sadensmol.com/posts/2026/05/learning-system-design-11-many-factor-app/</link><pubDate>Mon, 18 May 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/05/learning-system-design-11-many-factor-app/</guid><description>&lt;p&gt;Eleventh part of the &amp;ldquo;Learning System Design&amp;rdquo; series! This time — the 12-Factor App. Or rather, why &amp;ldquo;12&amp;rdquo; stopped being enough about a decade ago, and what a modern Go microservice actually has to do today.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/learning-system-design-11-many-factor-app-hero.jpg" alt="Finlayson weaving hall, 1932 — rows of identical looms stretching down the hall, a metaphor for many small factors composing into one well-tuned system"&gt;&lt;/p&gt;
&lt;p&gt;I keep running into the same situation. Someone joins a team, opens the README, reads &amp;ldquo;we follow 12-factor,&amp;rdquo; and assumes the conversation is done. Then we deploy and discover the service has no idempotency keys, no circuit breakers, no SBOM, env-var secrets in &lt;code&gt;kubectl describe pod&lt;/code&gt;, prompts hard-coded in source files, and no canary strategy. &lt;em&gt;Technically&lt;/em&gt; 12-factor — and yet the design is fifteen years behind reality.&lt;/p&gt;</description></item><item><title>Learning System Design #10: End-to-End Encrypted Backup for a Personal Home Server</title><link>https://sadensmol.com/posts/2026/04/learning-system-design-10-umbrel-home-backup/</link><pubDate>Thu, 23 Apr 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/04/learning-system-design-10-umbrel-home-backup/</guid><description>&lt;p&gt;Tenth part of the &amp;ldquo;Learning System Design&amp;rdquo; series! This time — a really juicy one. How do you design an end-to-end encrypted backup system for a personal home server that stores your photos, videos, notes, and a zoo of embedded databases — and do it on an ARM box with 4 GB of RAM, while still letting your phone and laptop read the data without ever trusting the cloud?&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/learning-system-design-10-umbrel-home-backup-hero.jpg" alt="A wall of vintage bank safe deposit boxes — a metaphor for per-user encrypted vaults"&gt;&lt;/p&gt;</description></item><item><title>Learning System Design #9: ClickHouse — Why Analytical Databases Are Absurdly Fast</title><link>https://sadensmol.com/posts/2026/04/learning-system-design-9-clickhouse/</link><pubDate>Mon, 20 Apr 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/04/learning-system-design-9-clickhouse/</guid><description>&lt;p&gt;Ninth part of the &amp;ldquo;Learning System Design&amp;rdquo; series! This time — ClickHouse. The columnar database that scans a billion rows in under a second on a single laptop and powers the analytics of Plausible, PostHog, SigNoz, CloudFlare Radar, and a long list of quant trading shops.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/learning-system-design-9-clickhouse-hero.jpg" alt="Motion blur of a fast-moving train — a metaphor for ClickHouse scanning billions of rows in a blink"&gt;&lt;/p&gt;
&lt;p&gt;I got curious about ClickHouse when I realized every modern observability and product analytics tool I respected was built on top of it. Grafana Cloud, PostHog, Signoz, Uber&amp;rsquo;s M3 — same engine underneath. So I spent some time digging into what makes it tick, and honestly, the design is beautiful. It&amp;rsquo;s a rare case where &amp;ldquo;100× faster than Postgres&amp;rdquo; is not marketing but actual everyday experience on analytical queries.&lt;/p&gt;</description></item><item><title>Learning System Design #8: WebRTC — How Real-Time Communication Actually Works</title><link>https://sadensmol.com/posts/2026/04/learning-system-design-8-webrtc/</link><pubDate>Fri, 10 Apr 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/04/learning-system-design-8-webrtc/</guid><description>&lt;p&gt;Eighth part of the &amp;ldquo;Learning System Design&amp;rdquo; series! This time — WebRTC. The technology that powers every video call you&amp;rsquo;ve ever made in a browser, every screen share in Google Meet, and every peer-to-peer file transfer that &amp;ldquo;just works&amp;rdquo; without installing anything.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/learning-system-design-8-webrtc-hero.jpg" alt="WebRTC"&gt;&lt;/p&gt;
&lt;p&gt;Before WebRTC, real-time communication on the web required Flash, Java applets, or proprietary plugins. WebRTC made it a native browser capability — no plugins, no downloads, no intermediary servers for the actual media transfer. And the best part? It&amp;rsquo;s not just for video calls.&lt;/p&gt;</description></item><item><title>AI: The Future We Wanted or the Trap We Didn't See?</title><link>https://sadensmol.com/posts/2026/04/ai-the-future-we-wanted-or-the-trap-we-didnt-see/</link><pubDate>Fri, 03 Apr 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/04/ai-the-future-we-wanted-or-the-trap-we-didnt-see/</guid><description>&lt;p&gt;The developer world has split in two. Open any tech forum, any Twitter thread, any Slack channel — and you&amp;rsquo;ll find the same fight. Camp one: &amp;ldquo;AI makes me 10x more productive, stop being a dinosaur.&amp;rdquo; Camp two: &amp;ldquo;AI is making developers dumb, we&amp;rsquo;re losing our craft.&amp;rdquo; Both sides are loud. Both sides have data. And both sides are missing the real point.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/ai-future-or-trap-hero.jpg" alt="AI: The Future We Wanted or the Trap We Didn&amp;rsquo;t See?"&gt;&lt;/p&gt;</description></item><item><title>Learning System Design #7: Kubernetes — The Complete Guide</title><link>https://sadensmol.com/posts/2026/03/learning-system-design-7-kubernetes/</link><pubDate>Tue, 24 Mar 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/03/learning-system-design-7-kubernetes/</guid><description>&lt;p&gt;Seventh part of the &amp;ldquo;Learning System Design&amp;rdquo; series! This time — Kubernetes. The thing that every backend engineer eventually encounters, and the thing that makes you question your career choices when you&amp;rsquo;re debugging a CrashLoopBackOff at 3 AM.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/learning-system-design-7-kubernetes-hero.jpg" alt="Kubernetes"&gt;&lt;/p&gt;
&lt;p&gt;But seriously — K8s is the industry standard for running containers in production. Whether you love it or hate it, you need to understand it. Let&amp;rsquo;s break it down.&lt;/p&gt;
&lt;h2 id="what-is-kubernetes"&gt;What is Kubernetes?&lt;/h2&gt;
&lt;p&gt;Kubernetes (K8s — the &amp;ldquo;8&amp;rdquo; stands for the eight letters between &amp;ldquo;K&amp;rdquo; and &amp;ldquo;s&amp;rdquo;) is an open-source container orchestration platform. Docker lets you package your app into a container. Kubernetes manages thousands of those containers across many machines.&lt;/p&gt;</description></item><item><title>Learning System Design #6: AI Agents</title><link>https://sadensmol.com/posts/2026/03/learning-system-design-6-ai-agents/</link><pubDate>Mon, 16 Mar 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/03/learning-system-design-6-ai-agents/</guid><description>&lt;p&gt;Sixth part of the &amp;ldquo;Learning System Design&amp;rdquo; series! This time we&amp;rsquo;re talking about AI agents — the thing that took the industry by storm and turned &amp;ldquo;just ask the AI&amp;rdquo; into &amp;ldquo;let the AI do it for you.&amp;rdquo; If you&amp;rsquo;ve used Claude Code, Cursor, or GitHub Copilot agent mode — you&amp;rsquo;ve already interacted with one.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/learning-system-design-6-ai-agents-hero.jpg" alt="AI Agents"&gt;&lt;/p&gt;
&lt;p&gt;But what actually makes an agent an agent? How does it decide what to do? And most importantly — when should you build one vs just writing a normal program? Let&amp;rsquo;s figure it out.&lt;/p&gt;</description></item><item><title>Learning System Design #5: Understanding PostgreSQL Locks</title><link>https://sadensmol.com/posts/2026/03/learning-system-design-5-understanding-postgresql-locks/</link><pubDate>Thu, 12 Mar 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/03/learning-system-design-5-understanding-postgresql-locks/</guid><description>&lt;p&gt;Fifth part of the &amp;ldquo;Learning System Design&amp;rdquo; series! This time we&amp;rsquo;re going deep into PostgreSQL locks — the thing nobody thinks about until their production database grinds to a halt because someone ran an &lt;code&gt;ALTER TABLE&lt;/code&gt; on a busy table at peak hours.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/learning-system-design-5-understanding-postgresql-locks-hero.jpg" alt="Understanding PostgreSQL Locks"&gt;&lt;/p&gt;
&lt;p&gt;Locks are the mechanism PostgreSQL uses to coordinate concurrent access to the same data. Every &lt;code&gt;SELECT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt;, &lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;DELETE&lt;/code&gt;, &lt;code&gt;ALTER TABLE&lt;/code&gt; — they all take some kind of lock. Most of the time you never notice because PostgreSQL handles it automatically. But when something goes wrong — a migration blocks all traffic, a deadlock kills transactions, or an idle connection holds a lock for hours — you &lt;strong&gt;really&lt;/strong&gt; need to understand how this works.&lt;/p&gt;</description></item><item><title>Learning System Design #4: Saga Pattern</title><link>https://sadensmol.com/posts/2026/03/learning-system-design-4-saga-pattern/</link><pubDate>Thu, 05 Mar 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/03/learning-system-design-4-saga-pattern/</guid><description>&lt;p&gt;Fourth part of the &amp;ldquo;Learning System Design&amp;rdquo; series! This time we&amp;rsquo;re tackling the Saga pattern — something you&amp;rsquo;ll inevitably run into the moment you split a monolith into microservices and realize your nice &lt;code&gt;BEGIN/COMMIT&lt;/code&gt; doesn&amp;rsquo;t work across service boundaries anymore.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/saga-pattern-hero.jpg" alt="Saga Pattern"&gt;&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The Problem&lt;/h2&gt;
&lt;p&gt;In a monolith, distributed transactions don&amp;rsquo;t exist. You have one database, one transaction:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sql" data-lang="sql"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;BEGIN&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;TRANSACTION&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;. Deduct money &lt;span style="color:#66d9ef"&gt;from&lt;/span&gt; wallet
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;. &lt;span style="color:#66d9ef"&gt;Create&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;order&lt;/span&gt; record
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;3&lt;/span&gt;. Reserve inventory
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;COMMIT&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Step 3 fails? Database rolls back everything. Done.&lt;/p&gt;</description></item><item><title>Learning System Design #3: Rate Limiting</title><link>https://sadensmol.com/posts/2026/02/learning-system-design-3-rate-limiting/</link><pubDate>Thu, 26 Feb 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/02/learning-system-design-3-rate-limiting/</guid><description>&lt;p&gt;Third part of the &amp;ldquo;Learning System Design&amp;rdquo; series! This time — rate limiting. Something every backend developer deals with sooner or later, and something that comes up in almost every system design interview.&lt;/p&gt;
&lt;p&gt;The concept is dead simple — control how many requests a client can make in a given time window. But the devil is in the details. There are multiple algorithms, each with different trade-offs, and picking the wrong one can either leave your system unprotected or annoy your users with unnecessary rejections.&lt;/p&gt;</description></item><item><title>Learning System Design #2: Secure Game Launch for 3rd Party Integrations</title><link>https://sadensmol.com/posts/2026/02/learning-system-design-2-secure-game-launch-for-3rd-party-integrations/</link><pubDate>Thu, 19 Feb 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/02/learning-system-design-2-secure-game-launch-for-3rd-party-integrations/</guid><description>&lt;p&gt;Second article in the &amp;ldquo;Learning System Design&amp;rdquo; series! This time we&amp;rsquo;re tackling something very specific — how to securely launch a game when it&amp;rsquo;s integrated with 3rd party operators and aggregators.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;ve ever worked in iGaming or any B2B game provider setup, you know the drill — your game doesn&amp;rsquo;t live on your own website. It gets launched inside someone else&amp;rsquo;s platform, via redirect or iframe. And you need to make sure that the session is secure, can&amp;rsquo;t be hijacked, and works correctly even when things go wrong.&lt;/p&gt;</description></item><item><title>Learning System Design #1: How HTTP Works</title><link>https://sadensmol.com/posts/2026/02/learning-system-design-1-how-http-works/</link><pubDate>Thu, 12 Feb 2026 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2026/02/learning-system-design-1-how-http-works/</guid><description>&lt;p&gt;This is the first article in my &amp;ldquo;Learning System Design&amp;rdquo; series where I&amp;rsquo;m going through fundamental topics every backend engineer should know well. And what better place to start than HTTP!&lt;/p&gt;
&lt;p&gt;We use it every day, but how often do we actually think about what&amp;rsquo;s happening under the hood?&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/how-http-works-hero.jpg" alt="How HTTP Works"&gt;&lt;/p&gt;
&lt;h2 id="request-response-simple-as-it-is"&gt;Request-Response. Simple as it is.&lt;/h2&gt;
&lt;p&gt;HTTP is a &lt;strong&gt;request-response&lt;/strong&gt; protocol. Client sends a request, server returns a response. Every interaction follows this pattern — no surprises here.&lt;/p&gt;</description></item><item><title>Things I Hate in Go. Fourth.</title><link>https://sadensmol.com/posts/2025/05/things-i-hate-in-go-fourth/</link><pubDate>Tue, 13 May 2025 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2025/05/things-i-hate-in-go-fourth/</guid><description>&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/things-i-hate-in-go-fourth.png" alt="Things I hate in Go. Fourth."&gt;&lt;/p&gt;
&lt;p&gt;&amp;ldquo;Simplicity, efficiency, and reliability&amp;rdquo; — the main principles in Go.&lt;/p&gt;
&lt;p&gt;Today we are going to talk about immutability — which is hardly linked to Go&amp;rsquo;s &amp;ldquo;efficiency&amp;rdquo; and &amp;ldquo;simplicity&amp;rdquo; principles.&lt;/p&gt;
&lt;h2 id="immutability-is-not-a-thing-in-go"&gt;Immutability is not a thing in Go!&lt;/h2&gt;
&lt;p&gt;Since you have pointer methods and ability to work with pointers, you can change actually everything! Moreover it&amp;rsquo;s highly encouraged by programmers to return pointers to large structures and pass them by pointers, which leads to lack of immutability.&lt;/p&gt;</description></item><item><title>Go Gems: 1. Powerful Go Context in MSA</title><link>https://sadensmol.com/posts/2024/10/go-gems-1-powerful-go-context-in-msa/</link><pubDate>Sat, 05 Oct 2024 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2024/10/go-gems-1-powerful-go-context-in-msa/</guid><description>&lt;p&gt;We all know Go&amp;rsquo;s context package!&lt;/p&gt;
&lt;p&gt;&lt;a href="https://pkg.go.dev/context"&gt;https://pkg.go.dev/context&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It has very useful methods, and one of them — WithTimeout. It allows us create a Context which could be cancelled automatically in certain period of time.&lt;/p&gt;
&lt;h2 id="contextwithtimeout-why-is-it-useful"&gt;context.WithTimeout. Why is it useful?&lt;/h2&gt;
&lt;p&gt;Imagine you have an application with microservice-based architecture where you have a few microservices which communicate with each other:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/go-gems-context-msa.png" alt="Synchronous communication pattern in MSA"&gt;&lt;/p&gt;
&lt;p&gt;For example &amp;ldquo;Service 1&amp;rdquo; sends some request to &amp;ldquo;Service 2&amp;rdquo; which sequentially sends request to &amp;ldquo;Service 3&amp;rdquo;. This chained requests pattern is called &amp;ldquo;Synchronous communication pattern in MSA&amp;rdquo;.&lt;/p&gt;</description></item><item><title>Count Your Money in Go Without Floating Problems</title><link>https://sadensmol.com/posts/2023/12/count-your-money-in-go-without-floating-problems/</link><pubDate>Tue, 12 Dec 2023 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2023/12/count-your-money-in-go-without-floating-problems/</guid><description>&lt;p&gt;Money…&lt;/p&gt;
&lt;p&gt;When we hear this at the start of development first we think about is &amp;ldquo;floating point numbers precision&amp;rdquo; and &amp;ldquo;money value representation&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;So how to deal with money, how to store and how to pass them around — those are the questions I&amp;rsquo;d like to cover in this short essay.&lt;/p&gt;
&lt;h2 id="why-is-it-a-problem-at-all"&gt;Why is it a problem at all?&lt;/h2&gt;
&lt;p&gt;Standard float types in Go have some certain precision (like in any other language), and you cannot use them for money operations. This simplest example here is the following:&lt;/p&gt;</description></item><item><title>Things I Hate in Go. Third.</title><link>https://sadensmol.com/posts/2023/09/things-i-hate-in-go-third/</link><pubDate>Sat, 23 Sep 2023 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2023/09/things-i-hate-in-go-third/</guid><description>&lt;p&gt;&amp;ldquo;Go interfaces generally belong in the package that uses values of the interface type, not the package that implements those values.&amp;rdquo; — Go Code Review Comments.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/things-i-hate-in-go-hero.png" alt="Things I hate in Go"&gt;&lt;/p&gt;
&lt;p&gt;Why every time I take some interview or do the test task — reviewers ask me about this problem?&lt;/p&gt;
&lt;p&gt;Where do you put interfaces?
No you failed our test, because you placed your interface along with your implementation. — &lt;a href="https://github.com/sadensmol/test_faraway"&gt;https://github.com/sadensmol/test_faraway&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Things I Hate in Go. Second.</title><link>https://sadensmol.com/posts/2023/09/things-i-hate-in-go-second/</link><pubDate>Wed, 06 Sep 2023 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2023/09/things-i-hate-in-go-second/</guid><description>&lt;p&gt;&amp;ldquo;Each time a defer statement executes, the function value and parameters to the call are evaluated as usual and saved anew but the actual function is not invoked&amp;rdquo; - Go specification.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/things-i-hate-in-go-hero.png" alt="Things I hate in Go"&gt;&lt;/p&gt;
&lt;p&gt;What does it mean? Let&amp;rsquo;s check how do we use defer.&lt;/p&gt;
&lt;p&gt;One point to note here is that we use a function invocation here but the actual call is delayed until defer is get to its turn.&lt;/p&gt;</description></item><item><title>Things I Hate in Go. First.</title><link>https://sadensmol.com/posts/2023/07/things-i-hate-in-go-first/</link><pubDate>Thu, 06 Jul 2023 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2023/07/things-i-hate-in-go-first/</guid><description>&lt;p&gt;&amp;ldquo;Accept an interface, return a struct&amp;rdquo; — well known Go idiom.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/things-i-hate-in-go-hero.png" alt="Things I hate in Go"&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s look more in deep into it. First, what comes on my mind when I think about this idiom is SOLID.&lt;/p&gt;
&lt;p&gt;We are following Dependency Inversion principle here by injecting dependencies through the help of Go interfaces. Here we are using constructor injection:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;type&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;UserService&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#a6e22e"&gt;r&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;IUserRepository&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;type&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;IUserRepository&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;interface&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#a6e22e"&gt;GetByID&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;ID&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;string&lt;/span&gt;) (&lt;span style="color:#f92672"&gt;*&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;User&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;error&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;func&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;NewUserService&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;r&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;IUserRepository&lt;/span&gt;) (&lt;span style="color:#f92672"&gt;*&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;UserService&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;error&lt;/span&gt;) {&lt;span style="color:#f92672"&gt;...&lt;/span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We could pass any user repository here and dynamically switch the service behaviour which provides us with all the benefits of DIP - loose coupling, modularity, testability etc…&lt;/p&gt;</description></item><item><title>My Clean Architecture Go Application</title><link>https://sadensmol.com/posts/2023/03/my-clean-architecture-go-application/</link><pubDate>Thu, 09 Mar 2023 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2023/03/my-clean-architecture-go-application/</guid><description>&lt;p&gt;I fully moved to Go stack a few months ago and suffered a lot with the good approach for architecturing the code and structuring the project. Went through multiple open source projects, talked to multiple Go devs and finally came up with some template and approaches I&amp;rsquo;m using for all new projects. Maybe this will be interesting to all who are struggling with the same problems!&lt;/p&gt;
&lt;p&gt;I will go through creation simple account management API and try to apply my vision of clean architecture in Go applications.&lt;/p&gt;</description></item><item><title>From Java/Kotlin to Go(Golang)</title><link>https://sadensmol.com/posts/2023/02/from-java-kotlin-to-go/</link><pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2023/02/from-java-kotlin-to-go/</guid><description>&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/from-java-kotlin-to-go.jpeg" alt="From Java/Kotlin to Go"&gt;&lt;/p&gt;
&lt;h2 id="about-myself"&gt;About myself&lt;/h2&gt;
&lt;p&gt;I started as a Java developer about 10 years ago with Java 5. It was time when most enterprises were built on Java EE and running on Jboss. EJB, XLS, Struts, Hibernate, Eclipse and similar technologies were using at that time. Applications were heavy, too resource hungry and used dedicated servers. At that time I was mostly developing CLI tools, then switched to Spring and video processing (Red5, Wowza) where Flash was mostly used for web and client side applications.&lt;/p&gt;</description></item><item><title>Rate Limiting in Multi-Tier Apps</title><link>https://sadensmol.com/posts/2023/01/rate-limiting-in-multi-tier-apps/</link><pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2023/01/rate-limiting-in-multi-tier-apps/</guid><description>&lt;p&gt;One day we found that we need to rate limit some of our not secured API endpoints. Mostly they are related to the functionality like password reset or sending feedback/contact me forms. In this application we don&amp;rsquo;t use authentification for these endpoints and they are actually publicly exposed.&lt;/p&gt;
&lt;p&gt;Here is a structure of our web application.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://sadensmol.com/images/posts/rate-limiting-architecture.png" alt="Web application architecture"&gt;&lt;/p&gt;
&lt;p&gt;We have a Front-End (FE), Back End for Front End (BFF) and Back End. FE is a react.js application, BFF is next.js based and our BE are written in Go.&lt;/p&gt;</description></item><item><title>Exception Based Flow Control in Spring Boot Application</title><link>https://sadensmol.com/posts/2022/09/exception-based-flow-control-in-spring-boot-application/</link><pubDate>Sun, 18 Sep 2022 00:00:00 +0000</pubDate><guid>https://sadensmol.com/posts/2022/09/exception-based-flow-control-in-spring-boot-application/</guid><description>&lt;p&gt;Here I&amp;rsquo;d like to describe the way I&amp;rsquo;m using while working on different Java/Kotlin/Spring Boot microservice based applications. The code for demo the idea is located here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/sadensmol/article_sb_exceptions"&gt;https://github.com/sadensmol/article_sb_exceptions&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="why-exception-based"&gt;Why exception based?&lt;/h2&gt;
&lt;p&gt;You ask &amp;ldquo;Why exception based?&amp;rdquo;, and it&amp;rsquo;s a good question! All modern languages have special structures to control the execution flow — the most known one is &lt;strong&gt;&lt;code&gt;if statement&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;if (expression is true) then
 {execute block a}
else
 {execute block b}
&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;Here we check the &lt;code&gt;expression&lt;/code&gt; and decide what code to execute based on the evaluation result. But we mostly choose between 2 cases - &lt;strong&gt;&lt;code&gt;positive case (forward evaluation)&lt;/code&gt;&lt;/strong&gt; - when the expression suits our expectation and &lt;strong&gt;&lt;code&gt;fallback case&lt;/code&gt;&lt;/strong&gt; - when we should handle something unwanted or unexpected. Doesn&amp;rsquo;t the second sound like &lt;strong&gt;&lt;code&gt;exception&lt;/code&gt;&lt;/strong&gt; case? It does!&lt;/p&gt;</description></item></channel></rss>