<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Java &amp; Software Architecture Knowledge Hub</title><link>https://samirsahoo.github.io/design-patterns-hub/</link><description>Recent content on Java &amp; Software Architecture Knowledge Hub</description><generator>Hugo</generator><language>en-US</language><copyright>© 2026 Samir Kumar Sahoo (https://github.com/samirsahoo). All rights reserved.</copyright><atom:link href="https://samirsahoo.github.io/design-patterns-hub/index.xml" rel="self" type="application/rss+xml"/><item><title>Abstract Factory Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/creational/abstract-factory/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/creational/abstract-factory/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Abstract Factory&lt;/strong&gt; pattern provides one interface for creating a &lt;strong&gt;family of related objects&lt;/strong&gt;. Client code asks the factory for each object it needs and never names a concrete class, so a whole family can be swapped by swapping one factory.&lt;/p&gt;</description></item><item><title>Adapter vs Decorator vs Proxy vs Facade</title><link>https://samirsahoo.github.io/design-patterns-hub/comparisons/adapter-decorator-proxy-facade/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/comparisons/adapter-decorator-proxy-facade/</guid><description>&lt;h2 id="the-deciding-question"&gt;The deciding question&lt;a class="heading-anchor" href="#the-deciding-question" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;All four patterns put an object in front of another object. They differ in &lt;strong&gt;why&lt;/strong&gt;:&lt;/p&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Pattern&lt;/th&gt;&#10; &lt;th&gt;The wrapper exists to…&lt;/th&gt;&#10; &lt;th&gt;Interface towards the client&lt;/th&gt;&#10; &lt;th&gt;Wraps&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Adapter&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;&lt;em&gt;translate&lt;/em&gt; an incompatible interface&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Different&lt;/strong&gt; from the wrapped object&amp;rsquo;s&lt;/td&gt;&#10; &lt;td&gt;One object&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Decorator&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;&lt;em&gt;add&lt;/em&gt; behaviour while keeping the interface&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Same&lt;/strong&gt; as the wrapped object&amp;rsquo;s&lt;/td&gt;&#10; &lt;td&gt;One object (stackable)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Proxy&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;&lt;em&gt;control access&lt;/em&gt; to the real object&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Same&lt;/strong&gt; as the real object&amp;rsquo;s&lt;/td&gt;&#10; &lt;td&gt;One object&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Facade&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;&lt;em&gt;simplify&lt;/em&gt; a complex subsystem&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;New&lt;/strong&gt;, simpler interface&lt;/td&gt;&#10; &lt;td&gt;Many objects&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;aside class="callout callout--key" role="note"&gt;&#10; &lt;p class="callout__title"&gt;&lt;span class="callout__label"&gt;Key concept&lt;/span&gt;&lt;span class="callout__heading"&gt;Ask two questions&lt;/span&gt;&lt;/p&gt;&#10; &lt;div class="callout__body"&gt;&lt;ol&gt;&#10;&lt;li&gt;Does the client see the &lt;strong&gt;same interface&lt;/strong&gt; as the wrapped object? If not, it is an Adapter or a Facade.&lt;/li&gt;&#10;&lt;li&gt;Is the purpose to &lt;strong&gt;add behaviour&lt;/strong&gt; (Decorator), &lt;strong&gt;control access&lt;/strong&gt; (Proxy), &lt;strong&gt;translate&lt;/strong&gt; (Adapter) or &lt;strong&gt;simplify&lt;/strong&gt; (Facade)?&lt;/li&gt;&#10;&lt;/ol&gt;&lt;/div&gt;&#10;&lt;/aside&gt;</description></item><item><title>Spring Boot Auto-Configuration and @ConditionalOn* Annotations</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/boot/auto-configuration-and-conditions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/boot/auto-configuration-and-conditions/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Auto-configuration&lt;/strong&gt; is Spring Boot&amp;rsquo;s mechanism for registering &lt;strong&gt;sensible default beans&lt;/strong&gt; based on what is on the classpath, which beans you have already defined, and your properties. Each default is guarded by &lt;strong&gt;conditions&lt;/strong&gt; (&lt;code&gt;@ConditionalOn…&lt;/code&gt;), so it &lt;strong&gt;backs off&lt;/strong&gt; as soon as you configure your own.&lt;/p&gt;</description></item><item><title>What Is a Bounded Context?</title><link>https://samirsahoo.github.io/design-patterns-hub/domain-driven-design/strategic/bounded-context/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/domain-driven-design/strategic/bounded-context/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;bounded context&lt;/strong&gt; is an explicit boundary within which a particular domain model applies, and within which every term in the ubiquitous language has exactly one meaning.&lt;/p&gt;&#10;&lt;p&gt;Outside the boundary, the same word may mean something else, and that is acceptable. The boundary makes the difference explicit instead of leaving it hidden in one overloaded class.&lt;/p&gt;</description></item><item><title>Circuit Breakers and Resilience with Resilience4j</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/reliability/circuit-breakers-and-resilience4j/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/reliability/circuit-breakers-and-resilience4j/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Resilience patterns&lt;/strong&gt; stop one slow or failing dependency from taking down the services that call it:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;timeouts&lt;/strong&gt; bound waiting&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;retries&lt;/strong&gt; absorb transient errors&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;circuit breakers&lt;/strong&gt; fail fast while a dependency is unhealthy&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;bulkheads&lt;/strong&gt; isolate resources&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;rate limiters&lt;/strong&gt; control load.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;strong&gt;Resilience4j&lt;/strong&gt; is the standard Java library for these patterns, integrated with Spring Boot.&lt;/p&gt;</description></item><item><title>Domain-Driven Design Fundamentals</title><link>https://samirsahoo.github.io/design-patterns-hub/domain-driven-design/fundamentals/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/domain-driven-design/fundamentals/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Domain-Driven Design (DDD)&lt;/strong&gt; is an approach to building software for complex business domains. Its central idea is that the structure and language of the code should match the business it serves, and that developers and domain experts should build that model together.&lt;/p&gt;</description></item><item><title>Dependency Injection in Java</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/core/dependency-injection/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/core/dependency-injection/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Dependency injection (DI)&lt;/strong&gt; means an object receives the objects it works with — its &lt;em&gt;dependencies&lt;/em&gt; — from outside, instead of creating or looking them up itself.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-java" data-lang="java"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Without DI: the service decides which notifier it uses.&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;final&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Notifier&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;notifier&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;EmailNotifier&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// With DI: whoever creates the service decides.&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;OrderService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Notifier&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;notifier&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;notifier&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;notifier&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That is the entire idea. Frameworks such as Spring automate the wiring, but DI itself needs no framework.&lt;/p&gt;</description></item><item><title>Event-Driven Microservices with Spring Cloud Stream, Kafka and RabbitMQ</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/communication/event-driven-spring-cloud-stream/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/communication/event-driven-spring-cloud-stream/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;In an &lt;strong&gt;event-driven architecture&lt;/strong&gt;, services &lt;strong&gt;publish events&lt;/strong&gt; (facts such as &lt;code&gt;OrderPlaced&lt;/code&gt;) to a &lt;strong&gt;message broker&lt;/strong&gt;, and other services &lt;strong&gt;consume&lt;/strong&gt; them asynchronously. &lt;strong&gt;Spring Cloud Stream&lt;/strong&gt; lets you write producers and consumers as plain Java &lt;strong&gt;functions&lt;/strong&gt;, bound to &lt;strong&gt;Kafka&lt;/strong&gt;, &lt;strong&gt;RabbitMQ&lt;/strong&gt; or other brokers through &lt;strong&gt;binders&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Introduction to Software Architecture</title><link>https://samirsahoo.github.io/design-patterns-hub/software-architecture/introduction/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/software-architecture/introduction/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Software architecture&lt;/strong&gt; is the set of significant decisions about how a system is structured: its main parts, how they relate, how they communicate, and the principles that guide its evolution. &amp;ldquo;Significant&amp;rdquo; means &lt;em&gt;expensive to change later&lt;/em&gt;.&lt;/p&gt;</description></item><item><title>Introduction to System Design</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;System design&lt;/strong&gt; is the process of turning a set of requirements into an architecture — components, data, interfaces and their interactions — that meets those requirements at the expected scale, and that you can explain and defend.&lt;/p&gt;</description></item><item><title>Java Developer Fundamentals</title><link>https://samirsahoo.github.io/design-patterns-hub/learning-paths/java-developer-fundamentals/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/learning-paths/java-developer-fundamentals/</guid><description>&lt;p&gt;This path covers the language and platform. Steps marked &lt;strong&gt;Planned&lt;/strong&gt; are scheduled for upcoming batches; until then, the linked articles cover the design side of the path.&lt;/p&gt;</description></item><item><title>The Java Memory Model and Happens-Before</title><link>https://samirsahoo.github.io/design-patterns-hub/java/advanced/java-memory-model/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/advanced/java-memory-model/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Java Memory Model (JMM)&lt;/strong&gt;, defined in chapter 17 of the Java Language Specification, specifies &lt;strong&gt;when a write made by one thread is guaranteed to be visible to another&lt;/strong&gt;. It defines a &lt;strong&gt;happens-before&lt;/strong&gt; relation: if action A happens-before action B, then B sees A&amp;rsquo;s effects.&lt;/p&gt;</description></item><item><title>Layered versus Hexagonal Architecture</title><link>https://samirsahoo.github.io/design-patterns-hub/hexagonal-architecture/layered-vs-hexagonal/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/hexagonal-architecture/layered-vs-hexagonal/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Layered architecture&lt;/strong&gt; stacks the code in horizontal layers — typically presentation, business and data access. Each layer calls the layer below it, so dependencies point &lt;strong&gt;down, towards the database&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Hexagonal Architecture&lt;/strong&gt;, also called &lt;strong&gt;Ports and Adapters&lt;/strong&gt; (Alistair Cockburn, 2005), puts the business logic at the centre. The core defines &lt;strong&gt;ports&lt;/strong&gt; — interfaces in its own terms — and technology-specific &lt;strong&gt;adapters&lt;/strong&gt; plug into them from outside. All dependencies point &lt;strong&gt;inwards, towards the business logic&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The difference is one word: &lt;em&gt;direction&lt;/em&gt;. That single change has large consequences for testing and for changing technology.&lt;/p&gt;</description></item><item><title>Microservices versus Modular Monolith</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/fundamentals/microservices-vs-modular-monolith/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/fundamentals/microservices-vs-modular-monolith/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Style&lt;/th&gt;&#10; &lt;th&gt;Deployment units&lt;/th&gt;&#10; &lt;th&gt;Internal boundaries&lt;/th&gt;&#10; &lt;th&gt;Data&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Monolith&lt;/strong&gt; (unstructured)&lt;/td&gt;&#10; &lt;td&gt;One&lt;/td&gt;&#10; &lt;td&gt;Weak or none&lt;/td&gt;&#10; &lt;td&gt;One shared schema, accessed from anywhere&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Modular monolith&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;One&lt;/td&gt;&#10; &lt;td&gt;Strong, enforced module boundaries aligned with business capabilities&lt;/td&gt;&#10; &lt;td&gt;One database, but each module owns its tables&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Microservices&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Many, independently deployable&lt;/td&gt;&#10; &lt;td&gt;Enforced by the network&lt;/td&gt;&#10; &lt;td&gt;Each service owns its database&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;A &lt;strong&gt;modular monolith&lt;/strong&gt; is a single deployable application divided internally into modules with explicit interfaces and private internals. &lt;strong&gt;Microservices&lt;/strong&gt; take the same idea further: each module becomes a separately deployed process, owned by one team, with its own data store.&lt;/p&gt;</description></item><item><title>Distributed Tracing and Observability with Micrometer and OpenTelemetry</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/operations/observability-micrometer-opentelemetry/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/operations/observability-micrometer-opentelemetry/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Observability&lt;/strong&gt; is the ability to understand what a system is doing from its outputs:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;metrics&lt;/strong&gt;: numbers over time&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;traces&lt;/strong&gt;: the path of one request across services&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt;: discrete events with context.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;In Spring Boot, &lt;strong&gt;Micrometer&lt;/strong&gt; instruments the code once (the &lt;strong&gt;Observation API&lt;/strong&gt;). &lt;strong&gt;OpenTelemetry (OTel)&lt;/strong&gt; is the vendor-neutral standard for exporting telemetry over &lt;strong&gt;OTLP&lt;/strong&gt; to any backend.&lt;/p&gt;</description></item><item><title>Designing an Order Management System</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/order-management-system/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/order-management-system/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This case study designs the system that takes a customer&amp;rsquo;s order in an online shop, reserves stock, takes payment and hands the order to fulfilment. It follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt; and reuses the retail domain from the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/domain-driven-design/fundamentals/"&gt;DDD articles&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Quick Check: Java, Spring and Microservices</title><link>https://samirsahoo.github.io/design-patterns-hub/self-review/quick-check/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/self-review/quick-check/</guid><description>&lt;p&gt;Answers are short, just enough to check your understanding. Each section links to the full articles.&lt;/p&gt;&#10;&lt;aside class="callout callout--tip" role="note"&gt;&#10; &lt;p class="callout__title"&gt;&lt;span class="callout__label"&gt;Tip&lt;/span&gt;&lt;span class="callout__heading"&gt;How to use this page&lt;/span&gt;&lt;/p&gt;&#10; &lt;div class="callout__body"&gt;&lt;p&gt;Cover the answer, explain it in your own words, then compare. Mark anything you hesitated on and reread the linked article. Aim for 80% before moving on.&lt;/p&gt;&lt;/div&gt;&#10;&lt;/aside&gt;</description></item><item><title>Reliability, Scalability and Maintainability</title><link>https://samirsahoo.github.io/design-patterns-hub/data-systems/reliability-scalability-maintainability/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/data-systems/reliability-scalability-maintainability/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Applications today are usually &lt;strong&gt;data-intensive&lt;/strong&gt; rather than compute-intensive: the hard problems are the amount of data, its complexity and how fast it changes. Such applications are assembled from standard building blocks — databases, caches, search indexes, stream processors, batch jobs — and the application code that glues them together.&lt;/p&gt;</description></item><item><title>Saga Pattern: Choreography versus Orchestration</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/saga-pattern/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/saga-pattern/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;saga&lt;/strong&gt; is a sequence of &lt;strong&gt;local transactions&lt;/strong&gt;, one per service. Each step commits in its own database and triggers the next. If a step fails, the saga runs &lt;strong&gt;compensating transactions&lt;/strong&gt; that semantically undo the steps already completed. Sagas give microservices business-level consistency without a distributed transaction.&lt;/p&gt;</description></item><item><title>Scaling from Zero to Millions of Users</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/scaling-from-zero-to-millions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/scaling-from-zero-to-millions/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Large systems are not designed large on day one. They &lt;strong&gt;evolve&lt;/strong&gt;, one bottleneck at a time. This page walks through the standard sequence of steps that take a web application from a single server to millions of users. Each step removes one limit and adds some complexity — and knowing &lt;em&gt;why&lt;/em&gt; each step exists is what system design interviews test.&lt;/p&gt;</description></item><item><title>Spring Security Architecture: The Security Filter Chain</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/security/security-filter-chain/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/security/security-filter-chain/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Spring Security&lt;/strong&gt; protects applications with a chain of &lt;strong&gt;servlet filters&lt;/strong&gt; that runs &lt;strong&gt;before&lt;/strong&gt; your controllers. The filters &lt;strong&gt;authenticate&lt;/strong&gt; the caller (who are you?), store the result in a &lt;strong&gt;&lt;code&gt;SecurityContext&lt;/code&gt;&lt;/strong&gt;, and &lt;strong&gt;authorize&lt;/strong&gt; the request (are you allowed?). It is configured with one or more &lt;strong&gt;&lt;code&gt;SecurityFilterChain&lt;/code&gt;&lt;/strong&gt; beans.&lt;/p&gt;</description></item><item><title>Spring Data JPA and the Hibernate ORM Lifecycle</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/data/spring-data-jpa-and-hibernate/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/data/spring-data-jpa-and-hibernate/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;JPA (Jakarta Persistence)&lt;/strong&gt; is the standard Java API for object-relational mapping: annotated &lt;strong&gt;entities&lt;/strong&gt; are mapped to tables and managed by an &lt;strong&gt;&lt;code&gt;EntityManager&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Hibernate&lt;/strong&gt; is the most widely used JPA implementation.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Spring Data JPA&lt;/strong&gt; sits on top and generates &lt;strong&gt;repositories&lt;/strong&gt;, so you rarely write &lt;code&gt;EntityManager&lt;/code&gt; code yourself.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Hand-written JDBC means mapping rows to objects, tracking what changed and writing every INSERT and UPDATE yourself. ORMs automate that, but their &lt;strong&gt;automatic behaviours&lt;/strong&gt; (caching, dirty checking, lazy loading, flush timing) surprise teams that do not understand the &lt;strong&gt;persistence context&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Spring MVC Architecture: DispatcherServlet, Handler Mappings and Controllers</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/web/spring-mvc-architecture/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/web/spring-mvc-architecture/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Spring MVC&lt;/strong&gt; is Spring&amp;rsquo;s servlet-based web framework. One servlet, the &lt;strong&gt;&lt;code&gt;DispatcherServlet&lt;/code&gt;&lt;/strong&gt; (a &lt;em&gt;front controller&lt;/em&gt;), receives every request and delegates to pluggable components. They find the right controller method, convert input, call it and write the response.&lt;/p&gt;</description></item><item><title>Unit Testing with JUnit and Mockito</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/production/unit-testing-junit-mockito/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/production/unit-testing-junit-mockito/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;unit test&lt;/strong&gt; checks one small piece of behaviour (a class or a few collaborating classes) &lt;strong&gt;in isolation&lt;/strong&gt;, quickly, with no Spring context, database or network. &lt;strong&gt;JUnit&lt;/strong&gt; runs the tests. &lt;strong&gt;Mockito&lt;/strong&gt; creates &lt;strong&gt;test doubles&lt;/strong&gt; for collaborators you do not want to involve.&lt;/p&gt;</description></item><item><title>What Are Design Patterns?</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/what-are-design-patterns/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/what-are-design-patterns/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;design pattern&lt;/strong&gt; is a named, proven solution to a problem that keeps recurring in software design. It is described at the level of roles and relationships, not as finished code.&lt;/p&gt;&#10;&lt;p&gt;A pattern is not a library you download. It is closer to a recipe that experienced developers recognise: &amp;ldquo;when you face &lt;em&gt;this&lt;/em&gt; situation, arranging objects like &lt;em&gt;this&lt;/em&gt; tends to work, and here is what it costs.&amp;rdquo;&lt;/p&gt;</description></item><item><title>Inversion of Control: ApplicationContext and BeanFactory</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/core/applicationcontext-and-beanfactory/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/core/applicationcontext-and-beanfactory/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Inversion of Control (IoC)&lt;/strong&gt; means your objects do not create or look up their collaborators: a &lt;strong&gt;container&lt;/strong&gt; creates them, wires them and manages their lifecycle. In Spring, that container is the &lt;strong&gt;&lt;code&gt;ApplicationContext&lt;/code&gt;&lt;/strong&gt;, built on the lower-level &lt;strong&gt;&lt;code&gt;BeanFactory&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Data Models and Query Languages</title><link>https://samirsahoo.github.io/design-patterns-hub/data-systems/data-models-and-query-languages/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/data-systems/data-models-and-query-languages/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;data model&lt;/strong&gt; is the shape in which an application stores and thinks about its data: tables of rows, nested documents, or a graph of vertices and edges. It is one of the most important design decisions because it shapes not only how the software is written but &lt;strong&gt;how we think about the problem&lt;/strong&gt;. Each layer of a system represents data in terms of the layer below (objects → JSON or tables → bytes → electrical signals), and each layer hides the complexity beneath it.&lt;/p&gt;</description></item><item><title>Design Patterns</title><link>https://samirsahoo.github.io/design-patterns-hub/learning-paths/design-patterns/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/learning-paths/design-patterns/</guid><description>&lt;p&gt;Read the first two steps in order. After that, you can read the pattern articles in any order — each lists its own prerequisites.&lt;/p&gt;</description></item><item><title>Diagram Building Blocks for System Design</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/diagram-patterns/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/diagram-patterns/</guid><description>&lt;h2 id="how-to-use-this-page"&gt;How to use this page&lt;a class="heading-anchor" href="#how-to-use-this-page" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Each building block below has:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;a &lt;strong&gt;Mermaid snippet&lt;/strong&gt; you can copy into an article (view the page source in the repository for the exact text);&lt;/li&gt;&#10;&lt;li&gt;the component&amp;rsquo;s &lt;strong&gt;responsibility&lt;/strong&gt;;&lt;/li&gt;&#10;&lt;li&gt;its typical &lt;strong&gt;failure modes&lt;/strong&gt;;&lt;/li&gt;&#10;&lt;li&gt;the main &lt;strong&gt;trade-off&lt;/strong&gt; to mention.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The notation is consistent across this handbook:&lt;/p&gt;</description></item><item><title>Externalized Configuration and @ConfigurationProperties</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/boot/externalized-configuration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/boot/externalized-configuration/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Externalized configuration&lt;/strong&gt; keeps environment-specific values (URLs, credentials, limits, feature flags) &lt;strong&gt;outside the code&lt;/strong&gt;, so the &lt;strong&gt;same artifact&lt;/strong&gt; runs in development, test and production. Spring Boot merges many &lt;strong&gt;property sources&lt;/strong&gt; into one &lt;code&gt;Environment&lt;/code&gt;, and binds values into type-safe objects with &lt;strong&gt;&lt;code&gt;@ConfigurationProperties&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Factory Method Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/creational/factory-method/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/creational/factory-method/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Factory Method&lt;/strong&gt; pattern declares a method for creating an object in a base class, and lets &lt;strong&gt;subclasses&lt;/strong&gt; decide which concrete class to instantiate. The base class contains the code that &lt;em&gt;uses&lt;/em&gt; the object; subclasses supply only the creation step.&lt;/p&gt;</description></item><item><title>Factory Patterns Compared</title><link>https://samirsahoo.github.io/design-patterns-hub/comparisons/factory-patterns/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/comparisons/factory-patterns/</guid><description>&lt;h2 id="the-five-factories"&gt;The five &amp;ldquo;factories&amp;rdquo;&lt;a class="heading-anchor" href="#the-five-factories" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Technique&lt;/th&gt;&#10; &lt;th&gt;GoF pattern?&lt;/th&gt;&#10; &lt;th&gt;Mechanism&lt;/th&gt;&#10; &lt;th&gt;Choice made by&lt;/th&gt;&#10; &lt;th&gt;Creates&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Static factory method&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;No (Java idiom, &lt;em&gt;Effective Java&lt;/em&gt; Item 1)&lt;/td&gt;&#10; &lt;td&gt;A named static method instead of a constructor&lt;/td&gt;&#10; &lt;td&gt;The method, from its arguments&lt;/td&gt;&#10; &lt;td&gt;One object&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Simple factory&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;No&lt;/td&gt;&#10; &lt;td&gt;One method with a conditional&lt;/td&gt;&#10; &lt;td&gt;A runtime value&lt;/td&gt;&#10; &lt;td&gt;One object of several possible classes&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Factory Method&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;An overridable method in a creator class&lt;/td&gt;&#10; &lt;td&gt;The &lt;strong&gt;subclass&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;One product&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Abstract Factory&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;An object with several creation methods&lt;/td&gt;&#10; &lt;td&gt;The &lt;strong&gt;factory object&lt;/strong&gt; you pass in&lt;/td&gt;&#10; &lt;td&gt;A &lt;strong&gt;family&lt;/strong&gt; of related products&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Builder&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Step-by-step construction&lt;/td&gt;&#10; &lt;td&gt;The client (and director)&lt;/td&gt;&#10; &lt;td&gt;One complex object&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;h2 id="side-by-side"&gt;Side by side&lt;a class="heading-anchor" href="#side-by-side" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-java" data-lang="java"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Static factory method: a named constructor.&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;Duration&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;ofSeconds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;30&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;a&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;b&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Simple factory: choose a class from data.&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;ReportWriter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;writer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ReportWriters&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;forFormat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;csv&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Factory Method (GoF): the subclass decides; the base class owns the workflow.&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ReportExporter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;protected&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ReportWriter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;createWriter&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;final&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ExportedFile&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;export&lt;/span&gt;&lt;span class="p"&gt;(...)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ReportWriter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;createWriter&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Abstract Factory (GoF): one object creates a consistent family.&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;UiFactory&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Button&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;createButton&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Checkbox&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;createCheckbox&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;final&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DarkThemeFactory&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;implements&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;UiFactory&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// dark button + dark checkbox&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;final&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LightThemeFactory&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;implements&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;UiFactory&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// light button + light checkbox&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Builder (GoF / Effective Java): assemble one complex object step by step.&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;SearchQuery&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;SearchQuery&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;laptop&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="na"&gt;category&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;computers&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;figure class="diagram" aria-label="Factory Method versus Abstract Factory"&gt;&lt;figcaption class="diagram__title"&gt;Factory Method versus Abstract Factory&lt;/figcaption&gt;&#10; &lt;pre class="mermaid"&gt;classDiagram&#10; direction LR&#10; class Creator {&#10; &amp;lt;&amp;lt;abstract&amp;gt;&amp;gt;&#10; #createProduct()* Product&#10; +operation()&#10; }&#10; class ConcreteCreator {&#10; #createProduct() Product&#10; }&#10; Creator &amp;lt;|-- ConcreteCreator&#10; class AbstractFactory {&#10; &amp;lt;&amp;lt;interface&amp;gt;&amp;gt;&#10; +createButton() Button&#10; +createCheckbox() Checkbox&#10; }&#10; class DarkThemeFactory&#10; class LightThemeFactory&#10; AbstractFactory &amp;lt;|.. DarkThemeFactory&#10; AbstractFactory &amp;lt;|.. LightThemeFactory&lt;/pre&gt;&#10;&lt;/figure&gt;&#10;&lt;h2 id="how-to-choose"&gt;How to choose&lt;a class="heading-anchor" href="#how-to-choose" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Do you just need a readable alternative to a constructor, perhaps with caching or a subtype? → &lt;strong&gt;Static factory method.&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;Does the class depend on a runtime value such as configuration or user input? → &lt;strong&gt;Simple factory&lt;/strong&gt;, or a &lt;code&gt;Map&amp;lt;String, Supplier&amp;lt;T&amp;gt;&amp;gt;&lt;/code&gt;, or DI.&lt;/li&gt;&#10;&lt;li&gt;Does a base class own a workflow that needs an object whose class only subclasses know? → &lt;strong&gt;Factory Method.&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;Must several related objects be created consistently — all from the same family? → &lt;strong&gt;Abstract Factory.&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;Does one object have many optional parts or complex validation? → &lt;strong&gt;Builder.&lt;/strong&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;aside class="callout callout--mistake" role="note"&gt;&#10; &lt;p class="callout__title"&gt;&lt;span class="callout__label"&gt;Common mistake&lt;/span&gt;&lt;span class="callout__heading"&gt;&amp;ldquo;Factory Method&amp;rdquo; as a label for any creation method&lt;/span&gt;&lt;/p&gt;&#10; &lt;div class="callout__body"&gt;&lt;p&gt;Calling &lt;code&gt;ReportWriters.forFormat(...)&lt;/code&gt; or &lt;code&gt;List.of(...)&lt;/code&gt; a Factory Method is the most common inaccuracy in interviews about creational patterns. Neither involves a subclass overriding a creation step.&lt;/p&gt;&lt;/div&gt;&#10;&lt;/aside&gt;</description></item><item><title>Idempotency: Safe Retries for APIs and Consumers</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/reliability/idempotency/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/reliability/idempotency/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;An operation is &lt;strong&gt;idempotent&lt;/strong&gt; if performing it several times has the same effect as performing it once. Idempotency is what makes &lt;strong&gt;retries safe&lt;/strong&gt;: and in distributed systems retries are unavoidable, because a timeout never tells you whether the operation happened.&lt;/p&gt;</description></item><item><title>Integration Testing with @SpringBootTest, Test Slices and Testcontainers</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/production/integration-testing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/production/integration-testing/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;An &lt;strong&gt;integration test&lt;/strong&gt; checks that components &lt;strong&gt;work together with real infrastructure and framework behaviour&lt;/strong&gt;: HTTP mapping and JSON, transactions and SQL, security rules, messaging. Spring Boot provides &lt;strong&gt;&lt;code&gt;@SpringBootTest&lt;/code&gt;&lt;/strong&gt; for the whole application and &lt;strong&gt;test slices&lt;/strong&gt; for one layer. &lt;strong&gt;Testcontainers&lt;/strong&gt; starts &lt;strong&gt;real&lt;/strong&gt; databases and brokers in Docker for tests.&lt;/p&gt;</description></item><item><title>Load Balancing and Proxies</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/load-balancing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/load-balancing/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;load balancer (LB)&lt;/strong&gt; spreads incoming requests across a group of servers so that no single server is overloaded, and stops sending traffic to servers that are unhealthy. It improves &lt;strong&gt;scalability&lt;/strong&gt; (add servers behind it), &lt;strong&gt;availability&lt;/strong&gt; (route around failures) and &lt;strong&gt;responsiveness&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Entity Mappings and Fetch Strategies: Lazy vs Eager and the N+1 Problem</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/data/entity-mappings-and-fetch-strategies/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/data/entity-mappings-and-fetch-strategies/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Entity mappings&lt;/strong&gt; tell JPA how classes and their associations map to tables and foreign keys. &lt;strong&gt;Fetch strategies&lt;/strong&gt; decide &lt;strong&gt;when&lt;/strong&gt; associated data is loaded: &lt;strong&gt;eagerly&lt;/strong&gt; (with the parent) or &lt;strong&gt;lazily&lt;/strong&gt; (on first access, through a proxy).&lt;/p&gt;</description></item><item><title>Authentication and Authorization with OAuth 2.0, OpenID Connect and JWT</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/security/oauth2-oidc-and-jwt/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/security/oauth2-oidc-and-jwt/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Authentication&lt;/strong&gt; proves &lt;strong&gt;who&lt;/strong&gt; someone is. &lt;strong&gt;Authorization&lt;/strong&gt; decides &lt;strong&gt;what they may do&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;OAuth 2.0&lt;/strong&gt; is a framework for &lt;strong&gt;delegated authorization&lt;/strong&gt;: an app obtains an &lt;strong&gt;access token&lt;/strong&gt; to call an API on a user&amp;rsquo;s behalf, or on its own behalf.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;OpenID Connect (OIDC)&lt;/strong&gt; adds an &lt;strong&gt;authentication&lt;/strong&gt; layer on top: an &lt;strong&gt;ID token&lt;/strong&gt; that says who logged in.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;JWT (JSON Web Token)&lt;/strong&gt; is a common, self-contained, signed token format.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Every service managing its own passwords leads to weak security, no single sign-on and no MFA. Sharing user passwords with third-party apps is unacceptable. OAuth 2.0 and OIDC centralise login in an &lt;strong&gt;authorization server&lt;/strong&gt; (identity provider) and give apps and APIs &lt;strong&gt;scoped, short-lived tokens&lt;/strong&gt; instead.&lt;/p&gt;</description></item><item><title>RESTful API Design and Global Exception Handling</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/web/rest-api-design-and-error-handling/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/web/rest-api-design-and-error-handling/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;RESTful API&lt;/strong&gt; exposes &lt;strong&gt;resources&lt;/strong&gt; (orders, customers) at stable URIs and uses &lt;strong&gt;HTTP methods and status codes&lt;/strong&gt; with their standard meanings. &lt;strong&gt;Global exception handling&lt;/strong&gt; turns every error into a &lt;strong&gt;consistent, machine-readable response&lt;/strong&gt;, in Spring using &lt;code&gt;@RestControllerAdvice&lt;/code&gt; and &lt;strong&gt;RFC 9457 Problem Details&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Spring Boot Service Review Checklist</title><link>https://samirsahoo.github.io/design-patterns-hub/self-review/service-review-checklist/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/self-review/service-review-checklist/</guid><description>&lt;h2 id="how-to-use-it"&gt;How to use it&lt;a class="heading-anchor" href="#how-to-use-it" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Review your own service before release, or a team&amp;rsquo;s service at a production-readiness review. Score each area 0–3 and note evidence (links to code, tests, dashboards).&lt;/p&gt;&#10;&lt;figure class="diagram" aria-label="Nine review areas"&gt;&lt;figcaption class="diagram__title"&gt;Nine review areas&lt;/figcaption&gt;&#10; &lt;pre class="mermaid"&gt;flowchart LR&#10; A1[&amp;#34;1 · Java &amp;amp; code&amp;#34;] --&amp;gt; A2[&amp;#34;2 · Spring config&amp;#34;] --&amp;gt; A3[&amp;#34;3 · API&amp;#34;] --&amp;gt; A4[&amp;#34;4 · Data &amp;amp; tx&amp;#34;] --&amp;gt; A5[&amp;#34;5 · Security&amp;#34;]&#10; A5 --&amp;gt; A6[&amp;#34;6 · Resilience&amp;#34;] --&amp;gt; A7[&amp;#34;7 · Observability&amp;#34;] --&amp;gt; A8[&amp;#34;8 · Testing&amp;#34;] --&amp;gt; A9[&amp;#34;9 · Operations&amp;#34;]&lt;/pre&gt;&#10;&lt;/figure&gt;&#10;&lt;h2 id="1-java-and-code"&gt;1. Java and code&lt;a class="heading-anchor" href="#1-java-and-code" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Immutable value objects and records; no shared mutable state in singletons?&lt;/li&gt;&#10;&lt;li&gt;Executors bounded and named; no blocking in the common ForkJoinPool; virtual threads considered for I/O?&lt;/li&gt;&#10;&lt;li&gt;Exceptions chained, translated at boundaries, never swallowed?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; raw types; &lt;code&gt;catch (Exception e) {}&lt;/code&gt;; &lt;code&gt;synchronized&lt;/code&gt; around blocking I/O on Java 21–23; unbounded caches.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="2-spring-configuration"&gt;2. Spring configuration&lt;a class="heading-anchor" href="#2-spring-configuration" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Constructor injection throughout; no circular dependencies?&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;@ConfigurationProperties&lt;/code&gt; records with validation; no secrets in &lt;code&gt;application.yml&lt;/code&gt;?&lt;/li&gt;&#10;&lt;li&gt;Auto-configuration customised through properties or customisers rather than exclusions?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; field injection everywhere; &lt;code&gt;@EnableWebMvc&lt;/code&gt; in Boot; logic branching on profiles.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="3-api-design"&gt;3. API design&lt;a class="heading-anchor" href="#3-api-design" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Resource URIs, correct methods and status codes; 201 + &lt;code&gt;Location&lt;/code&gt; on create?&lt;/li&gt;&#10;&lt;li&gt;Validation at the edge; DTOs, not entities; pagination?&lt;/li&gt;&#10;&lt;li&gt;Errors as RFC 9457 Problem Details through &lt;code&gt;@RestControllerAdvice&lt;/code&gt;; no stack traces?&lt;/li&gt;&#10;&lt;li&gt;Idempotency keys for non-idempotent operations; versioning strategy?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; 200 with error bodies; returning JPA entities; retrying POSTs.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="4-persistence-and-transactions"&gt;4. Persistence and transactions&lt;a class="heading-anchor" href="#4-persistence-and-transactions" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;All associations LAZY; N+1 checked (query counts in tests); open-in-view disabled?&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;@Transactional&lt;/code&gt; on public service methods; rollback rules understood; no remote calls inside transactions?&lt;/li&gt;&#10;&lt;li&gt;Locking strategy for contended data (&lt;code&gt;@Version&lt;/code&gt; or &lt;code&gt;FOR UPDATE&lt;/code&gt;)?&lt;/li&gt;&#10;&lt;li&gt;Flyway or Liquibase migrations with &lt;code&gt;ddl-auto=validate&lt;/code&gt;; expand–contract for breaking changes?&lt;/li&gt;&#10;&lt;li&gt;Caches with TTLs, evicted after commit?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; EAGER &lt;code&gt;@ManyToOne&lt;/code&gt;; &lt;code&gt;ddl-auto=update&lt;/code&gt;; &lt;code&gt;@Transactional&lt;/code&gt; on private methods.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="5-security"&gt;5. Security&lt;a class="heading-anchor" href="#5-security" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;A SecurityFilterChain per area; deny by default; CSRF correct for the client type?&lt;/li&gt;&#10;&lt;li&gt;JWT validation with issuer and &lt;strong&gt;audience&lt;/strong&gt;; scopes and roles mapped?&lt;/li&gt;&#10;&lt;li&gt;Object-level checks (ownership or tenant) on every resource access (&lt;code&gt;@PreAuthorize&lt;/code&gt; or bean checks)?&lt;/li&gt;&#10;&lt;li&gt;Actuator on a separate port, with sensitive endpoints protected?&lt;/li&gt;&#10;&lt;li&gt;Dependencies scanned; secrets from a vault or secret manager?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; role checks only (BOLA); &lt;code&gt;permitAll&lt;/code&gt; before specific rules; tokens in localStorage.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="6-resilience"&gt;6. Resilience&lt;a class="heading-anchor" href="#6-resilience" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Timeouts on every outbound call (connect and read)?&lt;/li&gt;&#10;&lt;li&gt;Retries only on idempotent calls, with backoff and jitter; not at every layer?&lt;/li&gt;&#10;&lt;li&gt;Circuit breakers and bulkheads per dependency; safe fallbacks?&lt;/li&gt;&#10;&lt;li&gt;Outbox + idempotent consumers + DLQs for messaging?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; no HTTP client timeouts; infinite retries; &amp;ldquo;pretend success&amp;rdquo; fallbacks for payments.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="7-observability"&gt;7. Observability&lt;a class="heading-anchor" href="#7-observability" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Micrometer metrics (RED) with percentile histograms; business metrics?&lt;/li&gt;&#10;&lt;li&gt;Traces exported via OTLP; context propagated over HTTP and messaging?&lt;/li&gt;&#10;&lt;li&gt;Structured logs with trace IDs; no PII in logs?&lt;/li&gt;&#10;&lt;li&gt;SLOs with burn-rate alerts; dashboards per service?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; high-cardinality tags; logs without correlation; alerts on every spike.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="8-testing"&gt;8. Testing&lt;a class="heading-anchor" href="#8-testing" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Fast unit tests for domain logic (real objects and fakes; mocks at boundaries)?&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;@WebMvcTest&lt;/code&gt; for controllers (validation, errors, security)?&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;@DataJpaTest&lt;/code&gt; + Testcontainers on the real database engine; migrations tested?&lt;/li&gt;&#10;&lt;li&gt;A few &lt;code&gt;@SpringBootTest&lt;/code&gt; end-to-end flows; contract tests with consumers?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; H2 instead of the real database; &lt;code&gt;@SpringBootTest&lt;/code&gt; everywhere; flaky time-dependent tests.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="9-operations"&gt;9. Operations&lt;a class="heading-anchor" href="#9-operations" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Liveness and readiness probes correct (dependencies only in readiness); graceful shutdown?&lt;/li&gt;&#10;&lt;li&gt;Container memory sized (&lt;code&gt;MaxRAMPercentage&lt;/code&gt;); GC logs available?&lt;/li&gt;&#10;&lt;li&gt;Configuration externalised; one artifact for every environment?&lt;/li&gt;&#10;&lt;li&gt;Runbooks, on-call ownership, dependency and version upgrade plan (Java 25 LTS, Boot 4.x)?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; heap equal to the container limit; database checks in liveness; unpatched framework versions.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="scoring-rubric"&gt;Scoring rubric&lt;a class="heading-anchor" href="#scoring-rubric" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Score&lt;/th&gt;&#10; &lt;th&gt;Meaning&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;0&lt;/td&gt;&#10; &lt;td&gt;Not considered&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;1&lt;/td&gt;&#10; &lt;td&gt;Considered, but not implemented&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;2&lt;/td&gt;&#10; &lt;td&gt;Implemented, but not verified&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;3&lt;/td&gt;&#10; &lt;td&gt;Implemented and verified (tests, dashboards, drills)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;A service is &lt;strong&gt;ready for production&lt;/strong&gt; with no zeros in areas 4–7 and an average of at least 2.&lt;/p&gt;</description></item><item><title>SOLID Principles Explained</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/solid-principles/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/solid-principles/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;SOLID&lt;/strong&gt; is an acronym for five object-oriented design principles. Each one keeps code easy to change:&lt;/p&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Letter&lt;/th&gt;&#10; &lt;th&gt;Principle&lt;/th&gt;&#10; &lt;th&gt;One-line summary&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;S&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Single Responsibility&lt;/td&gt;&#10; &lt;td&gt;A module should have one reason to change — one actor it answers to.&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;O&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Open/Closed&lt;/td&gt;&#10; &lt;td&gt;Add behaviour by adding code, not by editing working code.&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;L&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Liskov Substitution&lt;/td&gt;&#10; &lt;td&gt;A subtype must be usable anywhere its supertype is expected.&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;I&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Interface Segregation&lt;/td&gt;&#10; &lt;td&gt;Clients should not depend on methods they do not use.&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;D&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Dependency Inversion&lt;/td&gt;&#10; &lt;td&gt;Policy should not depend on details; both depend on abstractions.&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;Robert C. Martin collected these principles around 2000. Michael Feathers later arranged them into the SOLID acronym.&lt;/p&gt;</description></item><item><title>Hexagonal Architecture with Spring Boot</title><link>https://samirsahoo.github.io/design-patterns-hub/hexagonal-architecture/spring-boot-implementation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/hexagonal-architecture/spring-boot-implementation/</guid><description>&lt;h2 id="what-you-will-build"&gt;What you will build&lt;a class="heading-anchor" href="#what-you-will-build" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A small order service with two use cases — &lt;strong&gt;place an order&lt;/strong&gt; (and charge for it) and &lt;strong&gt;get an order&lt;/strong&gt; — structured as Ports and Adapters:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;The &lt;strong&gt;domain model&lt;/strong&gt; enforces business rules in plain Java.&lt;/li&gt;&#10;&lt;li&gt;The &lt;strong&gt;application service&lt;/strong&gt; orchestrates use cases and talks to the outside world only through &lt;strong&gt;ports&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Adapters&lt;/strong&gt; connect the core to HTTP (Spring MVC), a database (Spring Data JPA with H2) and a payment provider (simulated, so the example needs no credentials).&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Tests&lt;/strong&gt; cover each part at the right level. The use-case tests run without Spring and without a database.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The full source is in &lt;code&gt;examples/spring-hexagonal-orders/&lt;/code&gt;. It targets &lt;strong&gt;Java 21&lt;/strong&gt; and &lt;strong&gt;Spring Boot 4.1.1&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Transactional Outbox and Idempotent Inbox</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/transactional-outbox/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/transactional-outbox/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;transactional outbox&lt;/strong&gt; pattern publishes events reliably from a service that owns a database. Instead of writing to the database &lt;strong&gt;and&lt;/strong&gt; sending to a broker (two systems that cannot share a transaction), the service writes the business change &lt;strong&gt;and an outbox row&lt;/strong&gt; in &lt;strong&gt;one local transaction&lt;/strong&gt;. A separate relay later reads the outbox and publishes to the broker. The matching &lt;strong&gt;inbox&lt;/strong&gt; pattern lets consumers process each message once, even when it is delivered several times.&lt;/p&gt;</description></item><item><title>Designing a URL Shortener</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/url-shortener/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/url-shortener/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A URL shortener turns &lt;code&gt;https://example.com/blog/2026/11/a-very-long-article-title?utm_source=newsletter&lt;/code&gt; into &lt;code&gt;https://sho.rt/3Fq9Zk&lt;/code&gt; and redirects visitors from the short URL to the original. It is a classic first system design question because it is small enough to finish, yet touches ID generation, encoding, caching, read-heavy scaling and analytics. It follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Spring Boot Actuator and Custom Endpoints</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/boot/actuator-and-custom-endpoints/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/boot/actuator-and-custom-endpoints/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Spring Boot Actuator&lt;/strong&gt; adds &lt;strong&gt;production-ready endpoints&lt;/strong&gt; that show whether an application is healthy, what it is doing, and how it is configured: health, metrics, info, loggers, environment, thread dumps and more. You can add your own health checks and endpoints.&lt;/p&gt;</description></item><item><title>Bean Lifecycle and Scopes</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/core/bean-lifecycle-and-scopes/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/core/bean-lifecycle-and-scopes/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;bean lifecycle&lt;/strong&gt; is the sequence of steps Spring performs to create, initialise, use and destroy a bean. A bean&amp;rsquo;s &lt;strong&gt;scope&lt;/strong&gt; decides &lt;strong&gt;how many instances&lt;/strong&gt; exist and &lt;strong&gt;how long&lt;/strong&gt; each lives.&lt;/p&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Opening connections in a constructor before properties are injected, forgetting to close thread pools on shutdown, or storing per-user data in a singleton are common, serious bugs. Knowing the lifecycle tells you &lt;strong&gt;where&lt;/strong&gt; code belongs; knowing scopes tells you what is &lt;strong&gt;shared&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Caching Strategies: Patterns, Invalidation, Eviction and Failure Modes</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/caching-strategies/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/caching-strategies/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;cache&lt;/strong&gt; is a small, fast store holding copies of data that is expensive to fetch or compute. It works because of &lt;strong&gt;locality of reference&lt;/strong&gt;: recently requested data is likely to be requested again. Caches exist at almost every layer — hardware, operating system, browser, CDN, application, database — and they are the cheapest way to cut latency and load.&lt;/p&gt;</description></item><item><title>CQRS and Event Sourcing</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/cqrs-and-event-sourcing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/cqrs-and-event-sourcing/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;CQRS (Command Query Responsibility Segregation)&lt;/strong&gt; uses &lt;strong&gt;different models for writing and reading&lt;/strong&gt;. Commands change state through a write model that enforces business rules; queries read from one or more read models shaped for the screens and APIs that use them.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Event sourcing&lt;/strong&gt; stores an entity&amp;rsquo;s state as the &lt;strong&gt;sequence of events&lt;/strong&gt; that happened to it (&lt;code&gt;OrderPlaced&lt;/code&gt;, &lt;code&gt;ItemAdded&lt;/code&gt;, &lt;code&gt;OrderShipped&lt;/code&gt;) instead of its current values. Current state is derived by replaying the events.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;They are independent patterns that combine naturally: event sourcing produces a stream of events, and CQRS projections consume it to build read models.&lt;/p&gt;</description></item><item><title>Garbage Collection: G1, ZGC and Tuning Basics</title><link>https://samirsahoo.github.io/design-patterns-hub/java/advanced/garbage-collection/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/advanced/garbage-collection/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Garbage collection (GC)&lt;/strong&gt; automatically frees heap memory used by objects that the program &lt;strong&gt;can no longer reach&lt;/strong&gt;. The JVM ships several collectors that trade &lt;strong&gt;pause time&lt;/strong&gt;, &lt;strong&gt;throughput&lt;/strong&gt; and &lt;strong&gt;memory overhead&lt;/strong&gt; differently.&lt;/p&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Manual memory management causes leaks and use-after-free bugs. Automatic GC removes those but costs CPU and sometimes &lt;strong&gt;pauses&lt;/strong&gt; the application. The right collector and heap size can turn 2-second pauses into sub-millisecond ones, or double throughput.&lt;/p&gt;</description></item><item><title>Querying with JPQL, the Criteria API and Specifications</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/data/jpql-and-criteria-api/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/data/jpql-and-criteria-api/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;JPQL (Jakarta Persistence Query Language)&lt;/strong&gt; is SQL-like, but queries &lt;strong&gt;entities and their fields&lt;/strong&gt;, not tables and columns.&lt;/li&gt;&#10;&lt;li&gt;The &lt;strong&gt;Criteria API&lt;/strong&gt; builds the same queries &lt;strong&gt;programmatically and type-safely&lt;/strong&gt;. It is ideal when filters are dynamic.&lt;/li&gt;&#10;&lt;li&gt;Spring Data adds &lt;strong&gt;derived queries&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;@Query&lt;/code&gt;&lt;/strong&gt;, &lt;strong&gt;Specifications&lt;/strong&gt; and &lt;strong&gt;Query by Example&lt;/strong&gt; on top.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Simple lookups fit method names. Real screens need optional filters (status, date range, customer, amount), sorting and pagination. Concatenating JPQL strings for that is ugly and &lt;strong&gt;dangerous&lt;/strong&gt; (injection). Native SQL everywhere loses portability and mapping.&lt;/p&gt;</description></item><item><title>Method-Level Security with @PreAuthorize and @PostAuthorize</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/security/method-level-security/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/security/method-level-security/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Method-level security&lt;/strong&gt; checks authorization &lt;strong&gt;on service methods&lt;/strong&gt; instead of (or in addition to) URL rules:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;@PreAuthorize&lt;/code&gt; decides &lt;strong&gt;before&lt;/strong&gt; the call&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;@PostAuthorize&lt;/code&gt; decides &lt;strong&gt;after&lt;/strong&gt;, using the returned object&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;@PreFilter&lt;/code&gt; and &lt;code&gt;@PostFilter&lt;/code&gt; filter collections.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;It is enabled with &lt;code&gt;@EnableMethodSecurity&lt;/code&gt; and implemented with &lt;strong&gt;AOP proxies&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>OO Design Principles Behind the Patterns</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/oo-design-principles/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/oo-design-principles/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Design patterns are not a list of tricks to memorise. Almost all of them are &lt;strong&gt;the same handful of principles applied to a particular problem&lt;/strong&gt;. Learn the principles and you can recognise patterns, adapt them, and know when &lt;em&gt;not&lt;/em&gt; to use them.&lt;/p&gt;</description></item><item><title>Java &amp; Spring Quick Reference</title><link>https://samirsahoo.github.io/design-patterns-hub/self-review/quick-reference/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/self-review/quick-reference/</guid><description>&lt;h2 id="java-choices"&gt;Java choices&lt;a class="heading-anchor" href="#java-choices" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Need&lt;/th&gt;&#10; &lt;th&gt;Use&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;List&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;ArrayList&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Lookup&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;HashMap&lt;/code&gt; / &lt;code&gt;HashSet&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Sorted or range queries&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;TreeMap&lt;/code&gt; / &lt;code&gt;TreeSet&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Queue or stack&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;ArrayDeque&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Thread-safe map&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;ConcurrentHashMap&lt;/code&gt; (&lt;code&gt;computeIfAbsent&lt;/code&gt;, &lt;code&gt;merge&lt;/code&gt;)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Producer–consumer&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;BlockingQueue&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Counter under contention&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;LongAdder&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Blocking I/O fan-out&lt;/td&gt;&#10; &lt;td&gt;Virtual threads (&lt;code&gt;newVirtualThreadPerTaskExecutor&lt;/code&gt;)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;CPU-bound parallel work&lt;/td&gt;&#10; &lt;td&gt;A fixed pool ≈ cores, or &lt;code&gt;ForkJoinPool&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Async composition&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;CompletableFuture&lt;/code&gt; (always pass an executor)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Context passing&lt;/td&gt;&#10; &lt;td&gt;Scoped values (Java 25), else ThreadLocal&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;h2 id="modern-java-by-version"&gt;Modern Java by version&lt;a class="heading-anchor" href="#modern-java-by-version" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Version&lt;/th&gt;&#10; &lt;th&gt;Highlights&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;17 LTS&lt;/td&gt;&#10; &lt;td&gt;Sealed classes, records (16), pattern-matching &lt;code&gt;instanceof&lt;/code&gt; (16), text blocks (15)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;21 LTS&lt;/td&gt;&#10; &lt;td&gt;Virtual threads, record patterns, pattern-matching &lt;code&gt;switch&lt;/code&gt;, sequenced collections, generational ZGC&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;22–24&lt;/td&gt;&#10; &lt;td&gt;Unnamed &lt;code&gt;_&lt;/code&gt;, FFM API, stream gatherers, no &lt;code&gt;synchronized&lt;/code&gt; pinning (24)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;25 LTS&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Flexible constructor bodies, module imports, compact source files, scoped values, compact object headers&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;26&lt;/td&gt;&#10; &lt;td&gt;HTTP/3 client, warnings for reflective &lt;code&gt;final&lt;/code&gt; mutation&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;27 (Sept 2026)&lt;/td&gt;&#10; &lt;td&gt;G1 the default everywhere, post-quantum hybrid TLS key exchange; previews continue&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;h2 id="spring-annotations-by-purpose"&gt;Spring annotations by purpose&lt;a class="heading-anchor" href="#spring-annotations-by-purpose" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Purpose&lt;/th&gt;&#10; &lt;th&gt;Annotations&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Beans&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;@Component&lt;/code&gt;, &lt;code&gt;@Service&lt;/code&gt;, &lt;code&gt;@Repository&lt;/code&gt;, &lt;code&gt;@Configuration&lt;/code&gt;, &lt;code&gt;@Bean&lt;/code&gt;, &lt;code&gt;@Primary&lt;/code&gt;, &lt;code&gt;@Qualifier&lt;/code&gt;, &lt;code&gt;@Lazy&lt;/code&gt;, &lt;code&gt;@Scope&lt;/code&gt;, &lt;code&gt;@Profile&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Lifecycle&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;@PostConstruct&lt;/code&gt;, &lt;code&gt;@PreDestroy&lt;/code&gt;, &lt;code&gt;SmartLifecycle&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Config&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;@ConfigurationProperties&lt;/code&gt;, &lt;code&gt;@Value&lt;/code&gt;, &lt;code&gt;@ConfigurationPropertiesScan&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Conditions&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;@ConditionalOnClass&lt;/code&gt;, &lt;code&gt;@ConditionalOnMissingBean&lt;/code&gt;, &lt;code&gt;@ConditionalOnProperty&lt;/code&gt;, &lt;code&gt;@ConditionalOnWebApplication&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Web&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;@RestController&lt;/code&gt;, &lt;code&gt;@GetMapping&lt;/code&gt;…, &lt;code&gt;@PathVariable&lt;/code&gt;, &lt;code&gt;@RequestParam&lt;/code&gt;, &lt;code&gt;@RequestBody&lt;/code&gt;, &lt;code&gt;@Valid&lt;/code&gt;, &lt;code&gt;@RestControllerAdvice&lt;/code&gt;, &lt;code&gt;@ExceptionHandler&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Data&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;@Entity&lt;/code&gt;, &lt;code&gt;@Id&lt;/code&gt;, &lt;code&gt;@ManyToOne(fetch = LAZY)&lt;/code&gt;, &lt;code&gt;@Query&lt;/code&gt;, &lt;code&gt;@EntityGraph&lt;/code&gt;, &lt;code&gt;@Transactional&lt;/code&gt;, &lt;code&gt;@Version&lt;/code&gt;, &lt;code&gt;@Lock&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Cache&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;@EnableCaching&lt;/code&gt;, &lt;code&gt;@Cacheable&lt;/code&gt;, &lt;code&gt;@CachePut&lt;/code&gt;, &lt;code&gt;@CacheEvict&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Events and async&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;@EventListener&lt;/code&gt;, &lt;code&gt;@TransactionalEventListener&lt;/code&gt;, &lt;code&gt;@Async&lt;/code&gt;, &lt;code&gt;@Scheduled&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Security&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;@EnableWebSecurity&lt;/code&gt;, &lt;code&gt;@EnableMethodSecurity&lt;/code&gt;, &lt;code&gt;@PreAuthorize&lt;/code&gt;, &lt;code&gt;@PostAuthorize&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Resilience&lt;/td&gt;&#10; &lt;td&gt;Spring 7: &lt;code&gt;@Retryable&lt;/code&gt;, &lt;code&gt;@ConcurrencyLimit&lt;/code&gt;; Resilience4j: &lt;code&gt;@CircuitBreaker&lt;/code&gt;, &lt;code&gt;@Retry&lt;/code&gt;, &lt;code&gt;@Bulkhead&lt;/code&gt;, &lt;code&gt;@RateLimiter&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Observability&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;@Observed&lt;/code&gt;, &lt;code&gt;@Timed&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Testing&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;@SpringBootTest&lt;/code&gt;, &lt;code&gt;@WebMvcTest&lt;/code&gt;, &lt;code&gt;@DataJpaTest&lt;/code&gt;, &lt;code&gt;@MockitoBean&lt;/code&gt;, &lt;code&gt;@ServiceConnection&lt;/code&gt;, &lt;code&gt;@WithMockUser&lt;/code&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;h2 id="transactions"&gt;Transactions&lt;a class="heading-anchor" href="#transactions" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Propagation&lt;/th&gt;&#10; &lt;th&gt;Behaviour&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;REQUIRED (default)&lt;/td&gt;&#10; &lt;td&gt;Join or create&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;REQUIRES_NEW&lt;/td&gt;&#10; &lt;td&gt;Suspend, create a new one (second connection)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;NESTED&lt;/td&gt;&#10; &lt;td&gt;Savepoint&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;SUPPORTS / NOT_SUPPORTED / NEVER / MANDATORY&lt;/td&gt;&#10; &lt;td&gt;Join-if-present / suspend / fail-if-present / fail-if-absent&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;Rollback on &lt;code&gt;RuntimeException&lt;/code&gt; and &lt;code&gt;Error&lt;/code&gt; by default. Proxies apply only to public methods called from outside the bean. Default isolation: READ COMMITTED (PostgreSQL, Oracle, SQL Server), REPEATABLE READ (MySQL).&lt;/p&gt;</description></item><item><title>Designing a Rate Limiter</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/rate-limiter/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/rate-limiter/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;rate limiter&lt;/strong&gt; caps how many requests a client may make in a time period, for example 100 requests per minute per API key. It protects services from abuse and denial-of-service, controls cost (paid third-party APIs), and keeps one noisy tenant from starving others. This case study designs a distributed rate limiter for an API platform, following the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Spring Boot Developer</title><link>https://samirsahoo.github.io/design-patterns-hub/learning-paths/spring-boot-developer/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/learning-paths/spring-boot-developer/</guid><description>&lt;p&gt;Examples use &lt;strong&gt;Spring Boot 4.1&lt;/strong&gt; on &lt;strong&gt;Java 21&lt;/strong&gt;. Version-specific behaviour is labelled and linked to the official Spring documentation.&lt;/p&gt;</description></item><item><title>Storage Engines: Logs, LSM-Trees, B-Trees and Column Stores</title><link>https://samirsahoo.github.io/design-patterns-hub/data-systems/storage-engines/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/data-systems/storage-engines/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;storage engine&lt;/strong&gt; is the part of a database that decides how data is laid out on disk and in memory, and how it is found again. You rarely write one, but choosing and tuning a database requires knowing roughly what it does. Two families dominate transactional workloads:&lt;/p&gt;</description></item><item><title>Strategy vs State vs Template Method</title><link>https://samirsahoo.github.io/design-patterns-hub/comparisons/strategy-state-template-method/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/comparisons/strategy-state-template-method/</guid><description>&lt;h2 id="the-short-answer"&gt;The short answer&lt;a class="heading-anchor" href="#the-short-answer" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Pattern&lt;/th&gt;&#10; &lt;th&gt;What varies&lt;/th&gt;&#10; &lt;th&gt;How&lt;/th&gt;&#10; &lt;th&gt;Who chooses&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;&lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/strategy/"&gt;Strategy&lt;/a&gt;&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;The whole algorithm&lt;/td&gt;&#10; &lt;td&gt;Composition: the context holds an interchangeable object&lt;/td&gt;&#10; &lt;td&gt;The &lt;strong&gt;client&lt;/strong&gt;, usually once&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;&lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/state/"&gt;State&lt;/a&gt;&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Behaviour per lifecycle state&lt;/td&gt;&#10; &lt;td&gt;Composition: the context holds the current state object&lt;/td&gt;&#10; &lt;td&gt;The &lt;strong&gt;states themselves&lt;/strong&gt;, on each transition&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;&lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/template-method/"&gt;Template Method&lt;/a&gt;&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Some steps of a fixed algorithm&lt;/td&gt;&#10; &lt;td&gt;Inheritance: subclasses override steps&lt;/td&gt;&#10; &lt;td&gt;The &lt;strong&gt;subclass&lt;/strong&gt;, at compile time&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;The deciding questions:&lt;/p&gt;</description></item><item><title>Spring WebFlux and Reactive Programming with Project Reactor</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/web/webflux-and-reactive-programming/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/web/webflux-and-reactive-programming/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Reactive programming&lt;/strong&gt; composes &lt;strong&gt;asynchronous, non-blocking streams of data&lt;/strong&gt; with &lt;strong&gt;backpressure&lt;/strong&gt;, so a consumer controls how fast data arrives. &lt;strong&gt;Project Reactor&lt;/strong&gt; implements it with two types: &lt;strong&gt;&lt;code&gt;Mono&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/strong&gt; (0 or 1 item) and &lt;strong&gt;&lt;code&gt;Flux&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/strong&gt; (0 to N items). &lt;strong&gt;Spring WebFlux&lt;/strong&gt; is the reactive web framework built on Reactor, usually running on &lt;strong&gt;Netty&lt;/strong&gt; with a small number of event-loop threads.&lt;/p&gt;</description></item><item><title>Builder Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/creational/builder/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/creational/builder/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Builder&lt;/strong&gt; pattern constructs a complex object step by step, instead of in one constructor call. The construction logic lives in a separate builder object, so the same steps can produce a valid, often immutable, result.&lt;/p&gt;</description></item><item><title>Spring Configuration: @Configuration, @Bean, Component Scanning and Profiles</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/core/configuration-and-component-scanning/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/core/configuration-and-component-scanning/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Spring learns &lt;strong&gt;which beans to create&lt;/strong&gt; in three main ways:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Component scanning&lt;/strong&gt;: annotate your classes (&lt;code&gt;@Component&lt;/code&gt;, &lt;code&gt;@Service&lt;/code&gt; and so on) and Spring finds them.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Java configuration&lt;/strong&gt;: &lt;code&gt;@Bean&lt;/code&gt; factory methods inside &lt;code&gt;@Configuration&lt;/code&gt; classes, ideal for third-party classes you cannot annotate.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Auto-configuration&lt;/strong&gt;: Spring Boot&amp;rsquo;s conditional defaults. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/spring/boot/auto-configuration-and-conditions/"&gt;auto-configuration&lt;/a&gt;.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Without a clear configuration strategy, applications end up with duplicate beans, surprising overrides, beans scanned from the wrong packages, and environment-specific code paths scattered everywhere.&lt;/p&gt;</description></item><item><title>Consistent Hashing</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/consistent-hashing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/consistent-hashing/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Consistent hashing&lt;/strong&gt; is a way to assign keys to servers so that when a server is &lt;strong&gt;added or removed, only a small fraction of keys move&lt;/strong&gt; — about &lt;em&gt;K / N&lt;/em&gt; of &lt;em&gt;K&lt;/em&gt; keys for &lt;em&gt;N&lt;/em&gt; servers — instead of nearly all of them. It is the standard technique for distributing data across distributed caches and leaderless databases.&lt;/p&gt;</description></item><item><title>Encoding and Schema Evolution</title><link>https://samirsahoo.github.io/design-patterns-hub/data-systems/encoding-and-schema-evolution/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/data-systems/encoding-and-schema-evolution/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;In memory, data lives in objects, lists and maps linked by pointers. To write it to a file or send it over the network, it must be &lt;strong&gt;encoded&lt;/strong&gt; (serialized) into a self-contained sequence of bytes, and &lt;strong&gt;decoded&lt;/strong&gt; on the other side.&lt;/p&gt;</description></item><item><title>All 23 GoF Patterns: Overview and Classification</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/gof-overview/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/gof-overview/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Gang of Four (GoF) catalogue&lt;/strong&gt; is the set of 23 object-oriented design patterns published in &lt;em&gt;Design Patterns: Elements of Reusable Object-Oriented Software&lt;/em&gt; (1994). The book sorts them along two axes:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Purpose&lt;/strong&gt; — what the pattern does: &lt;em&gt;creational&lt;/em&gt;, &lt;em&gt;structural&lt;/em&gt; or &lt;em&gt;behavioral&lt;/em&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Scope&lt;/strong&gt; — whether the relationships are fixed at compile time through inheritance (&lt;em&gt;class&lt;/em&gt; scope) or set up at runtime through composition (&lt;em&gt;object&lt;/em&gt; scope).&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This page is the map. Each pattern gets its own article; patterns not yet written are listed as plain text so that no page pretends to be finished.&lt;/p&gt;</description></item><item><title>Functional Programming in Java: Lambdas, Method References and Streams</title><link>https://samirsahoo.github.io/design-patterns-hub/java/advanced/functional-programming-and-streams/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/advanced/functional-programming-and-streams/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Functional programming in Java&lt;/strong&gt; means passing &lt;strong&gt;behaviour as values&lt;/strong&gt;:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;lambdas&lt;/strong&gt; and &lt;strong&gt;method references&lt;/strong&gt; implement &lt;strong&gt;functional interfaces&lt;/strong&gt; (interfaces with one abstract method)&lt;/li&gt;&#10;&lt;li&gt;the &lt;strong&gt;Streams API&lt;/strong&gt; processes data declaratively: you say &lt;strong&gt;what&lt;/strong&gt; to compute (filter, map, group), not &lt;strong&gt;how&lt;/strong&gt; to loop.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Loops mix the &amp;ldquo;what&amp;rdquo; with the &amp;ldquo;how&amp;rdquo;: index variables, temporary collections and mutable accumulators. Anonymous inner classes for callbacks were verbose. Lambdas and streams make data transformations shorter and clearer, and easier to parallelise &lt;strong&gt;when&lt;/strong&gt; that helps.&lt;/p&gt;</description></item><item><title>Observer vs Mediator vs Event Bus</title><link>https://samirsahoo.github.io/design-patterns-hub/comparisons/observer-mediator-event-bus/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/comparisons/observer-mediator-event-bus/</guid><description>&lt;h2 id="the-short-answer"&gt;The short answer&lt;a class="heading-anchor" href="#the-short-answer" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;&lt;/th&gt;&#10; &lt;th&gt;&lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/observer/"&gt;Observer&lt;/a&gt;&lt;/th&gt;&#10; &lt;th&gt;&lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/mediator/"&gt;Mediator&lt;/a&gt;&lt;/th&gt;&#10; &lt;th&gt;Event bus (publish/subscribe)&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Who knows whom&lt;/td&gt;&#10; &lt;td&gt;Subject knows its observers (through an interface)&lt;/td&gt;&#10; &lt;td&gt;Colleagues know the mediator; mediator knows colleagues&lt;/td&gt;&#10; &lt;td&gt;Publishers and subscribers know only the bus and event types&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Where the logic is&lt;/td&gt;&#10; &lt;td&gt;Each observer decides how to react&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Centralised&lt;/strong&gt; in the mediator&lt;/td&gt;&#10; &lt;td&gt;Each subscriber decides; nobody coordinates&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Direction&lt;/td&gt;&#10; &lt;td&gt;One-to-many broadcast&lt;/td&gt;&#10; &lt;td&gt;Many-to-one-to-many, two-way&lt;/td&gt;&#10; &lt;td&gt;Many-to-many broadcast&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Control flow&lt;/td&gt;&#10; &lt;td&gt;Easy to find: look at the subject&amp;rsquo;s observers&lt;/td&gt;&#10; &lt;td&gt;Easy to find: read the mediator&lt;/td&gt;&#10; &lt;td&gt;Hard to find: search for subscribers of an event type&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Typical scope&lt;/td&gt;&#10; &lt;td&gt;One object and its dependents&lt;/td&gt;&#10; &lt;td&gt;One dialog, workflow or interaction&lt;/td&gt;&#10; &lt;td&gt;A whole application, or many services via a broker&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;The deciding questions:&lt;/p&gt;</description></item><item><title>Designing a Payment System</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/payment-system/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/payment-system/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;When a customer clicks &lt;strong&gt;Buy&lt;/strong&gt;, money must move from the buyer to the marketplace (&lt;strong&gt;pay-in&lt;/strong&gt;), and later from the marketplace to sellers (&lt;strong&gt;pay-out&lt;/strong&gt;). The payment system records every movement correctly, never charges twice, never loses money, and can prove it. Correctness matters far more than raw throughput. This design follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt; and builds on the payment designs in the ByteByteGo handbook.&lt;/p&gt;</description></item><item><title>Prototype Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/creational/prototype/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/creational/prototype/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Prototype&lt;/strong&gt; pattern creates a new object by &lt;strong&gt;copying an existing one&lt;/strong&gt;, the prototype, and then adjusting the copy. The client does not need to know the concrete class or how the original was configured.&lt;/p&gt;</description></item><item><title>Software Architecture</title><link>https://samirsahoo.github.io/design-patterns-hub/learning-paths/software-architecture/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/learning-paths/software-architecture/</guid><description>&lt;p&gt;The first step is a prerequisite for everything else. Steps 3 and 4, and steps 6 and 7, are best read as pairs.&lt;/p&gt;</description></item><item><title>Database Transactions in Spring: @Transactional, Propagation and Isolation</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/data/transactions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/data/transactions/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;transaction&lt;/strong&gt; groups database operations so they &lt;strong&gt;all succeed or all fail&lt;/strong&gt; (ACID). In Spring you declare transaction boundaries with &lt;strong&gt;&lt;code&gt;@Transactional&lt;/code&gt;&lt;/strong&gt;. A proxy then begins, commits or rolls back through a &lt;strong&gt;&lt;code&gt;PlatformTransactionManager&lt;/code&gt;&lt;/strong&gt; (for example &lt;code&gt;JpaTransactionManager&lt;/code&gt;).&lt;/p&gt;</description></item><item><title>Auditing and Database Migrations with Flyway and Liquibase</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/data/auditing-and-migrations/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/data/auditing-and-migrations/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Auditing&lt;/strong&gt; records &lt;strong&gt;who changed what and when&lt;/strong&gt;: simple timestamps and users on each row, or a full history of every revision.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Database migrations&lt;/strong&gt; are &lt;strong&gt;versioned, repeatable scripts&lt;/strong&gt; that evolve the schema alongside the code. &lt;strong&gt;Flyway&lt;/strong&gt; and &lt;strong&gt;Liquibase&lt;/strong&gt; apply them automatically at startup or in a pipeline.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&amp;ldquo;Who changed this customer&amp;rsquo;s limit?&amp;rdquo; cannot be answered without auditing. Regulators often require it. Schemas changed by hand drift between environments, and &lt;code&gt;spring.jpa.hibernate.ddl-auto=update&lt;/code&gt; in production eventually corrupts or locks a table.&lt;/p&gt;</description></item><item><title>CAP Theorem and PACELC</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/cap-theorem-and-pacelc/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/cap-theorem-and-pacelc/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;CAP theorem&lt;/strong&gt; (Eric Brewer, 2000; proved by Gilbert and Lynch, 2002) concerns a distributed data store with replicas. It names three properties:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Consistency (C):&lt;/strong&gt; every read receives the most recent write or an error. Here this means &lt;strong&gt;linearizability&lt;/strong&gt;, not the C of ACID.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Availability (A):&lt;/strong&gt; every request to a non-failed node receives a non-error response (without a guarantee that it is the latest write).&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Partition tolerance (P):&lt;/strong&gt; the system keeps operating even when the network drops or delays messages between nodes.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The theorem says: &lt;strong&gt;when a network partition happens, a system must choose between consistency and availability.&lt;/strong&gt; It cannot provide both.&lt;/p&gt;</description></item><item><title>The Java Concurrency API: Executors, CompletableFuture, Locks and Concurrent Collections</title><link>https://samirsahoo.github.io/design-patterns-hub/java/advanced/concurrency-api/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/advanced/concurrency-api/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;code&gt;java.util.concurrent&lt;/code&gt; provides &lt;strong&gt;higher-level building blocks&lt;/strong&gt; for running work in parallel and coordinating threads safely:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;executors&lt;/strong&gt; run tasks&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;futures&lt;/strong&gt; represent results that arrive later&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;locks and atomics&lt;/strong&gt; protect shared state&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;concurrent collections&lt;/strong&gt; are safe to share between threads.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Creating raw &lt;code&gt;Thread&lt;/code&gt;s per task does not scale (platform threads are expensive OS threads). Hand-written &lt;code&gt;wait&lt;/code&gt;/&lt;code&gt;notify&lt;/code&gt; code is notoriously buggy. Sharing a plain &lt;code&gt;HashMap&lt;/code&gt; between threads corrupts it. The concurrency API gives tested abstractions, so you rarely touch low-level primitives.&lt;/p&gt;</description></item><item><title>Microservices Engineer</title><link>https://samirsahoo.github.io/design-patterns-hub/learning-paths/microservices-engineer/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/learning-paths/microservices-engineer/</guid><description>&lt;p&gt;Microservices are a trade-off, not a destination. This path starts with the decision to use them and returns to it in every case study.&lt;/p&gt;</description></item><item><title>Designing a Proximity Service (Nearby Places)</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/proximity-service/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/proximity-service/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;proximity service&lt;/strong&gt; answers &amp;ldquo;what is near me?&amp;rdquo;: restaurants within 1 km, hotels near a landmark, drivers near a pickup point. Yelp and Google Maps rely on one. The interesting part is the &lt;strong&gt;geospatial index&lt;/strong&gt;: how to find nearby points among hundreds of millions quickly. This design follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt; and expands the ByteByteGo handbook&amp;rsquo;s Yelp and quadtree discussions.&lt;/p&gt;</description></item><item><title>Replication: Leaders, Followers, Lag and Quorums</title><link>https://samirsahoo.github.io/design-patterns-hub/data-systems/replication/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/data-systems/replication/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Replication&lt;/strong&gt; keeps a copy of the same data on several machines connected by a network. Reasons to do it:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;High availability:&lt;/strong&gt; keep working when a machine or a whole data centre fails.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Read scalability:&lt;/strong&gt; serve more reads from more copies.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Latency:&lt;/strong&gt; keep data geographically close to users.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;If data never changed, replication would be trivial: copy it once. All the difficulty comes from &lt;strong&gt;handling changes&lt;/strong&gt;. There are three main approaches: &lt;strong&gt;single-leader&lt;/strong&gt;, &lt;strong&gt;multi-leader&lt;/strong&gt; and &lt;strong&gt;leaderless&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>REST vs GraphQL vs gRPC vs Messaging</title><link>https://samirsahoo.github.io/design-patterns-hub/comparisons/rest-graphql-grpc/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/comparisons/rest-graphql-grpc/</guid><description>&lt;h2 id="the-short-answer"&gt;The short answer&lt;a class="heading-anchor" href="#the-short-answer" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;&lt;/th&gt;&#10; &lt;th&gt;REST&lt;/th&gt;&#10; &lt;th&gt;GraphQL&lt;/th&gt;&#10; &lt;th&gt;gRPC&lt;/th&gt;&#10; &lt;th&gt;Messaging (Kafka, RabbitMQ)&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Style&lt;/td&gt;&#10; &lt;td&gt;Resources + HTTP verbs&lt;/td&gt;&#10; &lt;td&gt;Client-specified query over one endpoint&lt;/td&gt;&#10; &lt;td&gt;Remote procedure calls from a &lt;code&gt;.proto&lt;/code&gt; contract&lt;/td&gt;&#10; &lt;td&gt;Asynchronous events or commands&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Payload&lt;/td&gt;&#10; &lt;td&gt;Usually JSON&lt;/td&gt;&#10; &lt;td&gt;JSON&lt;/td&gt;&#10; &lt;td&gt;Protocol Buffers (binary)&lt;/td&gt;&#10; &lt;td&gt;Any (Avro, Protobuf, JSON)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Transport&lt;/td&gt;&#10; &lt;td&gt;HTTP/1.1, 2, 3&lt;/td&gt;&#10; &lt;td&gt;HTTP (POST/GET), WebSocket for subscriptions&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;HTTP/2&lt;/strong&gt; only&lt;/td&gt;&#10; &lt;td&gt;Broker protocol&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Coupling in time&lt;/td&gt;&#10; &lt;td&gt;Synchronous&lt;/td&gt;&#10; &lt;td&gt;Synchronous&lt;/td&gt;&#10; &lt;td&gt;Synchronous (+ streams)&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Decoupled&lt;/strong&gt;&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;HTTP caching&lt;/td&gt;&#10; &lt;td&gt;Excellent (GET, ETags, CDNs)&lt;/td&gt;&#10; &lt;td&gt;Hard (POST, varied queries)&lt;/td&gt;&#10; &lt;td&gt;None built in&lt;/td&gt;&#10; &lt;td&gt;n/a&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Browser support&lt;/td&gt;&#10; &lt;td&gt;Native&lt;/td&gt;&#10; &lt;td&gt;Native&lt;/td&gt;&#10; &lt;td&gt;Needs gRPC-Web / Connect proxy&lt;/td&gt;&#10; &lt;td&gt;No (via a back end)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Streaming&lt;/td&gt;&#10; &lt;td&gt;SSE, chunked&lt;/td&gt;&#10; &lt;td&gt;Subscriptions&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Client, server and bidirectional&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Inherent&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Contract&lt;/td&gt;&#10; &lt;td&gt;OpenAPI (optional)&lt;/td&gt;&#10; &lt;td&gt;Schema (required, introspectable)&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;.proto&lt;/code&gt; (required, code-generated)&lt;/td&gt;&#10; &lt;td&gt;Schema registry (recommended)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;Best for&lt;/td&gt;&#10; &lt;td&gt;Public APIs, CRUD, cacheable reads&lt;/td&gt;&#10; &lt;td&gt;Many clients with different data needs; aggregating back ends&lt;/td&gt;&#10; &lt;td&gt;Internal service-to-service, low latency, polyglot&lt;/td&gt;&#10; &lt;td&gt;Events, workflows, buffering, fan-out&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;ByteByteGo&amp;rsquo;s timeline of API styles (SOAP → REST → GraphQL → gRPC) makes the same point: each style emerged for a different set of problems; none replaced the others.&lt;/p&gt;</description></item><item><title>Singleton Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/creational/singleton/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/creational/singleton/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Singleton&lt;/strong&gt; pattern makes sure a class has &lt;strong&gt;exactly one instance&lt;/strong&gt; in a process and gives everyone a way to reach it.&lt;/p&gt;&#10;&lt;p&gt;GoF intent: &lt;em&gt;&amp;ldquo;Ensure a class only has one instance, and provide a global point of access to it.&amp;rdquo;&lt;/em&gt;&lt;/p&gt;</description></item><item><title>Adapter Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/adapter/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/adapter/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Adapter&lt;/strong&gt; pattern lets code work with a class whose interface does not match what the code expects. The adapter implements the interface the client wants and translates every call into the interface the existing class provides.&lt;/p&gt;</description></item><item><title>Spring Cache Abstraction and Redis Integration</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/data/caching/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/data/caching/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Spring Cache abstraction&lt;/strong&gt; lets you cache method results declaratively with &lt;code&gt;@Cacheable&lt;/code&gt; and friends. &lt;strong&gt;Where&lt;/strong&gt; data is cached is pluggable: &lt;strong&gt;Caffeine&lt;/strong&gt; in local memory, &lt;strong&gt;Redis&lt;/strong&gt; (or Valkey) shared across instances, Hazelcast and others.&lt;/p&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Repeated expensive calls (database aggregations, remote price lookups, reference data) waste latency and load. Ad-hoc &lt;code&gt;Map&lt;/code&gt; caches have no eviction or TTL, are not shared, and are scattered through the code.&lt;/p&gt;</description></item><item><title>Designing a Chat System (WhatsApp, Discord)</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/chat-system/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/chat-system/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A chat system delivers messages between users in near real time, keeps history, and works when phones go offline and come back. WhatsApp and Discord are the reference points: both keep a &lt;strong&gt;persistent connection&lt;/strong&gt; per device and store messages in a &lt;strong&gt;horizontally partitioned, write-optimised store&lt;/strong&gt;. This design follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Choosing a Database: SQL, NoSQL, Indexes and Storage Types</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/choosing-a-database/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/choosing-a-database/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;There is no best database, only the best fit for a &lt;strong&gt;workload&lt;/strong&gt;: the shape of the data, how it is queried, how much there is, how fast it changes, and which guarantees it needs. Choosing well means asking those questions first and naming the technology last.&lt;/p&gt;</description></item><item><title>Partitioning (Sharding): Keys, Hashes, Indexes and Rebalancing</title><link>https://samirsahoo.github.io/design-patterns-hub/data-systems/partitioning/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/data-systems/partitioning/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Partitioning&lt;/strong&gt;, called &lt;strong&gt;sharding&lt;/strong&gt; in many databases, splits a large dataset into smaller pieces called &lt;strong&gt;partitions&lt;/strong&gt; (shards), each stored on a different node. Each record belongs to exactly one partition. The goal is &lt;strong&gt;scalability&lt;/strong&gt;: spread both the data and the query load across many machines, so the system can grow by adding nodes.&lt;/p&gt;</description></item><item><title>Service Discovery with Eureka, Consul and Kubernetes</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/fundamentals/service-discovery/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/fundamentals/service-discovery/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Service discovery&lt;/strong&gt; lets a service find the &lt;strong&gt;current network locations&lt;/strong&gt; of the instances of another service, by &lt;strong&gt;logical name&lt;/strong&gt; (&lt;code&gt;inventory-service&lt;/code&gt;) instead of hard-coded hosts. A &lt;strong&gt;service registry&lt;/strong&gt; keeps track of which instances are alive.&lt;/p&gt;</description></item><item><title>Spring Expression Language (SpEL)</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/core/spring-expression-language/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/core/spring-expression-language/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;SpEL (Spring Expression Language)&lt;/strong&gt; is a small expression language that Spring evaluates &lt;strong&gt;at runtime&lt;/strong&gt; against objects, beans and context. It powers dynamic values in annotations such as &lt;code&gt;@Value(&amp;quot;#{…}&amp;quot;)&lt;/code&gt;, &lt;code&gt;@PreAuthorize(&amp;quot;…&amp;quot;)&lt;/code&gt;, &lt;code&gt;@Cacheable(key = &amp;quot;…&amp;quot;)&lt;/code&gt; and &lt;code&gt;@EventListener(condition = &amp;quot;…&amp;quot;)&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>System Design Interview Preparation</title><link>https://samirsahoo.github.io/design-patterns-hub/learning-paths/system-design-interview/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/learning-paths/system-design-interview/</guid><description>&lt;p&gt;Practise each case study out loud with a timer, and spend the first third of the time on requirements and estimates.&lt;/p&gt;</description></item><item><title>Virtual Threads, Structured Concurrency and Scoped Values</title><link>https://samirsahoo.github.io/design-patterns-hub/java/advanced/virtual-threads-and-structured-concurrency/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/advanced/virtual-threads-and-structured-concurrency/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;virtual thread&lt;/strong&gt; (Java 21, Project Loom) is a &lt;code&gt;Thread&lt;/code&gt; managed by the JVM rather than the operating system. It is so cheap that you can create &lt;strong&gt;millions&lt;/strong&gt;, one per request or task. When it blocks on I/O, the JVM &lt;strong&gt;parks&lt;/strong&gt; it and frees the underlying OS thread for other work.&lt;/p&gt;</description></item><item><title>Aspect-Oriented Programming (AOP), Advice Types and Proxies</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/core/aop-and-proxies/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/core/aop-and-proxies/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Aspect-oriented programming (AOP)&lt;/strong&gt; keeps &lt;strong&gt;cross-cutting concerns&lt;/strong&gt; (logging, transactions, security, metrics, retries, caching) out of business code. You write the concern once as an &lt;strong&gt;aspect&lt;/strong&gt; and declare &lt;strong&gt;where&lt;/strong&gt; it applies. Spring AOP applies aspects by wrapping beans in &lt;strong&gt;proxies&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>API Gateway with Spring Cloud Gateway</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/fundamentals/api-gateway/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/fundamentals/api-gateway/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;An &lt;strong&gt;API gateway&lt;/strong&gt; is the &lt;strong&gt;single entry point&lt;/strong&gt; for clients into a set of backend services. It &lt;strong&gt;routes&lt;/strong&gt; each request to the right service and applies &lt;strong&gt;cross-cutting edge concerns&lt;/strong&gt;: authentication, rate limiting, TLS, CORS, request shaping and observability. &lt;strong&gt;Spring Cloud Gateway&lt;/strong&gt; is Spring&amp;rsquo;s gateway, configured with &lt;strong&gt;routes&lt;/strong&gt;, &lt;strong&gt;predicates&lt;/strong&gt; and &lt;strong&gt;filters&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Bridge Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/bridge/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/bridge/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Bridge&lt;/strong&gt; pattern separates &lt;em&gt;what&lt;/em&gt; something does (the &lt;strong&gt;abstraction&lt;/strong&gt;) from &lt;em&gt;how&lt;/em&gt; it is done (the &lt;strong&gt;implementation&lt;/strong&gt;) into two class hierarchies. The abstraction holds a reference to an implementation object; that reference is the &amp;ldquo;bridge&amp;rdquo;. Both sides can then be extended independently.&lt;/p&gt;</description></item><item><title>Designing a News Feed (Twitter / Instagram Timeline)</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/news-feed/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/news-feed/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A news feed shows each user the recent posts of the accounts they follow, newest or best first. It is the canonical example of &lt;strong&gt;fan-out&lt;/strong&gt;: one post must appear in the feeds of every follower, and follower counts range from zero to hundreds of millions. Kleppmann uses Twitter&amp;rsquo;s home timeline as his main example of describing load. This design follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Transactions and Isolation Levels: ACID, Anomalies and Serializability</title><link>https://samirsahoo.github.io/design-patterns-hub/data-systems/transactions-and-isolation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/data-systems/transactions-and-isolation/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;transaction&lt;/strong&gt; groups several reads and writes into one logical unit: either all of them take effect (&lt;strong&gt;commit&lt;/strong&gt;) or none do (&lt;strong&gt;abort&lt;/strong&gt;, rollback). Transactions let applications ignore whole classes of problems — crashes halfway through, concurrent clients interfering — because the database handles them.&lt;/p&gt;</description></item><item><title>Unique ID Generation in Distributed Systems</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/unique-id-generation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/unique-id-generation/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Every order, message and post needs a unique ID. On one database, &lt;code&gt;AUTO_INCREMENT&lt;/code&gt; does it. Across many servers and databases, generating IDs that are unique &lt;strong&gt;without coordinating on every request&lt;/strong&gt; is a design problem in its own right — and a common interview question.&lt;/p&gt;</description></item><item><title>Spring Application Events and Listeners</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/core/application-events/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/core/application-events/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Spring&amp;rsquo;s &lt;strong&gt;application events&lt;/strong&gt; let one bean &lt;strong&gt;publish&lt;/strong&gt; a message (&amp;ldquo;an order was placed&amp;rdquo;) and any number of other beans &lt;strong&gt;listen&lt;/strong&gt; and react, without the publisher knowing them. It is the Observer pattern, implemented by the &lt;code&gt;ApplicationContext&lt;/code&gt;, &lt;strong&gt;inside one application&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Centralized Configuration with Spring Cloud Config</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/fundamentals/centralized-configuration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/fundamentals/centralized-configuration/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Centralized configuration&lt;/strong&gt; stores the configuration of many services in &lt;strong&gt;one versioned, audited place&lt;/strong&gt; and serves it to them at startup (and optionally at runtime). &lt;strong&gt;Spring Cloud Config&lt;/strong&gt; provides a &lt;strong&gt;Config Server&lt;/strong&gt; (an HTTP API in front of Git, Vault or other backends) and a client that plugs into Spring Boot&amp;rsquo;s &lt;a href="https://samirsahoo.github.io/design-patterns-hub/spring/boot/externalized-configuration/"&gt;externalized configuration&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Composite Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/composite/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/composite/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Composite&lt;/strong&gt; pattern arranges objects in a &lt;strong&gt;tree&lt;/strong&gt; and gives single objects (leaves) and groups (composites) the &lt;strong&gt;same interface&lt;/strong&gt;. Client code can then call &lt;code&gt;price()&lt;/code&gt; on a single product or on a bundle of bundles without caring which it has.&lt;/p&gt;</description></item><item><title>The Trouble with Distributed Systems: Networks, Clocks and Partial Failure</title><link>https://samirsahoo.github.io/design-patterns-hub/data-systems/distributed-systems-faults/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/data-systems/distributed-systems-faults/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;On a single computer, things either work or break completely: a bug or a hardware fault usually crashes the whole machine, and a deterministic program gives the same result each time. In a &lt;strong&gt;distributed system&lt;/strong&gt; — several computers communicating over a network — some parts can fail while others keep running. This is a &lt;strong&gt;partial failure&lt;/strong&gt;, and it is &lt;strong&gt;nondeterministic&lt;/strong&gt;: the same request may succeed, fail, or leave you not knowing which.&lt;/p&gt;</description></item><item><title>Exception Handling and Try-With-Resources</title><link>https://samirsahoo.github.io/design-patterns-hub/java/fundamentals/exceptions-and-try-with-resources/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/fundamentals/exceptions-and-try-with-resources/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;An &lt;strong&gt;exception&lt;/strong&gt; is an object that signals that something went wrong and transfers control to the nearest matching &lt;code&gt;catch&lt;/code&gt;. &lt;strong&gt;Try-with-resources&lt;/strong&gt; automatically closes resources such as files, connections and streams, even when exceptions occur.&lt;/p&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Error codes are easy to ignore, and manual cleanup in &lt;code&gt;finally&lt;/code&gt; blocks is verbose and buggy: a second exception during cleanup hides the first. Badly designed exceptions leak implementation details, lose root causes or force callers into empty &lt;code&gt;catch&lt;/code&gt; blocks.&lt;/p&gt;</description></item><item><title>The Java Platform Module System (JPMS)</title><link>https://samirsahoo.github.io/design-patterns-hub/java/advanced/java-module-system/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/advanced/java-module-system/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Java Platform Module System (JPMS)&lt;/strong&gt;, introduced in Java 9 (Project Jigsaw), groups packages into &lt;strong&gt;modules&lt;/strong&gt; with explicit &lt;strong&gt;dependencies&lt;/strong&gt; (&lt;code&gt;requires&lt;/code&gt;) and an explicit &lt;strong&gt;public API&lt;/strong&gt; (&lt;code&gt;exports&lt;/code&gt;). Everything else is &lt;strong&gt;strongly encapsulated&lt;/strong&gt;: other modules cannot use it, even through reflection.&lt;/p&gt;</description></item><item><title>Designing a Notification Service</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/notification-service/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/notification-service/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Almost every product sends notifications: order confirmations, password resets, chat messages, marketing campaigns. A &lt;strong&gt;notification service&lt;/strong&gt; centralises this so product teams send an event (&amp;ldquo;order shipped to user 42&amp;rdquo;) and the service decides &lt;strong&gt;whether, where and how&lt;/strong&gt; to deliver it. ByteByteGo&amp;rsquo;s flowchart of how Slack decides to send a notification shows why &amp;ldquo;a simple feature&amp;rdquo; is not simple: a dozen checks (muted channels, do-not-disturb, active on desktop, mention type, thread settings) run before anything is sent.&lt;/p&gt;</description></item><item><title>Message Queues and Delivery Semantics</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/message-queues-and-delivery-semantics/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/message-queues-and-delivery-semantics/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;message queue&lt;/strong&gt; is a durable buffer between components: a &lt;strong&gt;producer&lt;/strong&gt; puts a message on it and continues; a &lt;strong&gt;consumer&lt;/strong&gt; takes it off and processes it later. The queue makes communication &lt;strong&gt;asynchronous&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;The handwritten notes summarise why this matters: in small systems writes are fast, but in large systems a request may take a long time, and with many clients the server cannot keep up. With a queue, the client gets an acknowledgement (a receipt) immediately, the task is processed when a worker is free, and the client can check the result later.&lt;/p&gt;</description></item><item><title>Consistency and Consensus: Linearizability, Ordering, 2PC and Raft</title><link>https://samirsahoo.github.io/design-patterns-hub/data-systems/consistency-and-consensus/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/data-systems/consistency-and-consensus/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Given that networks, clocks and nodes are unreliable (see &lt;a href="https://samirsahoo.github.io/design-patterns-hub/data-systems/distributed-systems-faults/"&gt;The Trouble with Distributed Systems&lt;/a&gt;), how do we build systems that still behave predictably? The approach is to find &lt;strong&gt;general-purpose abstractions with useful guarantees&lt;/strong&gt;, implement them once, carefully, and let applications rely on them — just as transactions hide crashes and concurrency.&lt;/p&gt;</description></item><item><title>Decorator Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/decorator/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/decorator/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Decorator&lt;/strong&gt; pattern adds behaviour to an object by &lt;strong&gt;wrapping&lt;/strong&gt; it in another object that implements the &lt;strong&gt;same interface&lt;/strong&gt;. The wrapper does its extra work and forwards the call to the wrapped object. Wrappers can be stacked, and each adds one responsibility.&lt;/p&gt;</description></item><item><title>Designing Concurrent Objects: Safety, Liveness and Locking Strategies</title><link>https://samirsahoo.github.io/design-patterns-hub/java/advanced/concurrent-object-design/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/advanced/concurrent-object-design/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;thread-safe&lt;/strong&gt; class behaves correctly when its methods are called from several threads at the same time, without callers needing extra synchronization. Designing one means balancing four forces that Doug Lea describes in &lt;em&gt;Concurrent Programming in Java&lt;/em&gt;:&lt;/p&gt;</description></item><item><title>Generics, Wildcards and Type Erasure</title><link>https://samirsahoo.github.io/design-patterns-hub/java/fundamentals/generics-and-type-erasure/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/fundamentals/generics-and-type-erasure/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Generics&lt;/strong&gt; let classes, interfaces and methods take &lt;strong&gt;types as parameters&lt;/strong&gt;, such as &lt;code&gt;List&amp;lt;Order&amp;gt;&lt;/code&gt; or &lt;code&gt;Map&amp;lt;String, Price&amp;gt;&lt;/code&gt;. The compiler checks that you put in and take out only the right type. At runtime most of that type information is &lt;strong&gt;erased&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Long Polling, WebSockets and Server-Sent Events</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/real-time-communication/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/real-time-communication/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;HTTP was designed for &lt;strong&gt;request and response&lt;/strong&gt;: the client asks, the server answers. Chat, live scores, notifications, collaborative editing and dashboards need the &lt;strong&gt;server to send data when something happens&lt;/strong&gt;. There are four ways to achieve this on the web, from the oldest to the most capable.&lt;/p&gt;</description></item><item><title>Designing a Video Streaming Platform (YouTube, Netflix)</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/video-streaming/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/video-streaming/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A video platform has two very different halves: a &lt;strong&gt;write path&lt;/strong&gt; where creators upload large files that are processed into many formats, and a &lt;strong&gt;read path&lt;/strong&gt; where millions of viewers stream those formats with smooth playback on any network. Bandwidth, not compute, dominates cost, so most of the design is about &lt;strong&gt;getting bytes close to viewers&lt;/strong&gt;. This case study follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Batch Processing: Unix Pipes, MapReduce and Dataflow Engines</title><link>https://samirsahoo.github.io/design-patterns-hub/data-systems/batch-processing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/data-systems/batch-processing/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;There are three broad kinds of system:&lt;/p&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Kind&lt;/th&gt;&#10; &lt;th&gt;Input&lt;/th&gt;&#10; &lt;th&gt;Measured by&lt;/th&gt;&#10; &lt;th&gt;Example&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Services&lt;/strong&gt; (online)&lt;/td&gt;&#10; &lt;td&gt;A request; respond quickly&lt;/td&gt;&#10; &lt;td&gt;Response time, availability&lt;/td&gt;&#10; &lt;td&gt;A REST API&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Batch processing&lt;/strong&gt; (offline)&lt;/td&gt;&#10; &lt;td&gt;A large, &lt;strong&gt;bounded&lt;/strong&gt; dataset; runs for minutes or hours&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Throughput&lt;/strong&gt;&lt;/td&gt;&#10; &lt;td&gt;Nightly reports, search index builds, ML training sets&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;strong&gt;Stream processing&lt;/strong&gt; (near-real-time)&lt;/td&gt;&#10; &lt;td&gt;&lt;strong&gt;Unbounded&lt;/strong&gt; events, processed shortly after they happen&lt;/td&gt;&#10; &lt;td&gt;Latency and throughput&lt;/td&gt;&#10; &lt;td&gt;Fraud detection, live dashboards&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;A &lt;strong&gt;batch job&lt;/strong&gt; reads a fixed set of input files, computes, and writes output files. Nobody waits for it interactively, so it can be optimised for throughput and retried freely when it fails.&lt;/p&gt;</description></item><item><title>The Java Collections Framework: Internal Architecture</title><link>https://samirsahoo.github.io/design-patterns-hub/java/fundamentals/collections-framework/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/fundamentals/collections-framework/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Java Collections Framework (JCF)&lt;/strong&gt; is a set of &lt;strong&gt;interfaces&lt;/strong&gt; (&lt;code&gt;List&lt;/code&gt;, &lt;code&gt;Set&lt;/code&gt;, &lt;code&gt;Map&lt;/code&gt;, &lt;code&gt;Queue&lt;/code&gt;, &lt;code&gt;Deque&lt;/code&gt;), &lt;strong&gt;implementations&lt;/strong&gt; (&lt;code&gt;ArrayList&lt;/code&gt;, &lt;code&gt;HashMap&lt;/code&gt;, &lt;code&gt;TreeMap&lt;/code&gt; and others) and &lt;strong&gt;algorithms&lt;/strong&gt; (&lt;code&gt;Collections.sort&lt;/code&gt;, &lt;code&gt;binarySearch&lt;/code&gt;) for storing and processing groups of objects.&lt;/p&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Choosing the wrong collection is one of the most common hidden performance bugs: &lt;code&gt;contains&lt;/code&gt; on a large &lt;code&gt;ArrayList&lt;/code&gt; is O(n), and &lt;code&gt;LinkedList.get(i)&lt;/code&gt; walks the list. Mutable keys break &lt;code&gt;HashMap&lt;/code&gt;. Knowing the internals tells you the costs.&lt;/p&gt;</description></item><item><title>Deployment Strategies: Rolling, Blue-Green, Canary and Feature Flags</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/deployment-strategies/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/deployment-strategies/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Deploying or upgrading services is risky: most outages are caused by changes. A &lt;strong&gt;deployment strategy&lt;/strong&gt; decides how a new version replaces the old one, aiming for &lt;strong&gt;no downtime&lt;/strong&gt;, &lt;strong&gt;limited blast radius&lt;/strong&gt; if the new version is bad, and &lt;strong&gt;fast rollback&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Facade Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/facade/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/facade/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Facade&lt;/strong&gt; pattern provides &lt;strong&gt;one simple interface&lt;/strong&gt; to a set of classes that together form a subsystem. Clients call the facade; the facade knows which subsystem objects to call and in what order.&lt;/p&gt;&#10;&lt;p&gt;GoF intent: &lt;em&gt;&amp;ldquo;Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.&amp;rdquo;&lt;/em&gt;&lt;/p&gt;</description></item><item><title>State-Dependent Actions: Balking, Guarded Suspension and Timeouts</title><link>https://samirsahoo.github.io/design-patterns-hub/java/advanced/state-dependent-actions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/advanced/state-dependent-actions/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;state-dependent action&lt;/strong&gt; is an operation that only makes sense when an object is in a certain state: you cannot take an item from an empty queue, withdraw from an empty account, or start an engine that is already running. In a single-threaded program, the wrong state is an error. In a concurrent program, the state might become right &lt;strong&gt;if you wait&lt;/strong&gt;, because another thread may change it.&lt;/p&gt;</description></item><item><title>Designing a Web Crawler</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/web-crawler/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/web-crawler/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;web crawler&lt;/strong&gt; downloads web pages, extracts their links and downloads those in turn. Search engines, archives, price monitors and AI training pipelines all rely on crawlers. The algorithm is a breadth-first traversal; the engineering problems are &lt;strong&gt;scale&lt;/strong&gt;, &lt;strong&gt;politeness&lt;/strong&gt; (not overloading websites), &lt;strong&gt;duplicate avoidance&lt;/strong&gt; and &lt;strong&gt;robustness&lt;/strong&gt; against a hostile, messy web. ByteByteGo&amp;rsquo;s &amp;ldquo;how to avoid crawling duplicate URLs at Google scale&amp;rdquo; focuses on exactly the dedup part.&lt;/p&gt;</description></item><item><title>Concurrency Design Patterns: Messages, Worker Threads, Futures, Cancellation and Pipelines</title><link>https://samirsahoo.github.io/design-patterns-hub/java/advanced/concurrency-design-patterns/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/advanced/concurrency-design-patterns/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Once objects are safe to share (see &lt;a href="https://samirsahoo.github.io/design-patterns-hub/java/advanced/concurrent-object-design/"&gt;Designing concurrent objects&lt;/a&gt;), the next question is &lt;strong&gt;how work gets onto threads&lt;/strong&gt; and how results and failures come back. Doug Lea&amp;rsquo;s &lt;em&gt;Concurrent Programming in Java&lt;/em&gt; catalogues the recurring answers. Most now have direct support in &lt;code&gt;java.util.concurrent&lt;/code&gt;, so this page names each pattern, explains the forces behind it, and shows the modern API.&lt;/p&gt;</description></item><item><title>Flyweight Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/flyweight/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/flyweight/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Flyweight&lt;/strong&gt; pattern saves memory when a program needs a very large number of similar objects. It splits each object&amp;rsquo;s state into:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;intrinsic state&lt;/strong&gt;: shared, immutable and independent of context, stored once in a shared flyweight object&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;extrinsic state&lt;/strong&gt;: varies per object and is stored (or passed in) by the context.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;A &lt;strong&gt;factory&lt;/strong&gt; makes sure each distinct flyweight exists only once.&lt;/p&gt;</description></item><item><title>Designing Search Autocomplete (Typeahead)</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/search-autocomplete/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/search-autocomplete/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;As a user types &amp;ldquo;sys&amp;rdquo;, the search box suggests &amp;ldquo;system design&amp;rdquo;, &amp;ldquo;system of a down&amp;rdquo;, &amp;ldquo;sysadmin&amp;rdquo;. &lt;strong&gt;Search autocomplete&lt;/strong&gt; must return the top suggestions for a prefix in under 100 ms while users type several characters per second, so the serving path is pure in-memory lookup and all heavy work happens offline. Follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>HTTPS, Password Storage and API Request Signing</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/security-fundamentals/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/security-fundamentals/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Security is a requirement of every design, not an add-on. Three mechanisms appear in nearly every system design discussion:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;HTTPS (HTTP over TLS)&lt;/strong&gt; protects data in transit: confidentiality, integrity and server authentication.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Password hashing&lt;/strong&gt; protects credentials at rest, even if the database leaks.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Authenticated API access&lt;/strong&gt; — tokens or signed requests — proves who is calling an API and that the request was not tampered with.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="how-https-works"&gt;How HTTPS works&lt;a class="heading-anchor" href="#how-https-works" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;HTTPS is HTTP sent through a &lt;strong&gt;TLS&lt;/strong&gt; connection. TLS uses both kinds of cryptography:&lt;/p&gt;</description></item><item><title>Stream Processing: Logs, Change Data Capture, Event Sourcing and Windows</title><link>https://samirsahoo.github.io/design-patterns-hub/data-systems/stream-processing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/data-systems/stream-processing/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Batch processing assumes the input is &lt;strong&gt;bounded&lt;/strong&gt;: a known, finite size, so a job can finish. Real data is &lt;strong&gt;unbounded&lt;/strong&gt;: users keep clicking, sensors keep measuring, orders keep arriving. Running batch jobs every day means results are a day late. &lt;strong&gt;Stream processing&lt;/strong&gt; handles each event shortly after it happens.&lt;/p&gt;</description></item><item><title>Designing a Distributed Key-Value Store (Dynamo-Style)</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/distributed-key-value-store/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/distributed-key-value-store/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Designing a key-value store is a favourite interview question because it combines nearly every idea in &lt;a href="https://samirsahoo.github.io/design-patterns-hub/data-systems/"&gt;Data-Intensive Systems&lt;/a&gt;: partitioning, replication, quorums, conflict resolution, failure detection and storage engines. The reference design is Amazon&amp;rsquo;s &lt;strong&gt;Dynamo&lt;/strong&gt; (2007), whose ideas live on in Cassandra, Riak, ScyllaDB and DynamoDB&amp;rsquo;s internals.&lt;/p&gt;</description></item><item><title>DNS and What Happens When You Type a URL</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/dns-and-web-request-lifecycle/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/dns-and-web-request-lifecycle/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;When you type &lt;code&gt;https://www.example.com/products&lt;/code&gt; and press Enter, the browser must: find the server&amp;rsquo;s IP address (&lt;strong&gt;DNS&lt;/strong&gt;), open a connection (&lt;strong&gt;TCP&lt;/strong&gt;), secure it (&lt;strong&gt;TLS&lt;/strong&gt;), send an &lt;strong&gt;HTTP&lt;/strong&gt; request, receive the response, and &lt;strong&gt;render&lt;/strong&gt; the page. Each step adds latency and each is a lever in system design. ByteByteGo covers this as &amp;ldquo;what happens when you type a URL into your browser?&amp;rdquo; and &amp;ldquo;how does DNS work&amp;rdquo;.&lt;/p&gt;</description></item><item><title>Proxy Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/proxy/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/proxy/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Proxy&lt;/strong&gt; pattern puts a &lt;strong&gt;stand-in object&lt;/strong&gt; in front of a real object. The proxy implements the same interface, so clients cannot tell the difference, and it decides when and whether to forward each call: creating the real object lazily, checking permissions, caching results or calling across a network.&lt;/p&gt;</description></item><item><title>Chain of Responsibility Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/chain-of-responsibility/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/chain-of-responsibility/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Chain of Responsibility&lt;/strong&gt; pattern passes a request along a &lt;strong&gt;chain of handler objects&lt;/strong&gt;. Each handler either handles the request or passes it to the next one. The sender does not know which handler will deal with it.&lt;/p&gt;</description></item><item><title>Designing Collaborative Editing (Google Docs)</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/collaborative-editing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/collaborative-editing/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;In Google Docs several people type into the same document at once and see each other&amp;rsquo;s changes within a fraction of a second, and everyone ends up with the &lt;strong&gt;same text&lt;/strong&gt;. ByteByteGo&amp;rsquo;s &amp;ldquo;design Google Docs&amp;rdquo; interview question centres on the hard part: merging concurrent edits so all copies &lt;strong&gt;converge&lt;/strong&gt; while each user&amp;rsquo;s intent is preserved. Follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Probabilistic Data Structures: Bloom Filters, HyperLogLog and Count-Min Sketch</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/probabilistic-data-structures/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/building-blocks/probabilistic-data-structures/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Probabilistic data structures&lt;/strong&gt; answer questions about very large data sets using a small, fixed amount of memory, in exchange for a small, &lt;strong&gt;quantifiable error&lt;/strong&gt;. Exact answers would need memory proportional to the data; these need kilobytes or megabytes regardless of size.&lt;/p&gt;</description></item><item><title>Modern Java: Records, Sealed Classes and Pattern Matching</title><link>https://samirsahoo.github.io/design-patterns-hub/java/fundamentals/modern-java-features/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/fundamentals/modern-java-features/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Modern Java (16 to 21, refined through 25 LTS and 27) adds features for modelling &lt;strong&gt;data as data&lt;/strong&gt;:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;records&lt;/strong&gt; for transparent, immutable data carriers&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;sealed types&lt;/strong&gt; for closed sets of alternatives&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;pattern matching&lt;/strong&gt; to safely take data apart and branch on its shape.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Together these are called &lt;strong&gt;data-oriented programming&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Command Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/command/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/command/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Command&lt;/strong&gt; pattern wraps a request — &amp;ldquo;insert this text at position 5&amp;rdquo; — in an &lt;strong&gt;object&lt;/strong&gt;. Because the request is now a value, it can be stored in a history, undone, redone, queued for later, sent to another thread or logged and replayed.&lt;/p&gt;</description></item><item><title>Reflection API and Dynamic Proxies</title><link>https://samirsahoo.github.io/design-patterns-hub/java/fundamentals/reflection-and-dynamic-proxies/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/fundamentals/reflection-and-dynamic-proxies/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Reflection&lt;/strong&gt; lets a program &lt;strong&gt;inspect and use&lt;/strong&gt; classes, methods, fields, constructors and annotations &lt;strong&gt;at runtime&lt;/strong&gt;, without knowing them at compile time.&lt;/li&gt;&#10;&lt;li&gt;A &lt;strong&gt;dynamic proxy&lt;/strong&gt; is an object created at runtime that &lt;strong&gt;implements interfaces&lt;/strong&gt; (or subclasses a class) and routes every method call through your handler code.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Together they are the engine behind dependency injection, AOP, ORMs, serialisation and test mocks.&lt;/p&gt;</description></item><item><title>Designing a Stock Exchange</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/stock-exchange/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/stock-exchange/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;An exchange matches buy and sell orders for securities. Its requirements are unlike a typical web system: &lt;strong&gt;latency is measured in microseconds&lt;/strong&gt;, &lt;strong&gt;fairness&lt;/strong&gt; demands a strict, deterministic order of events, and &lt;strong&gt;correctness&lt;/strong&gt; cannot be compromised. ByteByteGo describes how a modern exchange achieves microsecond latency by keeping the &lt;strong&gt;critical path&lt;/strong&gt; short and doing everything on it in memory. Follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Interpreter Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/interpreter/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/interpreter/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Interpreter&lt;/strong&gt; pattern defines a class for each rule of a small language&amp;rsquo;s &lt;strong&gt;grammar&lt;/strong&gt;. A sentence in the language is parsed into a tree of these objects (an &lt;strong&gt;abstract syntax tree&lt;/strong&gt;, AST), and calling &lt;code&gt;interpret(context)&lt;/code&gt; on the root evaluates it recursively.&lt;/p&gt;</description></item><item><title>Designing a Ride-Sharing Service (Uber, Lyft)</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/ride-sharing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/ride-sharing/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A ride-sharing service matches riders with nearby drivers in seconds, tracks the trip on a map, and charges at the end. It looks like the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/proximity-service/"&gt;proximity service&lt;/a&gt;, with one crucial difference: &lt;strong&gt;the points move&lt;/strong&gt;. Millions of drivers send their location every few seconds, so the geospatial index is write-heavy and must live in memory. Follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Iterator Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/iterator/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/iterator/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Iterator&lt;/strong&gt; pattern gives a way to visit the elements of a collection &lt;strong&gt;one at a time, without exposing how the collection is stored&lt;/strong&gt;: an array, a linked list, a tree, a database cursor or pages from a remote API.&lt;/p&gt;</description></item><item><title>Designing a Metrics Monitoring and Alerting System</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/metrics-monitoring/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/metrics-monitoring/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A monitoring system collects numeric measurements (CPU, request rate, error count, latency histograms) from thousands of servers, stores them as &lt;strong&gt;time series&lt;/strong&gt;, draws dashboards and &lt;strong&gt;alerts&lt;/strong&gt; humans when something is wrong. ByteByteGo covers the &amp;ldquo;metrics monitoring and alerting system&amp;rdquo; and the question &amp;ldquo;which database shall I use for metrics?&amp;rdquo;. Follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Designing a Flash Sale System</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/flash-sale/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/flash-sale/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;flash sale&lt;/strong&gt; puts a small amount of stock (say 10,000 discounted consoles) on sale at a precise moment. Millions of users press &amp;ldquo;Buy&amp;rdquo; within seconds — traffic hundreds of times higher than normal, almost all of it doomed to fail. The system must stay up, &lt;strong&gt;never oversell&lt;/strong&gt;, and treat users fairly. ByteByteGo&amp;rsquo;s flash sale design lists the principles; this page applies them with the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Mediator Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/mediator/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/mediator/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Mediator&lt;/strong&gt; pattern puts the rules for how a group of objects interact into &lt;strong&gt;one object&lt;/strong&gt;, the mediator. The objects (colleagues) report events to the mediator instead of calling each other; the mediator decides what happens next.&lt;/p&gt;</description></item><item><title>Designing File Storage and Sync (Dropbox, Google Drive)</title><link>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/file-storage-sync/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/file-storage-sync/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;a class="heading-anchor" href="#overview" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A file sync service keeps a folder identical across a user&amp;rsquo;s laptop, phone and the cloud, and lets users share files. The key insight is to &lt;strong&gt;separate metadata from content&lt;/strong&gt;: files are split into &lt;strong&gt;content-addressed chunks&lt;/strong&gt; stored in object storage, while a strongly consistent metadata service records which chunks make up each file version. This also covers the &amp;ldquo;file upload service&amp;rdquo; design. Follows the &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/introduction/"&gt;18-step framework&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Memento Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/memento/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/memento/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Memento&lt;/strong&gt; pattern lets an object save a &lt;strong&gt;snapshot&lt;/strong&gt; of its internal state and later restore it, while keeping that state &lt;strong&gt;private&lt;/strong&gt;: other objects can store snapshots but cannot read or change what is inside them.&lt;/p&gt;</description></item><item><title>Observer Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/observer/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/observer/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Observer&lt;/strong&gt; pattern lets an object (the &lt;strong&gt;subject&lt;/strong&gt;) keep a list of interested objects (&lt;strong&gt;observers&lt;/strong&gt;) and notify all of them automatically when something happens. The subject knows only that observers implement a small interface; it does not know what they do.&lt;/p&gt;</description></item><item><title>State Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/state/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/state/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;State&lt;/strong&gt; pattern moves state-specific behaviour into separate &lt;strong&gt;state objects&lt;/strong&gt;. The main object (the &lt;strong&gt;context&lt;/strong&gt;) delegates each request to its current state object, and the state object decides what to do and which state comes next. To the outside, the object appears to change its class.&lt;/p&gt;</description></item><item><title>Strategy Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/strategy/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/strategy/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Strategy&lt;/strong&gt; pattern defines a family of algorithms, puts each one in its own class behind a common interface, and lets the client choose which one to use. The code that &lt;em&gt;uses&lt;/em&gt; the algorithm does not change when you add a new one.&lt;/p&gt;</description></item><item><title>Template Method Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/template-method/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/template-method/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Template Method&lt;/strong&gt; pattern puts the &lt;strong&gt;fixed outline of an algorithm&lt;/strong&gt; in a base-class method (the template method) and leaves certain &lt;strong&gt;steps&lt;/strong&gt; for subclasses to implement. Subclasses change the steps, never the order.&lt;/p&gt;&#10;&lt;p&gt;GoF intent: &lt;em&gt;&amp;ldquo;Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm&amp;rsquo;s structure.&amp;rdquo;&lt;/em&gt;&lt;/p&gt;</description></item><item><title>Visitor Pattern</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/visitor/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/visitor/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Visitor&lt;/strong&gt; pattern moves an operation out of the classes it works on and into a separate &lt;strong&gt;visitor&lt;/strong&gt; object. Each class in the hierarchy has one generic &lt;code&gt;accept(visitor)&lt;/code&gt; method; adding a new operation means writing a new visitor, not editing every class.&lt;/p&gt;</description></item><item><title>Compound Patterns: How MVC Combines Observer, Strategy and Composite</title><link>https://samirsahoo.github.io/design-patterns-hub/design-patterns/compound-patterns-mvc/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/design-patterns/compound-patterns-mvc/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;compound pattern&lt;/strong&gt; is a set of patterns that work together to solve a recurring, larger problem. The best-known is &lt;strong&gt;Model-View-Controller (MVC)&lt;/strong&gt;, which &lt;em&gt;Head First Design Patterns&lt;/em&gt; calls &amp;ldquo;the king of compound patterns&amp;rdquo;. It is built from three GoF patterns:&lt;/p&gt;</description></item><item><title>About this handbook</title><link>https://samirsahoo.github.io/design-patterns-hub/about/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/about/</guid><description>&lt;h2 id="purpose"&gt;Purpose&lt;a class="heading-anchor" href="#purpose" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;Java &amp;amp; Software Architecture Knowledge Hub&lt;/strong&gt; is an open, maintained handbook for two audiences:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Developers preparing for technical interviews or keeping their knowledge current.&lt;/li&gt;&#10;&lt;li&gt;Anyone looking for a precise, practical reference on Java, design patterns, architecture, Domain-Driven Design, microservices and system design.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;It favours depth over breadth: an article is published only when it is complete. Planned topics are listed on each section page as plain text, never as links to empty pages.&lt;/p&gt;</description></item><item><title>Glossary</title><link>https://samirsahoo.github.io/design-patterns-hub/glossary/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/glossary/</guid><description>&lt;p&gt;Definitions are deliberately short. Follow the links for the full explanation, examples and trade-offs.&lt;/p&gt;&#10;&lt;h3 id="a"&gt;A&lt;a class="heading-anchor" href="#a" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;ADR (Architecture Decision Record)&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A short document recording one significant architecture decision: its context, the options, the decision and its consequences. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/software-architecture/introduction/#architecture-decision-records"&gt;Introduction to Software Architecture&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Adapter&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A structural GoF pattern that converts one interface into another that clients expect. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/structural/adapter/"&gt;Adapter Pattern&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Aggregate / aggregate root&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;In DDD, a cluster of objects changed as one unit through a single entry point (the root), which enforces the cluster&amp;rsquo;s invariants. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/domain-driven-design/fundamentals/#aggregate-and-aggregate-root"&gt;DDD Fundamentals&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Anti-Corruption Layer (ACL)&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A translation layer that protects a bounded context&amp;rsquo;s model from another context&amp;rsquo;s model. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/domain-driven-design/strategic/bounded-context/#the-anti-corruption-layer"&gt;What Is a Bounded Context?&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;At-least-once delivery&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A messaging guarantee that every message is delivered, possibly more than once. Consumers must be idempotent.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="b"&gt;B&lt;a class="heading-anchor" href="#b" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Bounded context&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;An explicit boundary within which a domain model and its language are consistent. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/domain-driven-design/strategic/bounded-context/"&gt;What Is a Bounded Context?&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Builder&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A creational GoF pattern that constructs a complex object step by step. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/creational/builder/"&gt;Builder Pattern&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="c"&gt;C&lt;a class="heading-anchor" href="#c" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Cache-aside&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A caching strategy in which the application reads from the cache, and on a miss loads from the database and populates the cache. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/diagram-patterns/#cache-cache-aside"&gt;Diagram Building Blocks&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Circuit breaker&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A reliability pattern that stops calling a failing dependency for a period, failing fast instead of waiting for timeouts.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Cohesion&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;How strongly the elements inside a module belong together. High cohesion is desirable.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Composition root&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;The single place where an application&amp;rsquo;s object graph is assembled. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/spring/core/dependency-injection/#the-composition-root"&gt;Dependency Injection in Java&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Context map&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A diagram and description of bounded contexts and the relationships between them. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/domain-driven-design/strategic/bounded-context/#context-mapping"&gt;What Is a Bounded Context?&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Coupling&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;The degree to which one module depends on another. Low coupling is desirable.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;CQRS (Command Query Responsibility Segregation)&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;Using separate models for updating data (commands) and reading it (queries).&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="d"&gt;D&lt;a class="heading-anchor" href="#d" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Dependency injection (DI)&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;Supplying an object&amp;rsquo;s dependencies from outside instead of having it create them. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/spring/core/dependency-injection/"&gt;Dependency Injection in Java&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Dependency Inversion Principle (DIP)&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;High-level policy should not depend on low-level details; both should depend on abstractions. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/solid-principles/#d--dependency-inversion-principle"&gt;SOLID Principles&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Distributed monolith&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A system deployed as services that remain tightly coupled — sharing databases or deploying in lockstep. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/microservices/fundamentals/microservices-vs-modular-monolith/#common-mistakes"&gt;Microservices versus Modular Monolith&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Domain event&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A record of something that happened in the domain that domain experts care about, named in the past tense, such as &lt;code&gt;OrderPlaced&lt;/code&gt;.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="e"&gt;E&lt;a class="heading-anchor" href="#e" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Entity&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;In DDD, an object defined by a stable identity rather than by its attributes.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Event sourcing&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;Storing the sequence of state-changing events as the system of record, and deriving current state by replaying them.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Eventual consistency&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A guarantee that, if no new updates are made, all replicas or services will eventually agree on the same value.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="f"&gt;F&lt;a class="heading-anchor" href="#f" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Facade&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A structural GoF pattern that provides one simple interface to a complex subsystem. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/comparisons/adapter-decorator-proxy-facade/"&gt;the wrapper patterns comparison&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Factory Method&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A creational GoF pattern in which subclasses decide which class to instantiate. Not the same as a simple factory or a static factory method. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/creational/factory-method/"&gt;Factory Method Pattern&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="g"&gt;G&lt;a class="heading-anchor" href="#g" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;GoF (Gang of Four)&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;Gamma, Helm, Johnson and Vlissides, authors of &lt;em&gt;Design Patterns&lt;/em&gt; (1994), which catalogued 23 patterns. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/gof-overview/"&gt;the overview&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="h"&gt;H&lt;a class="heading-anchor" href="#h" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Hexagonal Architecture (Ports and Adapters)&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;An architecture style in which the business core defines ports and technology-specific adapters connect to them; dependencies point inwards. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/hexagonal-architecture/layered-vs-hexagonal/"&gt;Layered versus Hexagonal Architecture&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="i"&gt;I&lt;a class="heading-anchor" href="#i" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Idempotency&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;The property that performing an operation several times has the same effect as performing it once. Essential for safe retries. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/order-management-system/#failure-handling"&gt;the order management case study&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Invariant&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A business rule that must always hold, such as &amp;ldquo;an order has at least one line&amp;rdquo;. Aggregates enforce invariants.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Inversion of Control (IoC)&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A principle in which a framework or caller, rather than your code, controls the flow or the choice of collaborators. DI is one form of IoC.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="m"&gt;M&lt;a class="heading-anchor" href="#m" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Modular monolith&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A single deployable application divided into business-aligned modules with enforced boundaries. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/microservices/fundamentals/microservices-vs-modular-monolith/"&gt;Microservices versus Modular Monolith&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="o"&gt;O&lt;a class="heading-anchor" href="#o" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Open/Closed Principle (OCP)&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;Software entities should be open for extension but closed for modification. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/solid-principles/#o--openclosed-principle"&gt;SOLID Principles&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="p"&gt;P&lt;a class="heading-anchor" href="#p" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Port (inbound / outbound)&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;In Hexagonal Architecture, an interface owned by the application core. Inbound ports are how the outside world drives the application; outbound ports are what the application needs from the outside world.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="q"&gt;Q&lt;a class="heading-anchor" href="#q" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Quality attribute&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A measurable property of a system, such as performance, availability or modifiability. Quality attributes drive architecture. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/software-architecture/introduction/#functional-requirements-and-quality-attributes"&gt;Introduction to Software Architecture&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="r"&gt;R&lt;a class="heading-anchor" href="#r" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Read replica&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A copy of a database that serves reads, updated by replication from the primary.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Repository (DDD)&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;An abstraction that gives the illusion of an in-memory collection of aggregates.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="s"&gt;S&lt;a class="heading-anchor" href="#s" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Saga&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A sequence of local transactions across services, with compensating actions to undo earlier steps if a later step fails. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/order-management-system/#data-flow"&gt;the order management case study&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Sharding&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;Splitting data across several databases by a key, to scale writes and storage.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;SOLID&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;Five object-oriented design principles: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation and Dependency Inversion. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/solid-principles/"&gt;SOLID Principles&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;dt&gt;&lt;strong&gt;Strategy&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;A behavioral GoF pattern that puts interchangeable algorithms behind one interface. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/design-patterns/behavioral/strategy/"&gt;Strategy Pattern&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="t"&gt;T&lt;a class="heading-anchor" href="#t" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Transactional outbox&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;Writing outgoing messages to an outbox table in the same transaction as the state change, then publishing them separately, so that state and messages never diverge. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/system-design/case-studies/order-management-system/#the-transactional-outbox"&gt;the order management case study&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="u"&gt;U&lt;a class="heading-anchor" href="#u" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Ubiquitous language&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;The shared vocabulary of developers and domain experts, used consistently in conversation and in code. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/domain-driven-design/fundamentals/#ubiquitous-language"&gt;DDD Fundamentals&lt;/a&gt;.&lt;/dd&gt;&#10;&lt;/dl&gt;&#10;&lt;h3 id="v"&gt;V&lt;a class="heading-anchor" href="#v" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;dl&gt;&#10;&lt;dt&gt;&lt;strong&gt;Value object&lt;/strong&gt;&lt;/dt&gt;&#10;&lt;dd&gt;In DDD, an immutable object defined only by its attributes, with no identity, such as &lt;code&gt;Money&lt;/code&gt;.&lt;/dd&gt;&#10;&lt;/dl&gt;</description></item><item><title>Search</title><link>https://samirsahoo.github.io/design-patterns-hub/search/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/search/</guid><description/></item></channel></rss>