Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.
Guide · OtherFree

Refactoring.Guru: Design Patterns

A free, illustrated catalogue of the 22 classic design patterns, grouped into creational, structural and behavioural patterns. Each pattern has a real-world analogy, a problem and solution walkthrough, a structure diagram, pros and cons, and code in ten languages. It is the most approachable way to learn patterns after the basics of OOP.

Format

Guide

Topic

Other

Provider

Refactoring.Guru

Time needed

Self paced

Level

Intermediate

Access

Free

What it is

The design patterns section of Refactoring.Guru explains the classic object-oriented design patterns in plain language with illustrations. The catalogue lists 22 patterns grouped by intent: 5 creational patterns (such as Factory Method, Builder and Singleton), 7 structural patterns (such as Adapter, Decorator and Composite) and 10 behavioural patterns (such as Strategy, Observer, Command and State). Introductory pages explain what a pattern is, the history of patterns, why they are useful and the common criticism of them.

What each pattern page has

Each pattern starts with the problem it solves, told through a small story, then the solution, a real-world analogy, a UML-style structure diagram, pseudocode, when to apply it, how to implement it, pros and cons, and relations to other patterns. Code examples are available in C#, C++, Go, Java, PHP, Python, Ruby, Rust, Swift and TypeScript, so you can read them in the language your course uses.

Who it is for

Students who have learned classes, interfaces, inheritance and composition, and want to see how those tools combine into reusable designs. It also suits developers who see pattern names in code reviews or framework documentation and want a quick, clear explanation.

Why it is worth your time

Patterns are often taught as a list of UML diagrams to memorise. This site focuses on the problem first, which is the part that helps you recognise when a pattern fits and, just as usefully, when it does not. The pros and cons sections are honest about the cost of each pattern, which helps avoid the common beginner habit of adding patterns everywhere.

Free or paid

All the pattern pages and code examples on the site are free. The same authors sell an ebook, Dive Into Design Patterns, through the site's store; it is optional.

How to use it

Do not read all 22 in one go. Start with Strategy, Observer, Factory Method, Adapter and Decorator, which appear constantly in real code. For each one, read the problem, then try to sketch a solution before reading theirs, and afterwards implement a tiny example in your own language. The same site has a separate section on code smells and refactoring, which pairs well with this one.

Common questions

Do I need to know UML? A little helps, but the diagrams are simple and explained in the text.

Are patterns still relevant with modern languages? Yes, though some become simpler: a Strategy can be a function passed as an argument in Python or TypeScript. Knowing the idea still helps you recognise and name the design.

Is Singleton a good pattern? The site discusses its drawbacks; it is often better avoided in favour of passing dependencies explicitly.

computer sciencejavapythontypescriptcsharpcpp

Ready to start?

Opens on Refactoring.Guru in a new tab.

Open resource
Link broken or out of date?

Report a problem

With "Refactoring.Guru: Design Patterns". Only Tauseef reads this.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.