I can see several ways of doing this.
-
Have a reference to a single controller in the model. Model sends event to this controller and other controllers get to know it through the hierarchy and passes on to views
-
Have all interested controllers be listeners on the model (the model has a list of listeners ). The view gets to know the change through the controller
-
Have all interested views be listeners on the model. ( The view gets to know the change directly)
Which is appropriate and why?
your third Option is old school. The views get notified by the model, and the view decides how to handle this. It’s okay but other options are better.
your second option sounds good. The views get notified by the controller(make sure you have different controller for updating the views and updating the model). So the controller can modifiy the events before passing them to the view. The controller can hier customise the Data for the views. the View shouldn’t do this, there job is only to show something(in option three the views have to do this).
your first option is a small improvment of option two with a hierarchy. It’s may be better in a complex scenario, to filter the event passing. But normaly this will blow up the overhead. So it is harder to read.
I would choose option two. It’s the best trade of simple code and the option for complex actions.