re: Design Patterns: Observer Pattern VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Just observers knows your target ( Subject ) ? In a relation of One to One ( with direction just observer -> subject , without get back ) I th...
 

Good question Marlysson! I had the same thought when I was reading this chapter. The text doesn’t mention why they chose this design. But they did give another example of the Observer pattern implementation in the JDK, specifically in Swing. And in this example, the Subject constructor take an Observer, and registers it as an observer. So I guess it’s flexile?

 

I agree. When I was studying these patterns emerged the same doubt. I think there are severals design to implement observer pattern, each one suitable to right problem.

code of conduct - report abuse