Search code examples
design-patternsobserver-pattern

Pattern for observer and one subject


If I only have a single observer observing a single subject at all time, do I still use the observer pattern?

Or is there another pattern that will better suit the above scenario?


Solution

  • The observer pattern still suits. But patterns are not set in stone, you can simplify it a bit if you don't need a collection of observers: implement the observer-->subject association as 1:1