In MVC Pattern: when user types something, Control will “translate” user input to Model to process data.
But, in other scene, for example my form has a list box and load data from database when it’s loading.
So, the loading method I should put in The View or I should call this through Control.
For example:
View:
public void Loading(){
//some init here
//load data from database
}
public void Loading(){
//some init here
//control.loadDatabase();
}
Which is the best in this pattern. Please give me an advice.
Thanks 🙂
The relationship between the model and the view is described by a design pattern, called Observer, whereby the model is the subject, and the view an observer.
That means that the model notifies the view, when there is new data available.