1

I'm developing a C-based software in which I want to use a Model-View-Controller approach, and while I think I quite got into the style's rules, I don't really understand where should I place the methods about connecting to the server (I'm developing a client). One of the cool things of MVC is unlinking the actual logic of the program from the architecture of the machine and system you're working on, but every machine has different ways of managing connections, so I guess model isn't the best place for that. But controller and view should be about visualizing stuff and taking inputs from the user, so it's not really clear where should I put that.

Any advices?

1 Answers1

1

A view is where you put logic that presents the state of what you are modeling.

A model is where you put logic that manages the state of what you are modeling.

A controller is where put logic that seeks to change the state of what you are modeling.

There can be many views and controllers for the same model. A view might talk to a GUI. It might talk to a server. A controller might get input from a GUI. It might get input from a server.

MVC is about focusing on three areas of responsibility. That doesn't mean you can only have three modules.

candied_orange
  • 119,268