designpattern.site

Design Patterns

OOP design patterns with interactive diagrams and code examples in TypeScript, Python, Java, and Go.

Design patterns are reusable solutions to commonly occurring problems in software design. Each pattern page includes a class diagram, implementation examples in all four languages, and a discussion of trade-offs.

Creational Patterns

These patterns deal with object creation mechanisms, aiming to create objects in a manner suitable to the situation.

PatternDescription
SingletonEnsure a class has only one instance and provide a global access point
Factory MethodDefine an interface for creating objects, letting subclasses decide which class to instantiate
Abstract FactoryProduce families of related objects without specifying their concrete classes
BuilderConstruct complex objects step by step, separating construction from representation
PrototypeClone existing objects without coupling to their classes

On this page