Implements the observer or pub/sub pattern