Hello. I have a project for queues simulation to do and I have to follow the MVC pattern. My classes until now are: Client, Queue which represent the Model, Controller, GUI which is the View, and the Main class. If I have those 2 classes representing the Model, how should I use them in the Controller class? Or I should make another class Model?

Recommended Answers

All 4 Replies

Your model may consist of many classes working together - most models do. Similarly the view will almost certainly need quite a few classes

I understand, but then how I should work with the classes that represent the model in the controller class? Should I have another class which initializes the model with the values from the view, or should I simply use the 2 classes representing the model in the view?

There's no one "correct" answer. In simpler cases the controller initialises a model, then initialises the GUI and passes it a reference to the model. The GIU can then interact directly with the model. In more complex systems the controller plays a bigger role in mediating the GUI/model interactions and hiding each side's complexity from he other side. My guess is that for a college project the first approach will probably be easier.

Thank you for your answers:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.