Strategy

Strategy encapsulates a family of algorithms behind a single interface and swaps them at runtime. It extends by adding a strategy instead of editing an if/switch. In languages with first-class functions, a separate Strategy class collapses into a single function.

March 3, 2024 · 4 min read

Ad Fallback Server Design Retrospective

Designing a Nest.js-based fallback server while removing a legacy ad server. Why a horizontal layered architecture fit better than Nest.js’s default vertical module slicing for a single API with complex business logic.

February 28, 2024 · 3 min read

Nest.js Fundamentals — DI and Module System

Nest.js provides a DI container and Module system at the framework level in the Node.js ecosystem. A summary of its core design principles: IoC, DI, Module, and Provider.

February 26, 2024 · 5 min read

Facade

Facade provides a simple entry point to a complex subsystem, cutting the coupling between the client and the internals. A service layer or a library SDK is effectively a Facade. It differs from Adapter (interface conversion) and Mediator (two-way coordination).

February 25, 2024 · 3 min read

Layered Architecture and Dependency Inversion

Layered architecture separates code into horizontal layers by technical responsibility. A summary of the four-layer structure, dependency direction rules, and how DIP decouples layers.

February 23, 2024 · 4 min read

Kafka Fundamentals and KRaft Mode

Core Kafka concepts (topics, partitions, consumer groups, replication) and the background behind KRaft mode, which removes the ZooKeeper dependency.

February 22, 2024 · 9 min read

Implementing Hexagonal Architecture in Go

Core concepts of Hexagonal Architecture and its idiomatic implementation in Go using implicit interfaces and package structure for dependency direction control.

February 21, 2024 · 5 min read

Decorator

Decorator replaces the subclass explosion of inheritance with composition. It stacks wrappers that keep the same interface to add behavior at runtime. java.io, Python function decorators, and web middleware chains are all variations on the same intent.

February 18, 2024 · 4 min read

Builder

Builder is the answer when three limits of constructors meet at once — many parameters, some optional, and step-wise validation. With fewer than all three, simpler tools suffice. When the language provides rich named/default parameters, the need for Builder shrinks as well.

February 11, 2024 · 5 min read

Factory

Factory’s shared intent is separating creation from use. The three variants — Factory Method, Abstract Factory, and Static Factory Method — split creation differently and suit different conditions. Static Factory Method is the variant most often encountered in practice, and DI containers absorb part of Factory’s explicit role.

February 4, 2024 · 5 min read