PatternCategoryThe 10-Second SummaryReal-World Backend Context
Abstract FactoryCreationalA factory of factories. Creates families of related objects.Swapping entire cloud SDKs (e.g., an AWS Factory creating SQS/S3 vs. a Local Factory creating Kafka/MinIO).
SingletonCreationalEnsures only one instance of a class exists.The default behavior of a Spring Bean.
PrototypeCreationalClones an existing object instead of building from scratch.Using @Scope("prototype") in Spring for stateful, non-shared components.
BridgeStructuralSeparates an interface from its implementation so both can vary independently.Your service layer interface (Abstraction) talking to different database drivers (Implementation).
CompositeStructuralTreats a group of objects the exact same way as a single object (Tree structure).Parsing JSON/XML structures, or representing a hierarchical file system.
FlyweightStructuralShares massive amounts of fine-grained data to save RAM.The Java String pool, or caching standard AWS Region configurations across millions of requests.
Chain of ResponsibilityBehavioralPasses a request along a chain of handlers until one handles it.Spring Security Filter Chain (Checking CORS, then Auth, then Roles).
CommandBehavioralTurns a request into a standalone object containing all info about it.Sending tasks to an AWS SQS queue or a Kafka topic to be executed asynchronously.
IteratorBehavioralLets you traverse a collection without exposing its underlying representation.Using List.iterator() or Stream API to loop through database query results.
MementoBehavioralCaptures and restores an object’s internal state (Undo mechanism).Implementing rollback features in distributed transactions (Saga pattern).
Template MethodBehavioralDefines the skeleton of an algorithm in a base class, letting subclasses override specific steps.Spring’s JdbcTemplate or RestTemplate.
VisitorBehavioralSeparates an algorithm from the object structure on which it operates.Exporting a massive graph of distinct microservice logs into a single unified JSON report.