<?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 Yasin Babaoğlu on Medium]]></title>
        <description><![CDATA[Stories by Yasin Babaoğlu on Medium]]></description>
        <link>https://medium.com/@yasinbabaoglu?source=rss-49b3d5a41807------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KfI7MTMBlZ9l3FxB2Fe42A.jpeg</url>
            <title>Stories by Yasin Babaoğlu on Medium</title>
            <link>https://medium.com/@yasinbabaoglu?source=rss-49b3d5a41807------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 05:48:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yasinbabaoglu/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[Bir Kaosun Anatomisi — The Bear S1.E7(Review) ve Concurrency]]></title>
            <link>https://yasinbabaoglu.medium.com/bir-kaosun-anatomisi-the-bear-s1-e7-review-ve-concurrency-50f9b7f33104?source=rss-49b3d5a41807------2</link>
            <guid isPermaLink="false">https://medium.com/p/50f9b7f33104</guid>
            <category><![CDATA[parallel-computing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[the-bear-tv-series]]></category>
            <category><![CDATA[multithreading]]></category>
            <category><![CDATA[concurrency]]></category>
            <dc:creator><![CDATA[Yasin Babaoğlu]]></dc:creator>
            <pubDate>Wed, 26 Nov 2025 22:49:15 GMT</pubDate>
            <atom:updated>2025-11-26T22:49:51.546Z</atom:updated>
            <content:encoded><![CDATA[<h3>Bir Kaosun Anatomisi — The Bear S1.E7(Review)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*iJtikI5dLYqFO_T1dW5kUg.png" /></figure><p><a href="https://www.imdb.com/title/tt18233708"><em>The Bear</em>’in “Review” bölümünü</a> izlerken ilk aklıma gelen şey, teslim bayrağının kaldırıldığı bir multithreading program oldu. Bölümdeki kaotik yoğunluk, modern eşzamanlı yazılımlarda sıkça karşılaşılan sorunlarla şaşırtıcı derecede örtüşüyordu; bunu sahne sahne ele alarak teknik bir analoji kurmak istedim.</p><p>Her şey küçük bir bip ile başladı: bir bip, sonra bir bip daha — birer küçük interrupt. Ardından ardı arkası kesilmeyen bip’ler ve bir anda fırtına. Bu yazıda, o fırtınanın nedenlerini ve sonuçlarını, mutfaktaki sahneler üzerinden multithreading kavramlarıyla eşleştirerek anlatmaya çalışacağım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aVoo5WjU2au43qxI9GGmpg.png" /><figcaption><a href="https://www.imdb.com/title/tt18233708/mediaviewer/rm1832257281">https://www.imdb.com/title/tt18233708/mediaviewer/rm1832257281</a></figcaption></figure><h3>1- You left the pre-order option open!</h3><p>Siparişler yağdıkça printer sarsılıyor. Kağıtlar durmadan akıyor; hiçbir thread’in “tamam, bunu işliyorum” demeye fırsatı yok.</p><p>Burası <em>The Bear</em> mutfağı ama aslında tam olarak şöyle bir sistem düşünebiliriz:</p><ul><li><strong>Producer (üretici)</strong>: Online sipariş sistemi</li><li><strong>Consumer (tüketici)</strong>: Mutfağın kendisi</li><li><strong>Queue (kuyruk)</strong>: Sipariş yazıcısı + ekran</li></ul><p>Ve aniden producer tüketiciden çok daha hızlı çalışmaya başlıyor. Bu esnada Sydney panik durumda, Carmy ise agrasif bir şekilde çözüm bulmaya çalışıyor. İlk şok dalgasından sonra Carmy iş dağılımı ve öncelikleri hızlıca ekibe bildiriyor. Herkes teker teker o ikonik repliği tekrarlıyor: <strong><em>“Yes chef!”</em></strong></p><p>İşte bu, sistemin ilk tepkisidir; threadler hala çalışır durumda ama artık tamamen reaktif moddadır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GHsMKpnElh8eVwwXe2RMpw.png" /><figcaption><a href="https://www.imdb.com/title/tt18233708/mediaviewer/rm1490453762/">https://www.imdb.com/title/tt18233708/mediaviewer/rm1490453762/</a></figcaption></figure><h4>🧠 Teknik: Multithreading Açısından Neler Oluyor?</h4><p>Bu sahnede teknik olarak olan şey birebir şudur:</p><h4>1. Producer throughput &gt; Consumer throughput</h4><p>Sipariş oluşturma hızı, mutfak işleme hızından kat kat fazla.</p><h4>2. Queue hızla doluyor</h4><p>Sipariş ekranı aslında bounded bir queue gibi davranır. Ekranda liste uzar, uzar…</p><h4>3. Hiçbir backpressure mekanizması yok</h4><p>Mutfak tüketici olsa bile, üreticiye “yavaşla” diyemez. Çünkü insanlar hala sipariş vermeye devam etmektedir. Müşterilerin mutfaktaki kaostan haberleri yoktur, onlar sadece siparişlerinin hazırlanması ile ilgilenirler.</p><ul><li>Rate limiting yok</li><li>Load shedding yok</li><li>Worker thread artırma yok ( çünkü mutfaktaki şef sayısı ve mutfağın alanı sınırlı)</li><li>Queue overflow politikası yok</li></ul><h4>4. İlk gecikme: context-switch yükü görünmeye başlar</h4><p>Sydney ekran ile istasyonu arasında gidip gelirken aslında thread context switching yaşar:</p><ul><li>Ekrana bakar</li><li>Siparişi okur</li><li>Geri döner</li><li>Dur bir sipariş daha geldi, diye tekrar başa sarar</li></ul><h4>🌱 İnsan Davranışı = Thread Davranışı</h4><ul><li>Baskı artarken Sydney’in nefesi hızlanır -&gt; Bu, thread’in CPU’ya yetişemediği anda verdiği tepkinin insani karşılığıdır.</li><li>Marcus’un elleri yavaşlar -&gt; Bu, latency artışıdır.</li><li>Carmy’nin yüzü gerginleşir ama hareketleri hızlanır. -&gt;Bu, burst load’a yanıt veren ana thread gibidir.</li></ul><h3>2) 🍽️ Sydney’nin Yalnızlığı — Worker Pool Bottleneck</h3><p>Siparişlerin şiddeti arttıkça mutfaktaki her istasyon kendi küçük kıyametine gömülür. Kimse kimseye bakamaz halde. Herkes, sadece önündeki yangını söndürmeye çalışır. Bu kaosun ortasında, sıcak yemek istasyonu tek bir kişiye kalmıştır: Sydney.</p><p>Tavaların cızırtısı, printer’ın bitmek bilmeyen bip sesleri ve Richie’nin yerli yersiz çıkışları arasında Sydney bir yandan etleri çevirir, bir yandan garnitürleri kontrol eder, bir yandan da yeni gelen siparişlere yetişmeye çalışır.</p><p>Ama yetişemez.</p><p>Yetişemez çünkü tek bir worker thread, birkaç iş yükünün paralel yürütülmesi gereken bir pipeline’ı tek başına taşımaktadır.</p><p>Bir noktada Sydney’in nefesi kesilir. Ellerinin titrediği fark edilir. Gözlerinden çaresizliğini okuyabiliriz.</p><h4>🧠 Teknik: Thread Pool Neden Darboğaza Girer?</h4><p>Thread pool, bir sistemin işleri aynı anda paralel olarak yürütebilmesini sağlar.<br> Ama bu sahnede gördüğümüz gerçek çok basit ve çok acı:</p><p><strong>Worker sayısı = 1 ise, paralellik yoktur.</strong><br>Bu, tek bir CPU core’un tüm işleri tek başına yürütmesine benzer. İşler sıraya dizilir, tek bir kanal üzerinden akar ve her yeni iş gecikmeye neden olur.</p><ul><li><strong>Worker sayısı yetersiz:</strong><br> Sydney tek başına, istasyon ise iki kişilik iş yüküne sahip.</li><li><strong>Yük bir anda patlıyor:</strong><br> Siparişler linear değil.</li><li><strong>Diğer worker’lar bloklanmış:</strong><br> Marcus hamurda takılmış, Tina kendi istasyonuna gömülmüş, Richie ise yerli yersiz serzenişlerde ve eleştirilerde bulunuyor.</li><li><strong>Şef (scheduler) thread oversubscribed:</strong><br>Carmy, bir yandan üretim hattını koordine ederken, diğer worker’ların sorunlarıyla boğuşuyor — Sydney’e CPU zamanı ayıramıyor.</li></ul><p>Sonuç?</p><p><strong>Throughput çöker.</strong><br>Bir sistem tek bir noktada tıkanıyorsa, geri kalan tüm pipeline gecikmeye başlar ve haliyle en yavaş bileşeni kadar hızlı olabilir.</p><h4>🌱 İnsani Karşılığı</h4><p>Sydney’in sessizce sıkışması, teknik dünyadaki worker pool bottleneck’in duygusal karşılığı gibidir. Bu yavaşlama fark edilmezse, bir sonraki aşama kaçınılmazdır:</p><p>Bağlantı kopması, task failure, thread panic.</p><h3>3) You didn’t say corner!</h3><p>Mutfakta “köşe” demek sadece bir refleks değil, bir senkronizasyon protokolüdür. Kazaları önlemek için, çalışanlar hareketlerini ve eylemlerini sözlü olarak duyurmalıdır. Birinin arkasına geçerken “arkanda” denmeli; bir köşeye yaklaşırken “köşe” diye seslenilmeli; sıcak bir şey taşırken “sıcak tava” denmelidir.<a href="https://www.escoffier.edu/blog/culinary-arts/a-look-at-effective-communication-in-the-kitchen/">[1]</a></p><p>Bu iletişim kelimelerini, aynı alanda çalışan iki kişinin aynı kaynağı çakışmadan kullanması için uygulanan sözlü bir mutex olarak düşünebiliriz.</p><p>Bu sahnede sipariş seli mutfağı boğarken herkes birbirinin üzerinden atlayarak hayatta kalmaya çalışır. Sydney, elindeki tabağı yetiştirmek için hızla köşeyi döner ama bu çağrıyı(köşe) yapmadığında protokol bozulur…</p><p>Aynı anda Richie, hiçbir yere varmadığı halde sürekli bir şeyleri “kontrol ediyormuş” gibi o dar koridorda belirir.</p><p>Ve <em>çarpışırlar; </em>sonuç tam bir race condition’dır.</p><p>Tabaklar yere düşer, Richie sinir bozucu bir şekilde: <strong><em>“You didn’t say corner!”</em> </strong>deyip durur.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YQSrBZX4mZ06VzYMkzGMyQ.png" /><figcaption><a href="https://www.imdb.com/title/tt18233708/mediaviewer/rm120981249/">https://www.imdb.com/title/tt18233708/mediaviewer/rm120981249/</a></figcaption></figure><h4>🧠 Teknik: Race Condition Tam Olarak Nedir?</h4><p>Bir race condition, iki ya da daha fazla thread in aynı kaynağa hangi sırayla erişeceği belli olmadığında ortaya çıkabilen birdurumdur. Bu belirsizlik:</p><ul><li>Çakışmaya,</li><li>Yanlış sonuca,</li><li>Veri tutarsızlığına,</li><li>Hatta sistem çöküşüne</li></ul><p>sebep olabilir.</p><p>Sahnedeki çarpışma ise bunun fiziksel karşılığıdır.</p><h4>🌱 İnsani Karşılığı</h4><p>Richie’nin öfkesi sadece bir kelime eksikliğine değil. Aslında şöyle bağırıyor: <em>“Ben zaten görünmüyorum. Bari beni uyarsaydın.”</em></p><p>Sydney’in sessizliği ise şunu söylüyor: <em>“Zamanım yok. Düşünemiyorum. Sadece yetiştirmem lazım.”</em></p><p>İki insanın kendi iç stresinde boğulduğu noktada iletişim protokolü çökebilir.</p><p>Tıpkı sistemlerde olduğu gibi:</p><ul><li>Protokol ihlali → iletişim çakışması</li><li>Aynı kaynağa aynı anda erişim → çarpışma</li><li>Çarpışma → daha fazla hata ve gecikme</li></ul><p>Sonuç: Kaos çoğalır.</p><h3>4)Richie &amp; Carmen — Deadlock, Starvation ve Priority Inversion</h3><p>Sipariş fırtınası devam ederken mutfağın dar koridorunda ani bir gerginlik yükselir. Richie ve Carmy birbirlerine dönüp bağırmaya başlar. İkisi de geri çekilmez; ikisi de kendince “haklı”dır; ikisi de nefes nefesedir. Koridorun ortasında, omuz omuza, göz göze kilitlenmişlerdir. Sorun sadece kavga değildir. Fiziksel alan aslında bir <strong>shared resource</strong>’tur. Ve o kaynak şu an iki thread tarafından aynı anda tutulmaktadır.</p><p>Kimse geri adım atmazsa, kimse ilerleyemez.</p><p>Bu sırada arkalarında bir kuyruk oluşur:</p><ul><li>Garsonlar geçemez.</li><li>Line cook’lar istasyon değiştiremez.</li><li>Sydney, Marcus, Tina hepsi donup kalır.</li><li>Mutfak akışı tamamen durur.</li></ul><p>Carmy’nin yüzü öfke ve çaresizliğin bir karışımıdır. Richie’nin sesi gittikçe daha yükselir.</p><p><strong>Sistem durmuştur.<br>Mutfak kilitlenmiştir.<br>Deadlock gerçekleşmiştir.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*Wd7VU0Fxw0R7NWBefxp1tQ.png" /><figcaption><a href="https://www.imdb.com/title/tt14452776/mediaviewer/rm2715190530">https://www.imdb.com/title/tt14452776/mediaviewer/rm2715190530</a></figcaption></figure><h4>🧠 Teknik: Deadlock Tam Olarak Nedir?</h4><p>Deadlock, iki veya daha fazla thread in birbiri beklemesi sebebiyle sistemin tamamen durmasıdır.<br>The Bear’ın o sahnesi, <a href="https://cs341.cs.illinois.edu/coursebook/Deadlock"><em>Klasik Deadlock Şartları</em></a> ile birebir örtüşür:</p><h4>1. Mutual Exclusion (Karşılıklı Dışlama)</h4><p>Koridor tek kişilik; aynı anda iki kişi geçemez.</p><h4>2. Hold and Wait (Tutarak Bekleme)</h4><p>Carmen ilerlemek istiyor ama yol Richie’nin elinde. Richie alanı tutmuş ama başka bir sonuç bekliyor.</p><h4>3. No Preemption (Zorla Elinden Alamama)</h4><p>Kimse diğerini fiziksel olarak çekip kaldıramaz. Kaynak zorla alınamaz.</p><h4>4. Circular Wait (Döngüsel Bekleme)</h4><p>Carmen Richie’nin çekilmesini bekliyor. Richie Carmen’in geri adım atmasını bekliyor.</p><p>Bu dört koşul sağlandığında, tıpkı sahnede olduğu gibi, sistem durur.</p><h4>Starvation: Kaynaklara Erişemeyenler</h4><p>Deadlock’ın etrafındaki herkes starvation yaşar.</p><ul><li>Garsonlar ellerindeki tabaklarla sıkışmış halde bekler.</li><li>Tina geçemediği için istasyonuna dönemediğinden servisler gecikir.</li><li>Sydney’in siparişleri teslim etme hızı düşer.</li><li>Marcus’un hamuru zamanında fırına gidemez.</li></ul><p>Hiçbiri kavganın parçası değildir ama hepsi kavganın sonucundan zarar görür. Bu, teknik dünyadaki starvation’ın birebir karşılığıdır: Bir bileşen, başka süreçlerin kilidi yüzünden sürekli kaynaklara erişemiyorsa, “aç kalır”.</p><h4>Priority Inversion: Richie’nin Low Priority Thread Olarak Sistemi Bloke Etmesi</h4><p>Normalde, bu kaos içinde Carmen yüksek öncelikli bir thread’dir (Çünkü Carmy Executive Chef’tir) :</p><ul><li>Sorunları çözmesi gerekir</li><li>Akışı toplaması gerekir</li><li>Mutfağı yönetmesi gerekir</li><li>En kritik kararları onun vermesi gerekir</li></ul><p>Ancak Richie (düşük öncelikli bir thread tir) koridoru kapattığında, yüksek öncelikli thread bloke olur.</p><p>Bu tam olarak priority inversion örneğidir<strong>, y</strong>ani:</p><ul><li>Önceliği düşük bir süreç (Richie),</li><li>Önceliği yüksek bir süreci (Carmen),</li><li>Ortak bir kaynağı tutarak durdurur.</li></ul><p>Mutfak bundan dolayı tamamen felç olur.</p><h4>🌱 İnsani Karşılığı</h4><p>İki inatçı, stres altındaki insan bir noktada “geri çekilmeme savaşına” girer. Carmy “lider” rolünde bile olsa, bazen bir anlık öfke onu da kilitler. Richie ise tüm güvensizliklerini bağırarak bastırır.</p><p>Bu sırada kimse ilerleyemez.<br>Kimse işini yapamaz.</p><p>Deadlock, bilgisayar biliminde olduğu kadar insan ilişkilerinde de acı bir gerçektir:</p><blockquote>“Sen bir adım geri çekilmezsen, ben de çekilmeyeceğim… o halde ikimiz de ilerleyemeyelim.”</blockquote><h3>5) Çöküş ve Sessizlik — Graceful Shutdown</h3><p>Mutfak saatlerdir hiç durmadan çalışıyor. Siparişler yağmış, worker’lar tükenmiş — bir kısmı işi bırakmış — , protokoller çökmüş, deadlock’lar yaşanmış… Sydney’in işi bıraktığını gördükten sonra kargaşanın tam ortasında Carmy birden durur. Artık hiç bir şeye yanıt veremez ve yere çöker — sanki CPU artık hiçbir interrupt’ı işleyemeyecek kadar sıkışmıştır.</p><p>Mutfak bir anda susar. Kaosun uğultusu kesilir. Artık sistem çökmüştür — ve sessizlik bu çöküşün işaretidir. Sonrasında Carmy dayanamaz ve fiş makinesini yumruklayarak parçalar.</p><p>Bir zamanlar 8–9 kişinin bağırarak koşturduğu o hatta artık Carmy tek başınadır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qi7z7_cuRixVkuIDW6d1fw.png" /><figcaption><a href="https://www.imdb.com/title/tt18233708/mediaviewer/rm3540737/?ref_=ext_shr_lnk">https://www.imdb.com/title/tt18233708/mediaviewer/rm3540737</a></figcaption></figure><h4>🧠 Teknik: Graceful Shutdown Nedir? Bu Sahne Neden Tam Tersi?</h4><p>Bir sistem kapanırken amaç şudur:</p><blockquote>Kimse paniklemesin, işler yarım kalmasın, sistem düzenli şekilde kapansın.</blockquote><p>Graceful shutdown’ın basit adımları:</p><p>1. Yeni iş almayı bırak: “Sıraya bir şey ekleme” denir.</p><p>2. Eldeki işler tamamla: Worker’lar sadece mevcut görevleri bitirir.</p><p>3. Herkese durma sinyali gönder: “Artık kapatıyoruz, usulca ve temizce çık” mesajı verilir.</p><p>4. Kaynakları düzgün şekilde kapat: Bağlantılar kapanır, queue boşaltılır.</p><h4>❌ Dizide Olan: Graceful Shutdown Değil, Tam Bir Forced Shutdown</h4><p>Mutfakta bunların hiçbiri olmadı:</p><ul><li>Sipariş makinesi durmadı → yeni işler gelmeye devam etti</li><li>Kimse elindeki işi tamamlayamadı</li><li>Stop sinyali kimseye ulaşmadı</li><li>İnsanlar birer birer çöktü — işten ayrıldı</li><li>Ve sonunda Carmy, kontrolü kaybedip makineyi kırarak sistemi kapattı</li></ul><p>Bu, yazılımda graceful shutdown değil, “artık dayanamıyorum” diyip kabloyu çekmek gibidir.</p><h3>6) Epilogue</h3><p>The Bear’ın bu bölümündeki kaos sadece mutfakla ilgili değildi. Aslında çökmekte olan bir sistem ve tükenmekte olan insanlar anlatılıyordu.<br> Sahnelerin teknik kavramlarla örtüştüğünü göstermek kolaydı; ancak mutfağı kaosa sürükleyen şey sadece yanlış sipariş akışı ya da bozuk bir protokol değildi.</p><p>Orada — her teknik problemin arkasında olduğu gibi — yorulan insanlar, sıkışan duygular ve kırılan egolar vardı.<br> Bir sistem aşırı yük altında ezilebilir; bir ekip de öyle.</p><p>Sydney’in yalnızlığı, iş yetişmediğinde içimizde yükselen sessiz çığlığın aynasıydı:<br> “Bu kadar yükün altında tek başıma mı savaşmak zorundayım?”</p><p>Richie’nin bağırışları, sadece bir kural hatırlatması değildi; görülme isteğinin, çaresizliğin ve kontrolden çıkmış bir thread’in sesine benziyordu.</p><p>Carmy’nin öfkesi ise kaptanın gözlerimizin önünde batmakta olan bir gemiyi, tek başına su tahliye ederek kurtarmaya çalışmasına benziyordu.</p><p>Ve burada, hepimizin çok iyi bildiği o gerçek tüm çıplaklığıyla ortaya çıkıyor:</p><blockquote>Sistemler çökebilir. İnsanlar kırılabilir.<br>Üstelik çoğu zaman önce insanlar yorulur — sistem ise onların peşi sıra düşer.</blockquote><h4>❤️ Son Bir Not</h4><p>The Bear sadece mutfak stresini anlatmıyor. Aslında hepimize çok tanıdık bir şeyler fısıldıyor:</p><blockquote><strong>“Hepimiz bir şeyler yapmaya, eksik şeyleri düzeltmeye çalışıyoruz.<br> Bazen de başaramıyoruz.<br> Ve bu da normal.”</strong></blockquote><p>Yazılımda da böyle. İşte bu yüzden bu dizi bölümünün her sahnesi bir teknik kavrama dönüşebiliyor:</p><ul><li>Sipariş patlaması → <strong>Backpressure &amp; Overflow</strong></li><li>Sydney’nin yalnızlığı → <strong>Worker Pool Bottleneck</strong></li><li>“Corner!” → <strong>Race Condition Önleme Protokolü</strong></li><li>Richie &amp; Carmen kilitlenmesi → <strong>Deadlock, Starvation, Priority Inversion</strong></li><li>Carmy’nin kırılma anı→ <strong>Graceful Shutdown’ın yapılamaması</strong></li></ul><p>Bu bölüm sadece dramatik değildi. Bize hem sistemlerin hem insanların benzer şekilde çöktüğünü hatırlatan bir ders niteliğindeydi.</p><p>Ve unutmamak gerekir ki: <strong><em>Every second counts!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50f9b7f33104" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevOps of the Caribbean]]></title>
            <link>https://yasinbabaoglu.medium.com/devops-of-the-caribbean-6205e9cdaeee?source=rss-49b3d5a41807------2</link>
            <guid isPermaLink="false">https://medium.com/p/6205e9cdaeee</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[pirates-of-the-caribbean]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[sofware-engineering]]></category>
            <dc:creator><![CDATA[Yasin Babaoğlu]]></dc:creator>
            <pubDate>Mon, 18 Aug 2025 18:48:13 GMT</pubDate>
            <atom:updated>2025-08-19T05:54:42.799Z</atom:updated>
            <content:encoded><![CDATA[<p><em>An analogy between DevOps concepts and The Pirates of the Caribbean.</em></p><p>I’ve always found that connecting concepts I struggle with to something I enjoy — like movies — helps me understand them better. I’ve been fascinated by the DevOps ecosystem for a while, but every new term confuses me. So I decided to chart a map of the seas of DevOps, using the adventurous world of pirates as my compass. I hope it’ll be useful.</p><p>Aye aye, Captain ⚓</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xEWSva7ZOhQ8LERBiNQpqA.jpeg" /></figure><h3>🏴‍☠️ The DevOps Caribbean — Full Crew &amp; Fleet</h3><h4>1- Docker Image — The Ship’s Blueprints</h4><blockquote>“The Black Pearl… the fastest ship in the Caribbean.”<em> — Norrington</em></blockquote><p>A Docker image is the blueprint of the ship: the hull, sails, cannons, and every plank. It contains all instructions to build the ship — but it’s not sailing yet, it’s just the plan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AtpnPxTF6i8GWoTZ_bk1Lw.jpeg" /><figcaption>A part of real model ship plan of The Black Pearl (<a href="https://www.shipmodell.com/index_files/0PLAN1B.html">https://www.shipmodell.com/index_files/0PLAN1B.html</a>)</figcaption></figure><h4>2- Docker Container — The Ship in the Water</h4><blockquote>“This ship is freedom.”<em> — Jack Sparrow</em></blockquote><p>Once you build the ship from the image, it becomes a container — alive and afloat, ready to sail with crew aboard, cannons primed, and rum in the hold.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5hJy6XUzNZ8mAF3-lUkIbA.jpeg" /></figure><h4>3- Container Registry — The Naval Shipyard / Treasure Vault</h4><blockquote>“Not all treasure is silver and gold, mate.”<em> — Jack Sparrow</em></blockquote><p>Where do we keep blueprints or pre-built ships? In a registry — Docker Hub (the King’s shipyards) or a private vault (like Shipwreck Cove). Captains fetch ship plans from here before setting sail.</p><h4>4- Pod — A Small Flotilla Sailing Together</h4><blockquote>“Did everyone see that? Because I will not be doing it again.” <em>— Jack Sparrow</em></blockquote><p>A pod is the smallest group you send in Kubernetes. It can host one or a few tightly coupled containers — like a flotilla of ships sailing in coordination.</p><h4>5- Node — The Island or Port Where Ships Rest</h4><blockquote>“Gentlemen, what do keys do?”<em> — Jack Sparrow</em></blockquote><p>Nodes are islands or ports where pods dock. Worker nodes host ships, while the master node charts the fleet’s movements.</p><h4>6- Namespaces — Pirate Factions</h4><blockquote>“The brethren court is meeting!”<em> — Tia Dalma</em></blockquote><p>Namespaces isolate resources, like factions of pirates keeping to their own waters: the Brethren Court, the East India Company, or Barbossa’s cursed crew.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*N0j3ZyjasSz2sOlh9ktO_g.jpeg" /></figure><h4>7- ReplicaSet — Clones of Ships</h4><blockquote>“You better start believing in ghost stories, Miss Turner, you’re in one!” <em>— Hector Barbossa</em></blockquote><p>Ships may sink, but ReplicaSets ensure replacements are ready. Want three Black Pearls? Kubernetes keeps three afloat, no matter what Davy Jones tries.</p><h4>8- Deployment — The Captain’s Orders</h4><blockquote>“Bring me that horizon.”<em> — Jack Sparrow</em></blockquote><p>A Deployment is a long-term order: “Keep five ships patrolling Tortuga.” Kubernetes enforces it — replacing, launching, and maintaining ships according to your orders.</p><h4>9- DaemonSet — One Ship Per Island</h4><blockquote>“Every man has a debt to pay.”<em> — Davy Jones</em></blockquote><p>A DaemonSet ensures that every node has a copy of a specific container — like one cursed ship guarding each island.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q_s-SJS2jOsnnO7e4FFkoA.jpeg" /></figure><h4>10- Kubernetes — Beckett’s Armada</h4><blockquote>“Fortune has clearly brought us here.” <em>— Captain Barbossa</em></blockquote><p>Kubernetes commands entire fleets. It orchestrates ships, replaces sunk ones, shifts them across seas, and keeps squadrons patrolling — all without steering each ship individually.</p><h4>11- Helm — Tia Dalma’s Enchanted Charts</h4><blockquote>“Would you love me if I was anything but what I am?”<em> — Tia Dalma</em></blockquote><p>Helm is magical deployment scrolls. Hand over the charts, and your fleet sails exactly as foretold. Other captains can call fleets using the same maps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*Hb9feeksFtja3rwi0DJo2g.jpeg" /></figure><h4>12- Service — Tortuga’s Harbor Master</h4><blockquote>“It’s the shrunken, rotting heart of piracy.”<em> — Norrington</em></blockquote><p>In chaos, sailors always find a ship. Services ensure traffic reaches the right containers, no matter which pod is afloat.</p><h4>13- Ingress — Shipwreck Cove’s Gate</h4><blockquote>“The Code is the law.”<em> — Captain Teague</em></blockquote><p>Ingress controls access to the cove, routing sailors to the correct dock and keeping unworthy ships at bay with signals and TLS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*c4Vpk_5xvNNxbzwuQuYqhw.jpeg" /></figure><h4>14- ConfigMaps &amp; Secrets — Maps &amp; the Dead Man’s Chest</h4><blockquote>“Do you fear death?”<em> — Davy Jones</em></blockquote><p>ConfigMaps hold public knowledge, like sea charts. Secrets guard precious, deadly information — like the Chest with Jones’s heart — accessible only to those with the key.</p><h4>15- Persistent Volumes — Hidden Treasure Coves</h4><blockquote>“The gold calls to us.”<em> — Barbossa</em></blockquote><p>Ships may sink, but treasure in secret coves remains. Persistent Volumes keep your data safe, even if containers are destroyed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*Pzf1lOATfGL4iCL9lPNWvA.jpeg" /></figure><h4>16- CI/CD — Gibbs’s Shipyard</h4><blockquote>“Take what ye can, give nothing back.”<em> — Pirate Code</em></blockquote><p>Gibbs builds, patches, and readies the Pearl after each battle. CI/CD pipelines automate building, testing, and deploying containers — ensuring new voyages are ready at a moment’s notice.</p><h4>17- Monitoring &amp; Logging — Spyglasses &amp; Ship Logs</h4><blockquote>“You’ve seen it with your own eyes, you know what waits for you.”<em> — Barbossa</em></blockquote><p>Spyglasses (Prometheus, Grafana) reveal the seas ahead. Logs (ELK stack) record every cannon shot and course change, letting you retrace the voyage if disaster strikes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*EGQLVnUzujPPwcSIRB-Buw.jpeg" /></figure><h4>18- Auto-Scaling — Call More Ships</h4><blockquote>“It’s not just a keel and a hull and a deck and sails. That’s what a ship needs. But what a ship is… is freedom.”<em> — Jack Sparrow</em></blockquote><p>Calm seas? Two sloops suffice. Stormy waters? Call ten men-of-war. Auto-scaling deploys more containers as needed, then scales down when the battle is won.</p><h4>19 -Load Balancer — Port Royal’s Docks</h4><blockquote>“If you were waiting for the opportune moment… that was it.”<em> — Jack Sparrow</em></blockquote><p>The dockmaster prevents crowding by spreading ships across docks. Load balancers distribute traffic across containers, keeping the fleet balanced.</p><h4>20- Network Policies — The Pirate Code</h4><blockquote>“The code is more what you’d call ‘guidelines’ than actual rules.”<em> — Barbossa</em></blockquote><p>Pirates follow rules for communication, signaling, and attacks. Network policies control which containers can talk to each other, just like the Pirate Code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*alSQmc08Qu5OYTmcl6AsLA.jpeg" /></figure><h4>21- Pod Disruption Budgets — Seas Never Left Unguarded</h4><blockquote>“It’s not just about living forever, Jackie. The trick is living with yourself forever.”<em> — Barbossa</em></blockquote><p>Even when ships return for repair, some must remain on patrol. Kubernetes ensures minimum pods stay afloat, guarding vital routes while others are updated.</p><p>⚓ <strong>Thus, the DevOps seas run like the Caribbean:</strong><br>Docker’s yer Pearl, Compose yer small raiding squad, Kubernetes yer global armada, Helm yer witchcraft charts, Services yer Tortuga harbor, and Ingress the gates o’ Shipwreck Cove. Configs, Secrets, Logs, Scaling — all be part o’ the pirate life, mate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*282dnE1SMqttmHKTauxCBg.jpeg" /></figure><p>Fair winds and full sails, Captain. 🏴‍☠️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6205e9cdaeee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Requiem for a Codebase : The Silent Addiction of Technical Debt]]></title>
            <link>https://yasinbabaoglu.medium.com/requiem-for-a-codebase-the-silent-addiction-of-technical-debt-deea8485ba26?source=rss-49b3d5a41807------2</link>
            <guid isPermaLink="false">https://medium.com/p/deea8485ba26</guid>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[developer-life]]></category>
            <category><![CDATA[technical-debt]]></category>
            <category><![CDATA[refactoring]]></category>
            <dc:creator><![CDATA[Yasin Babaoğlu]]></dc:creator>
            <pubDate>Tue, 15 Jul 2025 12:36:37 GMT</pubDate>
            <atom:updated>2025-07-15T12:42:28.845Z</atom:updated>
            <content:encoded><![CDATA[<h3>Requiem for a Codebase : The Silent Addiction of Technical Debt</h3><p><em>A tragedy of a codebase that begins with small compromises and ends in architectural collapse.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aprJt4aL7RAJqe1G4NVI7Q.png" /></figure><h3>🎬 Prologue : First dose is always the worst.</h3><blockquote>“I’m somebody now, Harry. Everybody likes me.” — Sara Goldfarb</blockquote><p>It always starts like this.<br>A new project, a new idea, or a clean repo.<br>Small achievements, fast deliveries… Fast development cycles that make you say “I’m somebody now.”</p><p>But every hastily added solution, every “we’ll refactor this later” promise — that’s the first dose. That comforting lie: “Doing it once won’t hurt.”</p><p>Just like Sara wants to get into her red dress, a developer may choose to get into a working but unhealthy codebase. Maybe existing codebase is complicated and touching a little piece of code can cause unexpected problems or designing a well-defined, modular, easily maintainable and understandable codebase takes far more time than expected.</p><p>I mean, the window is already broken. No matter if anyone breaks other parts of the window.</p><p>Dreams: user satisfaction, fast deployment, a great MVP.<br>Realities: technical debt that grows with dependency.</p><h3><strong>🧪 1. The First Dose: “Let’s just do it this way for now.”</strong></h3><p>🧱 <em>This stage aligns with the Broken Window Theory</em><a href="https://blog.codinghorror.com/the-broken-window-theory/">[1]</a><em>: small issues left unattended invite further neglect. Once a team sees messy code being accepted, it becomes easier to write more of it.</em></p><blockquote>“We got a winner! We got a winner!” — Tappy Tibbons</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zv6pFj4A7ntBn16UDlO3hw.png" /></figure><p>Sara looks in the mirror wearing her red dress. Bright lights, cameras, her dream of being on television… Everything seems perfect in her own mind. The temporary euphoria of the pills is enough to escape reality. But it doesn’t last long — reality always knocks.</p><p>Just like Sara, a software team completing their first sprint feels victorious. The core features are working, the customer is happy, “We made it!” they say. But the shortcuts taken in that rush eventually grow into massive problems.</p><pre>if (user.Country == &quot;TR&quot;) {<br>    ApplyValueAddedTax(0.18);<br>} else if (user.Country == &quot;DE&quot;) {<br>    ApplyValueAddedTax(0.19);<br>}<br>// TODO: add other countries later</pre><p>That tiny <strong>TODO</strong> didn&#39;t seem to matter. There was a deadline, delivery was crucial. The developer saw the code work and felt relief. The tester whispered, “No time to test properly, but we’ll probably be okay.” The team collectively ignored the small compromise.</p><h3>🧠 Mental State:</h3><ul><li>Developer feels like a hero, happy with the quick solution.</li><li>Tester is uneasy under time pressure.</li><li>The team is tired but content; unaware of what’s coming.</li></ul><h3>⚠️ Lesson:</h3><ul><li>Every “we’ll fix it later” is the first dose of technical debt.</li><li>Progressing with hard-coded logic over strategy makes the system harder to evolve.</li></ul><p>📖 <em>In Clean Code, Robert C. Martin states that “code is not written once and left to live forever.” Accepting code as a living organism means every choice requires accountability.</em></p><h3>💊 2. Rising Tolerance: “As long as this module doesn’t break, we’re fine.”</h3><blockquote>“I’m gonna be on television.” — Sara (repeating to herself)</blockquote><figure><img alt="https://www.imdb.com/title/tt0180093/mediaviewer/rm2813661440/?ref_=ext_shr_lnk" src="https://cdn-images-1.medium.com/max/1024/1*ipOLYwZ0PwBsSqRR0BdoVw.png" /></figure><p>Time passes. The code grows. That initial painless rush is sought again. The developer tries to meet new demands while patching old fixes. Every solution becomes a workaround for the last one. The code piles up on itself.</p><pre>try {<br>    ProcessPayment(order);<br>} catch(Exception ex) {<br>    LogError(ex);<br>    // No response to user, silent failure<br>}</pre><ul><li>Errors are swallowed. When the system breaks, no one notices.</li><li>Often new code is created to preserve the old rather than to be innovative.</li></ul><h3>🧠 Mental State:</h3><ul><li>Developer is stressed, the system feels fragile.</li><li>Tester faces a codebase too expanded to test properly.</li><li>The team says, “Just don’t break it,” instead of improving it.</li></ul><h3>⚠️ Lesson:</h3><ul><li>Silent failures (like exception swallowing) are the cancer of systems.</li><li>Skipping test coverage accelerates debt instead of solving it.</li></ul><p>📖 <em>Clean Code emphasizes thoughtful exception handling. Catching an error without resolving it adds uncertainty rather than stability.</em></p><h3>💥 3. Collapse: The Code Can’t Take It. Neither Can the People.</h3><blockquote>“No, no, no. I’m going to be on television!” — Sara (shouts)</blockquote><blockquote>“But you’re not. You need help.” — Psychiatrist</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oi67OXTHOZ_zQoxAAwCpfQ.png" /></figure><p>The system has collapsed. The code has become a mudball. One method handles a dozen responsibilities. Changing anything breaks everything else.</p><pre>public void ProcessOrder(Order order) {<br>    Validate(order);<br>    UpdateInventory(order.Items);<br>    SaveOrder(order);<br>    Notify(order.User);<br>    // And more... all in one place<br>}</pre><h3>🧠 Mental State:</h3><ul><li>Developer is hopeless: “No one can understand this code.”</li><li>Tester avoids testing: “Any change breaks everything.”</li><li>New developers burn out quickly during onboarding.</li></ul><h3>⚠️ Lesson:</h3><ul><li>God Objects and God Methods are red flags for system failure.</li><li>Systems that can’t be refactored are too risky to rewrite.</li></ul><p>📖 <em>Clean Code’s “Single Responsibility Principle” insists each method should do only one thing. Otherwise, maintenance and testing collapse.</em></p><h3>⛱️ 4. No Return: Rewrite or Requiem?</h3><blockquote>“Purple in the morning, blue in the afternoon, orange in the evening. There’s my three meals, Mr. Smartypants. And green at night. Just like that, one, two, three, four” — Sara (lost in repetition)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*StkgKK1U_e0HCDc_WzdniQ.jpeg" /></figure><p>The codebase is now stuck in loops. Same bugs, same files, same refactor requests… But no one dares touch it. The idea of rewriting is too frightening. Outwardly functional, inwardly broken.</p><h3>🧠 Mental State:</h3><ul><li>Developer only writes “hotfixes,” no creativity remains.</li><li>The team is in permanent firefighting mode.</li><li>Culture: no one feels ownership over the system.</li></ul><h3>⚠️ Lesson:</h3><ul><li>Rewrites can be a cure — but only with transparency and planning.</li><li>Ignoring technical debt long enough turns it into an organizational blind spot.</li></ul><p>📖 <em>Clean Code recommends understanding before rewriting. Large rewrites usually fail because existing knowledge is lost.</em></p><h3>🌐 Finale: Every shortcut leaves a scar.</h3><blockquote><strong>Marion</strong>: I love you Harry. You make me feel like a person.</blockquote><blockquote><strong>Harry</strong>: Marion, you are the most beautiful girl in the world. You are my dream.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*54ioOxSAwFxn9i4SQctkmA.jpeg" /></figure><p>Codebases are like people. They begin with hope, then drift slowly. Small dependencies become the gateway to collapse.</p><p>Requiem for a Codebase is not just a tale of technical failure — it’s an requiem for the people behind it.</p><h3>📚 Further Reading:</h3><ul><li><em>The Broken Window Theory Explained</em> — <a href="https://en.wikipedia.org/wiki/Broken_windows_theory">https://en.wikipedia.org/wiki/Broken_windows_theory</a></li><li><em>The Broken Window Theory in Code</em>, Coding Horror — <a href="https://blog.codinghorror.com/the-broken-window-theory/">https://blog.codinghorror.com/the-broken-window-theory/</a></li><li><em>Clean Code: A Handbook of Agile Software Craftsmanship</em>, Robert C. Martin — <a href="https://www.goodreads.com/book/show/3735293-clean-code">https://www.goodreads.com/book/show/3735293-clean-code</a></li><li><em>Refactoring: Improving the Design of Existing Code</em>, Martin Fowler — <a href="https://refactoring.com/">https://refactoring.com/</a></li><li><em>Technical Debt Quadrant</em>, Martin Fowler — <a href="https://martinfowler.com/bliki/TechnicalDebtQuadrant.html">https://martinfowler.com/bliki/TechnicalDebtQuadrant.html</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=deea8485ba26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Lie to Myself: Understanding Event Sourcing Through Memento]]></title>
            <link>https://yasinbabaoglu.medium.com/i-lie-to-myself-understanding-event-sourcing-through-memento-6d69099eff5a?source=rss-49b3d5a41807------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d69099eff5a</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[event-sourcing]]></category>
            <category><![CDATA[cqrs]]></category>
            <dc:creator><![CDATA[Yasin Babaoğlu]]></dc:creator>
            <pubDate>Wed, 30 Apr 2025 11:49:56 GMT</pubDate>
            <atom:updated>2025-04-30T11:49:56.989Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gxBNR8uHWcAHCEHYhZUrXw.png" /></figure><blockquote>“I have this condition… I can’t make new memories.” — Leonard Shelby, Memento (2000)</blockquote><p>Christopher Nolan’s Memento isn’t just a psychological thriller, it’s a surprisingly perfect metaphor for a powerful software design pattern: <strong>Event Sourcing.</strong></p><p>In this article, we’ll explore how Leonard Shelby’s journey to reconstruct the truth about his past mirrors how systems using event sourcing reconstruct state through events. We’ll walk through the key ideas of event sourcing and projections — assuming CQRS is already applied — using Memento as a mental model.</p><h3>🧠 Meet Leonard — the Stateless System</h3><p>Leonard suffers from <a href="https://www.yalemedicine.org/clinical-keywords/anterograde-amnesia">anterograde amnesia</a>: he can’t make new short term memories. To navigate the world, he tattoos important facts on his body and takes Polaroid photos annotated with sharpie. He doesn’t “know” his current situation; he infers it from the data he’s gathered.</p><p>In software terms, Leonard is an event sourced system:</p><ul><li>He doesn’t store state directly.</li><li>He persists a log of immutable events (tattoos, photos, notes).</li><li>He builds up temporary understanding — or projections — from those events.</li></ul><h3>⚡️ Domain Events as Leonard’s Life Logs</h3><p>So we need domain events for reconstructing Leonard’s memories. Let’s define events based on what Leonard actually does in the movie:</p><pre>public interface ILeonardEvent<br>{<br>    DateTime When { get; }<br>}<br><br>public record Tattooed(string Fact) : ILeonardEvent<br>{<br>    public DateTime When { get; init; } = DateTime.UtcNow;<br>}<br><br>public record TookPolaroid(string PersonName, string Note) : ILeonardEvent<br>{<br>    public DateTime When { get; init; } = DateTime.UtcNow;<br>}<br><br>public record CrossedOutPolaroid(string PersonName) : ILeonardEvent<br>{<br>    public DateTime When { get; init; } = DateTime.UtcNow;<br>}</pre><p>Each of these events, something Leonard physically did to try to remember that form his immutable event log.</p><h3>🏗️ Leonard’s Memory Reconstruction</h3><p>Leonard’s inability to make new memories forces him to rebuild his understanding every time he wakes up. This is similar to how systems rebuild their state by replaying events.</p><pre>public class LeonardBrain<br>{<br>    public List&lt;string&gt; Tattoos { get; private set; } = new();<br>    public Dictionary&lt;string, string&gt; Polaroids { get; private set; } = new();<br>    <br>    public void Apply(ILeonardEvent leonardEvent)<br>    {<br>        switch (leonardEvent)<br>        {<br>            case Tattooed t:<br>                Tattoos.Add(t.Fact);<br>                break;<br><br>            case TookPolaroid p:<br>                Polaroids[p.PersonName] = p.Note;<br>                break;<br><br>            case CrossedOutPolaroid c:<br>                if (Polaroids.ContainsKey(c.PersonName))<br>                    Polaroids[c.PersonName] = &quot;[CROSSED OUT]&quot;;<br>                break;<br>        }<br>    }<br><br>    public void Replay(IEnumerable&lt;ILeonardEvent&gt; events)<br>    {<br>        foreach (var e in events)<br>            Apply(e);<br>    }<br>}</pre><p>Each time Leonard “wakes up”, he reconstructs his mental model from events, not unlike how systems apply event streams to recreate state.</p><h3>📝 Notes &amp; 📸 Polaroids = Projections</h3><p>Leonard can’t remember his memories. But when he looks at a Polaroid with “DON’T TRUST HIS LIES” scribbled on it, he immediately acts on it. The photo is not the truth, but it’s the projection — a cached view derived from past events.</p><p>In software, we use projections to generate fast, queryable read models based on domain events. These projections can be asynchronously updated.</p><pre>public class LeonardPolaroidProjection<br>{<br>    private readonly Dictionary&lt;string, string&gt; _projection = new();<br><br>    public void Apply(ILeonardEvent leonardEvent)<br>    {<br>        switch (leonardEvent)<br>        {<br>            case TookPolaroid p:<br>                _projection[p.PersonName] = p.Note;<br>                break;<br><br>            case CrossedOutPolaroid c:<br>                if (_projection.ContainsKey(c.PersonName))<br>                    _projection[c.PersonName] = &quot;[CROSSED OUT]&quot;;<br>                break;<br>        }<br>    }<br>}</pre><p>Leonard uses these artifacts to make instant decisions, just like how applications use projections, instead of querying the full event log each time.</p><h3>🤯 Flawed Logic — When Projections Mislead</h3><p>Sometimes, Leonard trusts a note that was based on a lie. This is equivalent to projections being corrupted or built from incorrect data. The source of truth — the events — remain correct, but the interpretation is faulty.</p><p>This is why it’s crucial that:</p><ul><li>His read model is wrong.</li><li>He kills the wrong man because the projection was built on false or incomplete events.</li><li>Events are immutable and stored reliably.</li><li>Projections can be rebuilt if errors are discovered.</li></ul><pre>public void RebuildProjections()<br>{<br>    var events = eventStore.GetEventsFor(&quot;Leonard&quot;);<br>    foreach (var e in events)<br>        projectionEngine.Apply(e);<br>}</pre><p>This highlights why <strong>replaying events</strong> or tracing causality is crucial in event sourced systems.</p><h3>📦 Rebuilding Leonard’s Reality with Marten + MediatR</h3><p>Here’s how we wire it with MediatR and Marten:</p><pre>public record GetLeonardRealityQuery(string StreamId) : IRequest&lt;LeonardBrain&gt;;<br><br>public class GetLeonardRealityHandler : IRequestHandler&lt;GetLeonardRealityQuery, LeonardBrain&gt;<br>{<br>    private readonly IDocumentStore _store;<br><br>    public GetLeonardRealityHandler(IDocumentStore store)<br>    {<br>        _store = store;<br>    }<br><br>    public async Task&lt;LeonardBrain&gt; Handle(GetLeonardRealityQuery request, CancellationToken cancellationToken)<br>    {<br>        var session = _store.LightweightSession();<br>        var events = await session.Events.FetchStreamAsync&lt;ILeonardEvent&gt;(request.StreamId, token: cancellationToken);<br>        <br>        var brain = new LeonardBrain();<br>        brain.Replay(events);<br><br>        return brain;<br>    }<br>}</pre><p>Just like Leonard starts over when he wakes up, this logic always reconstructs state from the raw, event log.</p><h3>🔄 Replaying History, Fixing Mistakes</h3><p>Leonard sometimes realizes a mistake, maybe he trusted someone he shouldn’t have. If he had the full history of events, he could reevaluate from scratch. That’s exactly what we do in event sourcing:</p><ul><li>Detect the wrong projection.</li><li>Reset.</li><li>Rebuild from events.</li></ul><pre>public async Task ReplayLeonardsLife(string streamId)<br>{<br>    var events = await documentStore.Events.FetchStreamAsync&lt;ILeonardEvent&gt;(streamId);<br>    var leonard = new LeonardBrain();<br>    leonard.Replay(events);<br><br>    Console.WriteLine(&quot;Tattooed Truths:&quot;);<br>    foreach (var fact in leonard.Tattoos)<br>        Console.WriteLine($&quot;- {fact}&quot;);<br><br>    Console.WriteLine(&quot;\nPolaroids:&quot;);<br>    foreach (var photo in leonard.Polaroids)<br>        Console.WriteLine($&quot;{photo.Key}: {photo.Value}&quot;);<br>}</pre><p>This is your “morning routine” — like Leonard piecing together what he believes after a night’s sleep.</p><h3>🧭 Analogy Wrap Up</h3><ul><li>Memento Element ➡️ Event Sourcing Equivalent</li><li>TattooImmutable ➡️ Domain Event</li><li>Polaroid with Notes ➡️ Read Projection</li><li>Crossed Out Polaroid ️➡️ Compensating EventScene</li><li>Playback ➡️ Event Replay</li><li>Forgetting Current State ➡️ Stateless Aggregate</li><li>Truth Hidden in Events ➡️ Audit Trail</li></ul><h3>🧵 Final Thoughts</h3><p>Leonard’s fragmented memory is a powerful metaphor for how systems can reconstruct truth without storing current state, by persisting the facts of what happened.</p><p>In event sourcing:</p><ul><li>Events are the source of truth</li><li>Projections are transient, disposable, and regenerable</li><li>Replay builds trustable state from immutable facts</li></ul><p>Just like Leonard, we lie to ourselves when we trust the present more than the past.</p><blockquote>“You don’t want the truth. You make up your own truth.”</blockquote><p>That’s why we event source. To never lose the truth again.</p><h3>🎭 Memento Mori: Memory and the Philosophy of Event Sourcing</h3><p>Event sourcing isn’t just a technical pattern, it’s a philosophical perspective. <em>Memento</em> asks: If you can’t trust memory, can you still find meaning in your story? Event sourcing asks the same question onto our systems: <em>If we don’t trust mutable state, can we still build reliable software?</em></p><p>Leonard’s identity is a product of the events he records, not what he currently <strong>knows</strong>. Similarly, an event sourced system derives its identity from the events it has persisted. The past is the only reliable source of truth.</p><p>This approach is emphasised with the concept of <strong>Memento Mori</strong> — remember that you will die/forget — remember that you must reconstruct. In both film and code, memory is fallible. But events are forever.</p><p>📽️Inspired by the storytelling of Memento, and the elegance of event sourcing</p><h4>🖋️ Resources:</h4><ul><li><a href="https://learn.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/domain-events-design-implementation">https://learn.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/domain-events-design-implementation</a></li><li><a href="https://martendb.io/events/projections/rebuilding.html">https://martendb.io/events/projections/rebuilding.html</a></li><li><a href="https://martendb.io/events/projections/async-daemon.html">https://martendb.io/events/projections/async-daemon.html</a></li><li><a href="https://martendb.io/events/learning.html">https://martendb.io/events/learning.html</a></li><li><a href="https://www.codemag.com/Article/2209071/Event-Sourcing-and-CQRS-with-Marten">https://www.codemag.com/Article/2209071/Event-Sourcing-and-CQRS-with-Marten</a></li><li><a href="https://dev.to/pbouillon/publishing-domain-events-with-mediatr-32mm">https://dev.to/pbouillon/publishing-domain-events-with-mediatr-32mm</a></li><li><a href="https://www.imdb.com/title/tt0209144/">https://www.imdb.com/title/tt0209144/</a></li><li><a href="https://www.rogerebert.com/reviews/memento-2001">https://www.rogerebert.com/reviews/memento-2001</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d69099eff5a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Human-Centric Principles of Software Engineering]]></title>
            <link>https://yasinbabaoglu.medium.com/human-centric-principles-of-software-engineering-78ef76363e62?source=rss-49b3d5a41807------2</link>
            <guid isPermaLink="false">https://medium.com/p/78ef76363e62</guid>
            <category><![CDATA[ethics]]></category>
            <category><![CDATA[humbleness]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Yasin Babaoğlu]]></dc:creator>
            <pubDate>Wed, 29 Jan 2025 14:28:33 GMT</pubDate>
            <atom:updated>2025-01-29T14:28:33.601Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VazVzyuMrt-HSkY8" /></figure><p>In software engineering, we often talk about “technical” principles and rules that focus on performance, scalability, and optimization. While these are important, there’s another side to software development that’s just as crucial: human-centered principles. These principles focus on teamwork, creativity, empathy, and sustainable practices, which help create software that’s not only effective but also easy to maintain. When combined with humility, these principles form a strong approach to building meaningful solutions.</p><p>With over 10 years of experience as an engineer, I’ve seen how balancing technical skills with thoughtful, sustainable practices and humility leads to better software and stronger teams. Here are some of the keys and principles I’ve learned over the years.</p><h3>1. Empathy-Driven Development</h3><blockquote>“If the rule you followed brought you to this, of what use was the rule?” — No Country for Old Men (2007)</blockquote><p>Understanding and focusing on user needs is key to creating meaningful software. Empathy-driven development can be applied at different stages of the development process. During design, it’s about making user-friendly and easy-to-use interfaces by involving users in tests and feedback sessions. In testing, it’s about simulating real-world situations to make sure the software meets various needs. After launch, it’s about listening to user feedback and improving the product based on their experiences and issues. By always keeping the user’s perspective in mind, teams can create solutions that truly address challenges and improve satisfaction.</p><ul><li><strong><em>Why it Matters:</em></strong> Users often struggle with complex software. Understanding their pain points helps deliver a better experience.</li><li><strong><em>How to Practice: </em></strong>Conduct user interviews, observe user behavior, and continuously gather feedback to improve the user experience.</li></ul><h3>2. Collaboration Over Isolation</h3><blockquote>“The force will be with you. Always.” — Star Wars: Episode IV — A New Hope (1977)</blockquote><p>Software engineering works best when teams collaborate. Open communication between developers, designers, testers, and stakeholders leads to better results. This can be done through daily stand-up meetings where everyone shares their progress and challenges, and by using shared platforms like Confluence or Notion to keep all team information in one place. Regular cross-functional meetings and teamwork on solving problems also make sure that everyone’s input is heard and everyone is working toward the same goals.</p><ul><li><strong><em>Why it Matters:</em></strong> Working alone can lead to a narrow focus, where important issues are overlooked. Without feedback from others, it’s easy to miss different perspectives or potential errors in the work. Collaboration helps identify these blind spots and encourages a more thorough approach to solving problems. When team members share their ideas and insights, it leads to better decisions and stronger solutions.</li><li><strong><em>How to Practice: </em></strong>Pair programming allows two developers to work together, helping them share knowledge and spot mistakes early. Regular code reviews provide opportunities for team members to check each other’s work, ensuring it meets quality standards. Collaborative problem-solving sessions encourage the team to share ideas and find more effective solutions together. These practices contribute to better teamwork, improved code quality, and fewer overlooked issues.</li></ul><h3>3. Continuous Feedback Loops</h3><blockquote>“If you keep making the same mistakes, you’ll keep getting the same results.” — Deadpool 2 (2018)</blockquote><p>In the world of software development, progress is not just about delivering a product; it’s about ensuring that the product continually improves over time to meet user needs and expectations. This is where <strong>continuous feedback loops</strong> come into play. By consistently seeking input from both users and team members, teams can make incremental improvements, adapt to changing requirements, and mitigate potential issues early in the development process.</p><ul><li><strong><em>Why it Matters:</em></strong> Feedback is an invaluable tool in the development lifecycle because it helps teams catch potential issues early — before they snowball into more significant, costly problems. Without continuous feedback, teams run the risk of developing a product that fails to meet the needs of its users or lacks functionality critical to its success. Early feedback serves as a checkpoint, ensuring that development is moving in the right direction and that the product is aligned with user expectations and business goals.</li><li><strong><em>How to Practice:</em></strong> Sprint reviews are a key agile ceremony that involves the development team, product owners, and sometimes stakeholders. This is where feedback on the latest iteration is gathered and used to refine the next sprint’s goals. A sprint retrospective, on the other hand, allows the team to reflect on their process and identify improvements for future work. Both practices promote an environment of continuous improvement, where feedback from all team members (and even users) is actively sought and used to guide development.</li></ul><h3>4. Simplicity as a Core Value (KISS)</h3><blockquote>“The beauty of this is its simplicity. Once a plan gets too complex, everything can go wrong.” — Walter Sobchak, ‘The Big Lebowski’ (1998)</blockquote><p>The “Keep It Simple, Stupid” principle reminds us that simplicity leads to better maintainability.</p><ul><li><strong><em>Why it Matters:</em></strong> Over-engineering can quickly lead to <strong>technical debt</strong>, where complex solutions require more effort to maintain, debug, and enhance in the future. Simplicity helps to reduce this burden by ensuring that code and design remain clean, understandable, and manageable, allowing for faster iteration and easier troubleshooting.</li><li><strong><em>How to Practice:</em></strong> <br> <strong><em>— Favor Straightforward Solutions :</em></strong> Choose the simplest solution that meets the requirements without overcomplicating the design or implementation. Simple code is easier to read, test, and modify, which makes it easier to onboard new team members and respond to changing requirements.<br> <strong><em>— Avoid Unnecessary Complexity : </em></strong>Resist the temptation to add features or implement overly complex solutions that aren’t needed. Unnecessary complexity increases the likelihood of bugs and makes the system harder to maintain and scale.<br> <strong><em>— Follow Design Principles Like SOLID : </em></strong>Adhering to principles such as <strong>SOLID</strong> can help simplify code by promoting clear separation of concerns, modularity, and reusability. Each part of the system should serve a clear purpose, without overlapping responsibilities that could complicate things.<br> <strong><em>— Refactor Regularly :</em></strong> Make time for regular code refactoring to keep the codebase clean, remove redundant elements, and ensure that the solution remains simple as the project evolves. Refactoring ensures that technical debt doesn’t accumulate over time.<br><strong><em> — Favor Readability and Maintainability : </em></strong>Write code that’s easy for others (or your future self) to understand. Prioritize clear naming conventions, concise functions, and logical structures to make it easier to debug and enhance the code in the future.</li></ul><h3>5. Human-Centered Code Design</h3><blockquote>“This is not ‘Nam, this is bowling. There are rules.”— Walter Sobchak, The Big Lebowski (1998)</blockquote><p>This focuses on writing code that’s easy for future developers to understand, maintain, and update. Code shouldn’t just work; it should be clear so that anyone (including your future self) can easily figure it out. Well-written code makes it easier to find bugs, add features, and keep the code consistent. By following best practices and keeping the code clean, you’re helping ensure the project’s long-term success.</p><ul><li><strong><em>Why it Matters:</em></strong> Code is read far more often than it is written. Poorly written or unclear code can lead to confusion, wasted time, and errors down the road. Clear and maintainable code ensures that future changes can be made more efficiently, reducing technical debt.</li><li><strong><em>How to Practice:</em></strong> Use meaningful variable names, clear comments, and maintain a logical structure. Break down complex logic into smaller functions, keep functions concise, and avoid deep nesting. Ensure your code follows consistent formatting conventions to improve readability and foster teamwork.</li></ul><h3>6. Respect for Craftsmanship</h3><blockquote>“Sometimes it’s the very people who no one imagines anything of who do the things that no one can imagine.” — The Imitation Game (2014)</blockquote><p>Building software that is not just functional but also elegant and efficient reflects respect for the craft. Elegant software is characterized by simplicity, clarity, and maintainability without sacrificing performance. It addresses problems effectively while remaining adaptable for future requirements. Striking a balance between elegance and performance involves thoughtful architecture, optimization where necessary, and avoiding premature complexity. This can be achieved by writing clean, modular code, conducting regular refactoring sessions, and always prioritizing readability alongside performance gains.</p><ul><li><strong><em>Why it Matters: </em></strong>Craftsmanship leads to higher quality and more sustainable software. It makes the software easier to scale, debug, and maintain, ultimately resulting in a better experience for both developers and end-users. The elegance of your solution reflects your commitment to building something that stands the test of time.</li><li><strong><em>How to Practice:</em></strong> Invest time in code reviews, refactoring, and staying updated with best practices. Encourage collaboration and peer feedback to ensure that the code adheres to high standards. Focus on writing modular, reusable code to make future changes easier, and regularly assess areas for performance optimization without compromising readability.</li></ul><h3>7. Sustainability</h3><blockquote>“What we do in life echoes in eternity.” — Gladiator (2000)</blockquote><p>Creating software with future maintenance in mind helps ensure it long-lived. Just like building a strong foundation for a structure, sustainable software is designed to last and grow over time. By focusing on clean code, scalability, and adaptability, developers can reduce the risk of technical debt and make it easier for future teams to maintain and improve the system. Sustainable practices aren’t just about avoiding problems; they set the project up for long-term success and make changes easier. This approach can also lead to more stable releases and a smoother development process.</p><ul><li><strong><em>Why it Matters:</em></strong> Sustainable practices reduce technical debt and long-term costs. As software grows and evolves, unsustainable design choices can accumulate, leading to more effort and resources spent on fixing issues rather than adding value. By emphasizing sustainability, you prevent the need for costly reworks and ensure a more manageable development process in the long run.</li><li><strong><em>How to Practice: <br> — Document code thoroughly: </em></strong>Clear and concise documentation makes it easier for future developers to understand your design decisions and logic, reducing time spent figuring out how the system works.<br> <strong><em>— Design systems that can evolve: </em></strong>Use modular architecture, maintain loose coupling, and keep interfaces flexible. This allows you to make changes and add features without disrupting the core of the system.<br> <strong><em>— Write tests: </em></strong>Comprehensive testing ensures that as the software evolves, existing functionality remains intact and bugs are caught early.</li></ul><h3>8. Ethics First</h3><blockquote>“With great power comes great responsibility.” — Spider-Man (2002)</blockquote><p>Responsible software development respects privacy, reduces bias, and serves society in a positive way. Ethical software development is about creating technology that benefits users, fosters trust, and protects individuals’ rights. It involves more than just meeting technical requirements; it’s about making choices that prioritize the well-being of users and society. Ensuring privacy, reducing bias, and promoting inclusivity in design are fundamental aspects of ethical software that contribute to a fairer, more transparent digital world.</p><ul><li><strong><em>Why it Matters: </em></strong>Ethical software builds trust and mitigates harm. When developers prioritize ethics in their work, they create software that users feel confident in, knowing their data is secure, their needs are considered, and their rights are respected. This trust is critical for long-term success and user satisfaction.</li><li><strong><em>How to Practice: </em></strong>Consider data privacy, accessibility, and inclusive design from the outset. For data privacy, developers should follow best practices such as encryption, secure authentication mechanisms, and compliance with legal frameworks like the General Data Protection Regulation (GDPR).</li></ul><h3>9. Avoiding Burnout</h3><blockquote>“It’s not how many times you get knocked down that count, it’s how many times you get back up.” — Rocky Balboa (2006)</blockquote><p>Sustainable work practices are key to both long-term success and maintaining our mental well-being. Burnout is a real challenge that can drain our energy, increase stress, and lower job satisfaction. To prevent this, it’s important to adopt a balanced approach to work. This means setting realistic goals, managing our workloads thoughtfully, and creating a supportive environment where mental health is prioritized. By focusing on well-being, we not only improve our productivity but also build a healthier, more fulfilling work life.</p><ul><li><strong><em>Why it Matters:</em></strong> Burnout leads to decreased productivity, health issues, and job dissatisfaction. It affects not only individual performance but also team morale and overall business success. Long-term, unresolved burnout can result in serious physical and emotional health problems, which impact both the individual and the organization.</li><li><strong><em>How to Practice:</em></strong> <br> <strong><em>— Set realistic goals: </em></strong>Avoid overwhelming yourself or your team with unrealistic expectations. Break larger goals into smaller, achievable tasks.<br> <strong><em>— Prioritize work-life balance:</em></strong> Ensure that there is time for rest and personal activities outside of work.<br><strong><em> — Take regular breaks:</em></strong> Incorporate techniques like the Pomodoro method to stay focused and prevent mental exhaustion.<br><strong><em> — Normalize seeking help: </em></strong>Encourage an open, supportive environment where asking for assistance is seen as a proactive and smart approach, not a weakness.</li></ul><h3>10. Joyful Development</h3><blockquote>“Because you didn’t come here to make the choice, you’ve already made it. You’re here to try to understand why you made it.” — The Oracle, The Matrix Reloaded(2003)</blockquote><p>Creating a culture where creativity and enthusiasm thrive is essential for reducing burnout and promoting innovation. When teams feel supported and encouraged, they’re more likely to bring fresh ideas, stay motivated, and contribute to a positive, energetic work atmosphere. Fostering joy in the workplace doesn’t just mean avoiding burnout; it also means creating a space where individuals can thrive, experiment, and truly enjoy the process of developing great software.</p><p>When teams are joyful, they’re not just happier — they’re also more productive and innovative. A culture that celebrates creativity and embraces positivity can lead to breakthrough ideas, better problem-solving, and more efficient collaboration. A joyful environment empowers individuals to take risks, try new things, and ultimately create better, more exciting products.</p><ul><li><strong><em>Why it Matters:</em></strong> Joyful teams are more productive and innovative. When employees feel supported and valued, they’re more likely to engage fully with their work, leading to higher quality outcomes, better solutions, and a more positive company culture. Additionally, a happy, engaged team is more resilient to stress and challenges.</li><li><strong><em>How to Practice:</em></strong> Supporting work-life balance can help team members recharge and return to work with fresh energy. Celebrating small wins creates a sense of progress and helps maintain a positive atmosphere. Building a supportive environment, where open communication, empathy, and mutual respect are valued, can make collaboration feel natural. In this kind of environment, asking for help becomes a strength, making the team more resilient, productive, and innovative.</li></ul><h3>Conclusion: “The Dude abides”</h3><p>Software engineering is not just about algorithms and data structures; it’s about building solutions that positively impact people’s lives. By embracing human-centric principles and maintaining humility as engineers, we can create software that is not only functional but meaningful. It’s about designing products that are intuitive, inclusive, and serve the needs of real people. Combining technical rigor with empathy, collaboration, and continuous learning paves the way for sustainable, joyful, and impactful development. It’s easy to get caught up in the technical aspects, but the true reward comes from knowing that your work can make someone’s day easier, safer, or more enjoyable. The best software is born from deep understanding, active listening, and the courage to challenge the status quo in the pursuit of something better. In the end, our ability to connect with others and adapt to the world around us defines the lasting impact of the technology we create.</p><p>Follow me on LinkedIn: <a href="https://www.linkedin.com/in/yasinbabaoglu/">https://www.linkedin.com/in/yasinbabaoglu</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78ef76363e62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Sicily to Software: SOLID Lessons from The Godfather]]></title>
            <link>https://yasinbabaoglu.medium.com/from-sicily-to-software-solid-lessons-from-the-godfather-4004c932eaee?source=rss-49b3d5a41807------2</link>
            <guid isPermaLink="false">https://medium.com/p/4004c932eaee</guid>
            <category><![CDATA[sofware-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[solid]]></category>
            <category><![CDATA[godfather]]></category>
            <category><![CDATA[oop]]></category>
            <dc:creator><![CDATA[Yasin Babaoğlu]]></dc:creator>
            <pubDate>Mon, 09 Dec 2024 12:18:37 GMT</pubDate>
            <atom:updated>2024-12-09T13:03:22.603Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nd/4.0/</cc:license>
            <content:encoded><![CDATA[<p>I believe that analogy is a powerful approach for understanding complex or abstract concepts. By relating unfamiliar ideas to real-world examples, we can simplify them and make them more engaging. This is why, in this article, I’ve chosen to explain the SOLID principles using The Godfather movie.</p><p>As we know, the word SOLID is an acronym that stands for five essential principles of object-oriented software design. Each letter represents a different concept, but together they create a strong foundation for building robust and maintainable systems. What’s even more fascinating is that the structure, roles, and values found in The Godfather align perfectly with these principles. By drawing parallels between Vito Corleone’s leadership and the key concepts of SOLID, we can gain a deeper understanding of both the theory behind software design and the power of effective organizational structure.</p><p>As I mentioned on title, I tried to explain SOLID principles with The Godfather movie.</p><h3><strong>1) Single Responsibility Principle (SRP)</strong></h3><blockquote>“Don’t ever take sides against the family again.”<br> — The Godfather by Mario Puzo</blockquote><p><strong><em>Definition: </em></strong>Each class or module should have only one reason to change, focusing on a single responsibility.</p><p><strong><em>Godfather Analogy:</em></strong> In the Corleone family, each member has a specific role:</p><ul><li><strong>Tom Hagen (Consigliere):</strong> Provides legal and strategic advice.</li><li><strong>Clemenza and Tessio (Caporegimes):</strong> Manage street-level operations and execute orders.</li><li><strong>Sonny and Michael:</strong> Handle leadership or specific family disputes.</li></ul><p>This structure ensures that each member focuses on their own responsibilities, avoiding overlap or inefficiency. Similarly, in software, separating responsibilities makes the system easier to manage and extend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*882EIwxX31VMqH_VHi6stA.jpeg" /></figure><pre>class Don{<br>    leadFamily(): void {<br>        console.log(&quot;Leading the family...&quot;);<br>    }<br><br>    makeHimAnOfferHeCantRefuse():void{<br>        console.log(&quot;I&#39;m gonna make him an offer he can&#39;t refuse!&quot;)<br>    }<br>}<br><br>class Consigliere {<br>    provideAdvice(): void {<br>        console.log(&quot;Strategic advice is provided.&quot;);<br>    }<br>}<br><br>class Caporegime {<br>    executeOrders(): void {<br>        console.log(&quot;Carrying out orders in the field.&quot;);<br>    }<br>}</pre><blockquote>Each class focuses on its own mission. Tom Hagen doesn’t do the work on the field; Clemenza doesn’t strategize.</blockquote><h3>2) Open/Closed Principle (OCP)</h3><blockquote>“The strength of a family, like the strength of an army, lies in its loyalty to each other.”<br> — The Godfather by Mario Puzo</blockquote><p><strong><em>Definition:</em></strong><em> </em>Classes should be open for extension but closed for modification.</p><p><strong><em>Godfather Analogy:</em> </strong>When Vito Corleone steps down, Michael Corleone takes over without altering the foundational structure of the family. Michael implements new strategies while keeping the core values and hierarchy intact. Similarly, in software, extending functionality without modifying existing code ensures stability and scalability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*bEGizLoe2hRB6imdORxjTg.jpeg" /></figure><pre>class Don {<br>    leadFamily(): void {<br>        console.log(&quot;Leading the family...&quot;);<br>    }<br>}<br><br>class MichaelCorleone extends Don {<br>    leadFamily(): void {<br>        console.log(&quot;Leading with a new strategy.&quot;);<br>    }<br>}<br><br>function startLeadership(don: Don) {<br>    don.leadFamily();<br>}<br><br>const vito = new Don();<br>const michael = new MichaelCorleone();<br><br>startLeadership(vito);<br>startLeadership(michael);</pre><blockquote>Don Vito hands over the leadership role to Michael. The new leadership style is expanded without changing the existing system. Although Michael’s methods are different, the leadership process continues uninterrupted.</blockquote><h3>3) Liskov Substitution Principle (LSP)</h3><blockquote>“Never tell anybody outside the family what you’re thinking again.”<br> — The Godfather by Mario Puzo</blockquote><p><strong><em>Definition:</em></strong> Objects of a superclass should be replaceable with objects of a subclass without altering the correctness of the program.</p><p><strong><em>Godfather Analogy:</em> </strong>Michael steps into the role of Don seamlessly after Vito retires. The family continues to function as before because the leadership structure and decision-making process are consistent. In software, subclasses should replace their parent classes without breaking the system’s behavior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GIbsgA6XVrnHwrjeavLr8A.jpeg" /></figure><pre>class FamilyMember {<br>    actOnBehalf(): void {<br>        console.log(&quot;Acting on behalf of the family.&quot;);<br>    }<br>}<br><br>class Don extends FamilyMember {<br>    actOnBehalf(): void {<br>        console.log(&quot;Leading and making high-level decisions.&quot;);<br>    }<br>}<br><br>class Caporegime extends FamilyMember {<br>    actOnBehalf(): void {<br>        console.log(&quot;Executing orders in the field.&quot;);<br>    }<br>}<br><br>function representFamily(member: FamilyMember) {<br>    member.actOnBehalf();<br>}<br><br>const vito = new Don();<br>const clemenza = new Caporegime();<br><br>representFamily(vito);<br>representFamily(clemenza);</pre><blockquote>Don Vito or Clemenza act in different roles on behalf of the family, each serving the general function of “representing the family” but doing so in their own way.</blockquote><h3>4) Interface Segregation Principle (ISP)</h3><blockquote>“I’m gonna make him an offer he can’t refuse.”<br> — The Godfather by Mario Puzo</blockquote><p><strong><em>Definition: </em></strong>Clients should not be forced to depend on methods they do not use.</p><p><strong><em>Godfather Analogy: </em></strong>Each role in the family has distinct responsibilities:</p><ul><li><strong>Vito Corleone </strong>manages the family and ensures that every member of the family and his associates only handle tasks specific to their expertise, avoiding unnecessary overlap or confusion</li><li><strong>Tom Hagen</strong> deals only with legal and political issues.</li><li><strong>Clemenza and Tessio</strong> focus on tactical operations.</li><li><strong>Michael Corleone </strong>is<strong> </strong>initially outside the family business but later takes on leadership when strategically necessary.</li><li><strong>Soldiers</strong> handle specific tasks like enforcement or protection.</li></ul><p>Nobody is overloaded with unrelated responsibilities, ensuring efficiency. Similarly, in software, designing focused interfaces prevents unnecessary dependencies and promotes modularity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*d5kwWvQ54NkQAKPesrPI2w.jpeg" /></figure><pre>interface Strategic {<br>    provideAdvice(): void;<br>}<br><br>interface Operational {<br>    executeOrders(): void;<br>}<br><br>class Consigliere implements Strategic {<br>    provideAdvice(): void {<br>        console.log(&quot;Providing strategic advice.&quot;);<br>    }<br>}<br><br>class Caporegime implements Operational {<br>    executeOrders(): void {<br>        console.log(&quot;Executing orders in the field.&quot;);<br>    }<br>}</pre><blockquote>Each class gets only the features it needs.</blockquote><h3><strong>5) Dependency Inversion Principle (DIP)</strong></h3><blockquote>“It’s not personal, Sonny. It’s strictly business.”<br> — The Godfather by Mario Puzo</blockquote><p><strong><em>Definition:</em></strong> High-level modules should not depend on low-level modules. Both should depend on abstractions.</p><p><strong><em>Godfather Analogy:</em> </strong>The Don Vito Corleone(high-level module) sets the overall vision and strategy but doesn’t micromanage operations. Instead, he relies on caporegimes and soldiers (low-level modules) to execute plans based on abstract directives like “protect the family” or “expand operations.” In software, this principle ensures that high-level policies remain independent of lower-level implementation details, creating a flexible and maintainable system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8lkg9NesizOkgrirl69SYw.jpeg" /></figure><pre>interface Leadership {<br>    lead(): void;<br>}<br><br>class DonVito implements Leadership {<br>    lead(): void {<br>        console.log(&quot;Leading the family with traditional methods.&quot;);<br>    }<br>}<br><br>class DonMichael implements Leadership {<br>    lead(): void {<br>        console.log(&quot;Leading the family with new strategies.&quot;);<br>    }<br>}<br><br>class Family {<br>    private leader: Leadership;<br><br>    constructor(leader: Leadership) {<br>        this.leader = leader;<br>    }<br><br>    operate(): void {<br>        this.leader.lead();<br>    }<br>}<br><br>const vito = new DonVito();<br>const michael = new DonMichael();<br><br>const corleoneFamily = new Family(vito);<br>corleoneFamily.operate();<br><br>const modernFamily = new Family(michael);<br>modernFamily.operate();</pre><blockquote>The family organization (Family class) is not dependent on the concrete details of the leaders (DonVito or DonMichael). No matter which leader is there, the family can continue to function. This provides independence between strategy and operations.</blockquote><h3>Conclusion: The Family Code of SOLID Principles</h3><p>Much like the Corleone family, software systems thrive when built on structure, clarity, and resilience. The SOLID principles mirror the careful organization and delegation seen in <em>The Godfather</em>: responsibilities are clearly defined, adaptability is encouraged without compromising stability, and roles operate independently yet harmoniously under a guiding abstraction.</p><p>From Vito’s strategic leadership (DIP) to the focused tasks of his consiglieres and caporegimes (SRP and ISP), the Corleone family’s success was rooted in its ability to balance order and flexibility — qualities that are equally vital in creating robust, maintainable software systems.</p><p>By applying the lessons of SOLID principles to your software design, you can build systems that are as enduring and effective as the Corleone legacy: prepared for challenges, resilient to change, and capable of growth. As Vito Corleone himself might say, <em>“</em><strong><em>Build your system on principles, and it will make you an offer you can’t refuse.”</em></strong></p><p>Follow me on LinkedIn: <a href="https://www.linkedin.com/in/yasinbabaoglu/">https://www.linkedin.com/in/yasinbabaoglu</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4004c932eaee" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>