tag

Structural Patterns

Flyweight Pattern

Sometimes the problem isn’t CPU — it’s memory. You have thousands or millions of tiny objects that mostly look the same, and your heap starts to complain. The Flyweight pattern is …

Facade Pattern

You may have used a library that feels like “call this one function and everything just happens”. Behind that one function, there’s usually a lot of orchestration. The Facade …

Decorator Pattern

Think of adding toppings to a pizza or filters to a photo: you start with something simple, then wrap it with extra behavior. You don’t need a new “class” of pizza for every …

Composite Pattern

Files and folders. Menu items and submenus. Shapes and groups of shapes. We constantly work with part–whole hierarchies, and we’d really like to treat “a single item” and “a group …

Bridge Pattern

Sometimes your class hierarchy starts to explode: circles vs squares, vector vs raster, light theme vs dark theme… and suddenly you’re staring at a grid of combinations. The Bridge …

Adapter Pattern

We run into adapters in real life all the time: power‑plug adapters, HDMI–to–USB‑C dongles, language interpreters. Software has the same problem — two sides that need to talk, but …

Proxy Pattern

Any time you click something and it looks like the real object, but behind the scenes there’s access control, caching, logging, or lazy loading happening — that’s the Proxy pattern …