3 ms·
what do the controllers actually do? Synchronize state? Verify that constraints are met?
by lallysingh 15y ago
what do the controllers actually do? Synchronize state? Verify that constraints are met?
- dasil003 15y agoI believe the OA's intended question is what are the controllers? Well, what are they? Yes, I know they control things, but what is the actual thing that they are?
- philbarr 15y agoYou're suggesting I call them "StateSynchronizer" or "ConstraintVerifier"?
- lallysingh 15y agoNo, I suggest you name it after what it actually does. "Controller" is a role that's only defined in terms of what it interacts with. It's essentially a declaration of rank with other types; it doesn't say anything about what functionality the class provides. If I'm looking at the components of the software, and I want some code to do X, or wonder what a class Y does, what does "Controller" tell me? If you're doing constraint verification (for example), my preference is to have a container (e.g. vector<>) of Constraint and just run find_if() to see when Constraint::Valid(environment) returns false. Then it's a class called ConstraintVerificationUtil and it has a single static method: VerifyList.
- deleted 15y ago[deleted]
- philbarr 15y ago"Controller" says to me that it's the where all the events are dealt with, so I can have one single place where events are handled. As for "ConstraintVerificationUtil", I personally feel that things that end in -Util are definitely worse than things that end in -er. Maybe that is just personal preference.
- davvid 15y agoArcade games are a good analogy for MVC. The controller is the joystick, buttons, etc. The view is the CRT screen. The model represents the game state.