0

I have read this tutorial: http://www.tutorialspoint.com/design_pattern/mvc_pattern.htm

I have found it very understandable, but the structure of this Model-View-Controller is different from other examples.

In this tutorial, Controller is using data from Model (Student) and is updating View (StudentView) with new data.

But according the scheme on this picture, Controller is manipulating the Model and Model is updating View. According to this scheme Controller has link to Model, and Model has link to View (or I am wrong?).

This difference is confusing me. Can anyone help me and explain me the correct structure of MVC pattern.

enter image description here

4
  • theres no way the model should update the view IMO. The controller should gather what it needs, reorder or somehow process the data it needs to render the view for the user. Commented Mar 17, 2015 at 8:42
  • MVC has various types, the one in your pic being the typical one Commented Mar 17, 2015 at 8:51
  • I have also read that Model can notify Views about some changes in it. Commented Mar 17, 2015 at 8:53
  • So we can use any of this types of MVC according to our needs, and every type is suitable for some certain situation. I have thought that there is only one classical MVC pattern. Commented Mar 17, 2015 at 9:06

1 Answer 1

1

There is no one MVC pattern as each language or framework will define it slightly different. We know Controller encapsulate the business logic, process the user request, and send it to the Model. The Model contains the data and may contains some logic to validate itself or notify subscribers of change. The View formats the data, responds to notifies from the model or controller, and presents it to the user. Typically MVC refers to the patterns Observer, Composite, and Strategy and will often employ Factory, Decorator, and other patterns to achieve MVC. (Design Patterns Elements of Reusable Object-Orient Software)

As to the diagram, I would say it is mostly accurate. Just a poor choice of wording. Update vs Notify

Sign up to request clarification or add additional context in comments.

1 Comment

I have read that there are two original types of MVC: active and passive. In passive variant Controller is updating View with new data. And in active MVC, Model is notifying View to update.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.