In MVC what is a GUI model in opposition to Application model?

ぐ巨炮叔叔 提交于 2020-05-17 05:59:12

问题


When developing Java Swing MVC apps, what is a GUI model in opposition to an Application Model? And why is it relevant to MVC?

I read about it the example here (the example does not use a GUI model though). Found more information about it here, here and here. Also in A Swing Architecture Overview in the section GUI-state vs. application-data models.

To cite the author of the example:

Finally, this is how I implement the model / view / controller pattern (MVC) in Java Swing.

The view may read values from the model. The view may not change values in the model.

The controller will (probably) change values in the model.

The controller will (probably) cause the view to repaint.

I don’t have one master controller, usually. I let each controller do its thing.

I do usually have one master model. Sometimes, you need more than one GUI model. This isn’t one of those times. The GUI model is usually separate from the application model, when your GUI is part of a much larger Java application.


回答1:


The key lies in the abbreviation 'MVC' which means Model View Control. An application that complies with the MVC principle differentiates the data model (business data) from the control (the logic managing the business data) from the view (the code managing the graphical user interface - or GUI for short).

Thus a GUI model is a model of the UI, while an application model is a model not specific to a portion of the MCV model. It could theoretically cover the entire application. It is maybe worth mentioning, that I use the word model synonymously with descriptive representation, as in a class model, or a control flow chart. But model can mean more in other contexts. For example the combined set of business classes can also be called the business model, while the combined classes in an application could be called the application model.



来源:https://stackoverflow.com/questions/61592729/in-mvc-what-is-a-gui-model-in-opposition-to-application-model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!