Observer Pattern in Java with notifyObservers()

Hey fellow developers,

I've got a question in my mind about the notifyObservers() method when using the Observer pattern. Like there are 2 main ways in calling notifyObservers():
1. The observed data object (ConcreteModel) calls notifyObservers() after a change is registered.

  1. The Observer (ConcreteObserver) calls notifyObservers() after a change is registered.

Like what are disadvantages or advantages of this? Is it in any way important how I call them (seen from a software engeering standpoint!). I see that 2. leads to more interlinking between the 2 classes, which shouldn't be too good.. But what do you think is the better approach and why?

submitted by /u/red_arma
[link] [comments]

from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/2O4jwt1

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close