the observer pattern there are two key roles within the observer patternthese are the observable and the observer roles observable this is the object that is responsible for notifying other objects that change in its state has occurred observer an observer is an object that will be notified of the change in state of the observable and can take appropriate action (such as triggering change in their own state or performing some actionin addition the state is typically represented explicitlystate this role may be played by an object that is used to share information about the change in state that has occurred within the observable this might be as simple as string indicating the new state of the observable or it might be data oriented object that provides more detailed information these roles are illustrated in the following figure in the above figurethe observable object publishes data to data stream the data in the data stream is then sent to each of the observers registered with the observable in this way data is broadcast to all observers of an observable it is common for an observable to only publish data once there is an observer available to process that data the process of registering with an observable is referred to as subscribing thus an observable will have zero or more subscribers (observersif the observable publishes data at faster rate than can be processed by the observer then the data is queued via the data stream this allows the observer to process the data received one at time at its own pacewithout any concern for data loss (as long as sufficient memory is available for the data stream hot and cold observables another concept that it is useful to understand is that of hot and cold observables cold observables are lazy observables that isa cold observable will only publish data if at least one observer is subscribed to it