Observer Pattern
Medium — good to knowArchitecture
ELI5 — The Vibe Check
Think of a newsletter. You (the publisher/subject) publish content. Your subscribers (observers) automatically get notified when new content arrives. They subscribed once and get updates forever without you knowing their details. This is how DOM events work in JavaScript — addEventListener is you subscribing to the browser's event subject.
Real Talk
undefined
When You'll Hear This
undefined
Related Terms
Decorator Pattern
You have a Coffee object. You want Coffee with Milk. Coffee with Sugar. Coffee with Milk and Sugar. With inheritance you'd need four classes.
intermediateArchitecture
Event-Driven Architecture
Event-Driven Architecture is like a gossip network. When something happens (order placed!), it broadcasts the news.
intermediateArchitecture
Strategy Pattern
You're writing a sorter and want to sort by price, name, or date depending on user choice.
intermediateArchitecture