I've designed an MVC (in .NET) where the View has no link to the Model. It only knows about the Controller. The traditional MVC pattern has all parts communicating with each other. In my case, the Controller is basically a mediator. This keeps any exceptions or logic out of the View. It has zero dependency on the Model. Is this no longer an MVC?
问题:
回答1:
What you are describing is actually a subset of Model-View-Controller called Passive View.
Passive View is yet another variation on model-view-controller and model-view-presenter. As with these the UI is split between a view that handles display and a controller that responds to user gestures. The significant change with Passive View is that the view is made completely passive and is no longer responsible for updating itself from the model. As a result all of the view logic is in the controller. As a result, there is no dependencies in either direction between the view and the model.
Martin Fowler talks about it in the above link and briefly discusses other variations here.
回答2:
I guess rather than MVC, it's just VC then, eh? ;)
In MVC implementations, the view subscribes to changes in the model, and acts on the controller; the controller makes changes on the model, which get propagated to the views by way of their reference to the model. In your case, it sounds more like you've buried your model in your controller (after all, you've got to get your data from somewhere); that's not necessarily bad or anything, but it's also not MVC in the strict sense.
回答3:
Your approach seems a lot like MVP, but I couldn't say for sure without more details.
回答4:
In the strictest of sense, no. But does it have a WAY for the view to communicate with the Model if needed without changing the architecture/interfaces?
[For instance if you have a TalkToModel() method implemented, even though you dont use it YET, its an MVC in my view.]