Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+16 votes
asked in CSC305 Fall 2022 by (8 points)

3 Answers

+5 votes
Best answer

The view relates strictly to what the user sees (perhaps also "hears", other senses), and how your application appears (usually visually) to the user.

The data model is the (non-visual) representation of what the data is (that the application is working with / manipulating).

The controller often facilitates interactions between the view and the data model, especially including handling UI events.

Note: In JavaFX, a lot of the view can often be specified in an FXML file, but there are also often some elements that cannot -- (for example, the JavaFX 3D stuff) -- which are still considered part of the view. Also, if you were to create your own JavaFX class (e.g. a subclass of Canvas), that would likely be considered part of the view as well (although it might also include some aspects of the Controller, depending on how you coded it).

And of course, instead of FXML, you can also choose to create the view by calling Java methods, like the https://math.hws.edu/javanotes/ textbook did.

answered by (2k points)
selected by
+9 votes

The view is always the visual part so it's what the user would see, like a .fxml file for instance. data models are usually classes the programmer uses in the back end to build the program.

answered by (8 points)
+7 votes

I'm not 100 percent sure about it, but if we think about our project this semester, we save all the classes that are related to fxml documents in UI package while we save all the other data models like features in the map, file exporter, and file IO classes in data model package.
So, I assume that it is pretty straight forward like your question: classes, interfaces, etc that deals with behind the scene things that clients don't get to see go into data model package meanwhile, UI stuff like fx controller classes go into UI package.

Please correct me if I'm wrong.

answered by (8 points)