Learning about observer and publisher/subscriber pattern