Observasjonsmønster
Observasjonsmønster, also known as the Observer pattern, is a behavioral design pattern in software engineering. It defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically. The object that is being observed is called the "subject" or "observable," and the objects that observe it are called "observers."
The primary purpose of the observasjonsmønster is to decouple the subject from its observers. The subject does
When the subject's state changes, it notifies all registered observers by calling a specific method on each