4thSpace
4thSpace

Reputation: 44352

Is it MVC when the view doesn't interact with the model?

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?

Upvotes: 5

Views: 1498

Answers (4)

Mostlyharmless
Mostlyharmless

Reputation: 2283

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.]

Upvotes: 0

Christian Nunciato
Christian Nunciato

Reputation: 10409

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.

Upvotes: 1

mmcdole
mmcdole

Reputation: 92825

What you are describing is actually a subset of Model-View-Controller called Passive View.

alt text

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.

Upvotes: 20

Don Branson
Don Branson

Reputation: 13707

Your approach seems a lot like MVP, but I couldn't say for sure without more details.

Upvotes: 0

Related Questions