Interactive learning journey
Design Patterns, the Go way
Every classic Gang-of-Four pattern and Go's essential concurrency patterns — explained with clear diagrams, idiomatic Go you can run right here, and the exact places they hide in the standard library. Built to actually stick.
Saved in your browser — mark a pattern “learned” on its page and watch the bars fill.
Skill map
Learned nodes light up — the glowing one is your next step. Click any node to jump in.
How this guide works
One pattern, one page
Every page follows the same rhythm: analogy → problem → diagram → idiomatic Go → trade-offs → quiz.
See it, then read it
UML structure and sequence diagrams make the relationships obvious before you read a line of code.
Go-first, not translated
How interfaces, composition and goroutines reshape each classic pattern — and where the stdlib uses it.
Made to remember
Runnable code, a quiz on every page, and progress tracking turn passive reading into a journey you finish.
🚀 New here? Start with the Foundations
Five minutes on what patterns are and why Go does them differently makes every page that follows click into place. Then work top-to-bottom, or jump to whatever you need.
Start here
Creational
How objects get made — controlling instantiation so the rest of your code never cares about concrete types.
Ensure a type has only one instance, and provide a single, well-defined point of access to it.
✦ Complete · ⏱ 5 min 3 · Beginner Factory MethodDefine an interface for creating an object, but let the implementation decide which concrete type to instantiate.
✦ Complete · ⏱ 5 min 4 · Intermediate Abstract FactoryProvide an interface for creating families of related objects without specifying their concrete types.
✦ Complete · ⏱ 4 min 5 · Intermediate BuilderConstruct a complex object step by step, separating how it's built from its final representation.
✦ Complete · ⏱ 4 min 6 · Intermediate PrototypeCreate new objects by cloning an existing, configured instance instead of building one from scratch.
✦ Complete · ⏱ 4 minStructural
How objects are composed — assembling types into larger structures while keeping them flexible.
Convert the interface of a type into another interface clients expect, letting otherwise-incompatible types work together.
✦ Complete · ⏱ 3 min 8 · Advanced BridgeDecouple an abstraction from its implementation so the two can vary independently, instead of multiplying into N×M types.
✦ Complete · ⏱ 3 min 9 · Intermediate CompositeTreat individual objects and compositions of objects uniformly through one common interface.
✦ Complete · ⏱ 5 min 10 · Intermediate DecoratorAttach new behavior to an object by wrapping it in another object of the same interface — without changing the original's type.
✦ Complete · ⏱ 4 min 11 · Beginner FacadeProvide a single, simplified interface over a complex subsystem, so clients don't have to orchestrate its parts.
✦ Complete · ⏱ 3 min 12 · Advanced FlyweightShare common immutable state across many objects to slash memory use, keeping only per-instance data separate.
✦ Complete · ⏱ 3 min 13 · Intermediate ProxyProvide a stand-in for another object that implements the same interface, to control access to it.
✦ Complete · ⏱ 3 minBehavioral
How objects collaborate — assigning responsibilities and managing the flow of communication.
Pass a request along a chain of handlers until one of them handles it, decoupling sender from receiver.
✦ Complete · ⏱ 4 min 15 · Intermediate CommandTurn a request into a standalone object, letting you parameterize, queue, log, and undo operations.
✦ Complete · ⏱ 3 min 16 · Advanced InterpreterDefine a grammar for a simple language and an interpreter that evaluates sentences by walking an expression tree.
✦ Complete · ⏱ 4 min 17 · Beginner IteratorProvide a way to access the elements of a collection sequentially without exposing its underlying representation.
✦ Complete · ⏱ 4 min 18 · Intermediate MediatorCentralize communication between objects in a mediator, so they don't refer to each other directly.
✦ Complete · ⏱ 3 min 19 · Intermediate MementoCapture and externalize an object's internal state so it can be restored later — without violating its encapsulation.
✦ Complete · ⏱ 3 min 20 · Intermediate ObserverDefine a one-to-many dependency so that when one object changes state, all its dependents are notified automatically.
✦ Complete · ⏱ 5 min 21 · Intermediate StateLet an object alter its behavior when its internal state changes, as if it changed class.
✦ Complete · ⏱ 4 min 22 · Beginner StrategyDefine a family of interchangeable algorithms, encapsulate each one, and select which to use at runtime.
✦ Complete · ⏱ 5 min 23 · Intermediate Template MethodDefine the skeleton of an algorithm once, deferring the steps that vary to per-type implementations.
✦ Complete · ⏱ 4 min 24 · Advanced VisitorAdd new operations to a set of object types without modifying those types, by moving each operation into a visitor.
✦ Complete · ⏱ 4 minGo Concurrency Patterns
The patterns that make Go special — goroutines and channels composed into pipelines, pools and safe cancellation.
Process a stream of data through a series of stages connected by channels, where each stage is a goroutine.
✦ Complete · ⏱ 4 min 26 · Intermediate Fan-out / Fan-inDistribute work across multiple goroutines (fan-out) and merge their results back into one stream (fan-in).
✦ Complete · ⏱ 3 min 27 · Beginner Worker PoolBound concurrency by feeding jobs to a fixed number of long-lived worker goroutines.
✦ Complete · ⏱ 3 min 28 · Beginner GeneratorProduce a stream of values from a goroutine over a channel, lazily and on demand.
✦ Complete · ⏱ 3 min 29 · Intermediate Or-done ChannelWrap a value stream so that ranging over it also stops cleanly the moment a cancellation signal fires.
✦ Complete · ⏱ 2 min 30 · Intermediate Context & CancellationPropagate cancellation, deadlines, and request-scoped values across API boundaries and goroutine trees with context.Context.
✦ Complete · ⏱ 3 min 31 · Intermediate SemaphoreLimit how many goroutines may run a section of code (or hold a resource) at the same time.
✦ Complete · ⏱ 2 min 32 · Intermediate errgroupRun a group of goroutines, wait for them all, capture the first error, and cancel the rest automatically.
✦ Complete · ⏱ 2 min 33 · Intermediate Pub/SubBroadcast events to many dynamic subscribers through a broker, decoupling producers from consumers.
✦ Complete · ⏱ 3 minGo & the standard library
A tour of the classic design patterns hiding in plain sight across Go's standard library.
Tour · ⏱ 4 min PRACTICE · Reference Patterns Cheat-SheetA one-page map of every pattern — its intent, the idiomatic Go form, and when to reach for it. Built for revision and interview prep.
Revise · ⏱ 4 min🐹 A note on Go and patterns
Many “patterns” are really workarounds for things Java and C++ make hard. Go's interfaces, struct embedding, first-class functions and goroutines dissolve some of them and reshape the rest. Throughout this guide we call out when a pattern becomes a one-liner in Go — and when it's still genuinely useful.