0

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.

Community
  • 1
  • 1
Piovezan
  • 3,215
  • 1
  • 28
  • 45
  • 1
    GUI model might be data classes that are consumable by UI. Role of controller would be to translate from application (business layer) model to UI model since they does not necessarily have to be identical. – mlc May 04 '20 at 13:03

1 Answers1

0

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.

TreffnonX
  • 2,924
  • 15
  • 23