🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Programming Concepts Intermediate

What is Observer Pattern?

A design pattern where an object (subject) maintains a list of dependents (observers) that are notified automatically of state changes.

The Observer pattern establishes a one-to-many dependency between objects. When the subject changes state, all registered observers are notified and updated automatically. This decouples the subject from its observers — the subject doesn't need to know what the observers do with the notification. Examples include event listeners in JavaScript (addEventListener), pub/sub messaging, reactive streams (RxJS), and MVC frameworks where views observe model changes. Variants include push (subject sends data with notification) and pull (observers query the subject after notification). The pattern is fundamental to reactive programming and event-driven systems.

Related Terms

Regex (Regular Expression)
A sequence of characters that defines a search pattern, used for string matching, validation, and text manipulation.
Garbage Collection
An automatic memory management process that identifies and reclaims memory no longer in use by a program.
API Design
The practice of designing application programming interfaces that are consistent, intuitive, and maintainable for developers to consume.
Algorithm
A step-by-step procedure for solving a problem or performing a computation, defined as a finite sequence of instructions.
Queue
A data structure that follows First-In-First-Out (FIFO) ordering, where elements are added at the rear and removed from the front.
Object-Oriented Programming (OOP)
A programming paradigm that organizes software design around objects containing data and behavior.
View All Programming Concepts Terms →