I have a more general question about how to divide the code and responsibilities of the model, view and controller within the MVC pattern. For a better understanding I am going to use an example case.

My Question

The application is divided into the model, view and controller. How is an error handled during some operation at the model-level which should be displayed in the view ?

I thought of two possibilities:

a) The model saves an error string and notifies the controller and the view. The view then polls the error string from the model and saves it. Afterwards the controller tells the view to display the error.

b) The model returns the error to the controller which passes it to the view to be displayed.

What would you say would fit best to the MVC pattern ? Or what would be closer to the MVC pattern ?

Thank you very much in advance

Related posts

Recent Viewed