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.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.