Observer pattern implements a publish/subscribe mechanism between objects. Some subscribing objects want to observe the state change of a specific object, and the observer pattern enables the publishing object(subject) to notify other objects about changes. This article demonstrates Observer pattern implementations in PHP.
Observer pattern is used to set up one or more notifiers/publishers, and some subscribers for those notifiers. So that the subscribers get the change info when the notifier triggers a change event. The notifiers are subscribers are decoupled from each other, so the subscriber does not need to know how many notifiers/publishers are there. This article demonstrates Observer pattern implementations in Golang.