Observer — RexDac Academy

RexDac AcademyTechnical notes · Some prior knowledge helps
0%Published notes read · this device

Principles and Architecture / Design patterns / Behavioral

Observer

Original notes by SunDiaL · View English source

The problem: You have an event that you need to react to. Interested Clients could Poll to check whether the event happened, or you could call everyone to inform them that the event happened, but both options are obviously inefficient. The solution: Have an array of Subscribers.

This pattern became baked into the language and is how native Events work.