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, and the exact places they hide in the standard library. Built to actually stick.

Your progress

Progress is saved in your browser — mark a pattern “learned” on its page and watch the bars fill.

How this guide works

🧭

One pattern, one page

Each page follows the same rhythm: analogy → problem → diagram → idiomatic Go → trade-offs → quiz. Once you learn the rhythm, every pattern is easy to absorb.

📊

See it, then read it

UML structure and sequence diagrams (rendered with Mermaid) make the relationships obvious before you hit a single line of code.

🐹

Go-first, not Java-translated

We show how interfaces, composition and goroutines reshape each classic pattern — and where Go's standard library already uses it.

🧠

Made to remember

Runnable examples, a self-check 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 will make every page that follows click into place. Then work top-to-bottom, or jump straight to whatever you need.

Start here

Creational

How objects get made — controlling instantiation so the rest of your code doesn't have to care about concrete types.

Structural

How objects are composed — assembling types into larger structures while keeping them flexible.

Behavioral

How objects collaborate — assigning responsibilities and managing the flow of communication between them.

14 · Intermediate Chain of Responsibility

Pass a request along a chain of handlers until one of them handles it, decoupling sender from receiver.

✦ Complete
15 · Intermediate Command

Turn a request into a standalone object, letting you parameterize, queue, log, and undo operations.

✦ Complete
16 · Advanced Interpreter

Define a grammar for a simple language and an interpreter that evaluates sentences by walking an expression tree.

✦ Complete
17 · Beginner Iterator

Provide a way to access the elements of a collection sequentially without exposing its underlying representation.

✦ Complete
18 · Intermediate Mediator

Centralize communication between objects in a mediator, so they don't refer to each other directly.

✦ Complete
19 · Intermediate Memento

Capture and externalize an object's internal state so it can be restored later — without violating its encapsulation.

✦ Complete
20 · Intermediate Observer

Define a one-to-many dependency so that when one object changes state, all its dependents are notified automatically.

✦ Complete
21 · Intermediate State

Let an object alter its behavior when its internal state changes, as if it changed class.

✦ Complete
22 · Beginner Strategy

Define a family of interchangeable algorithms, encapsulate each one, and select which to use at runtime.

✦ Complete
23 · Intermediate Template Method

Define the skeleton of an algorithm once, deferring the steps that vary to per-type implementations.

✦ Complete
24 · Advanced Visitor

Add new operations to a set of object types without modifying those types, by moving each operation into a visitor.

✦ Complete

Go Concurrency Patterns

The patterns that make Go special — goroutines and channels composed into pipelines, pools and safe cancellation.

Go & the standard library

🐹 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'll call out when a pattern becomes a one-liner in Go — and when it's still genuinely useful.