Jesus
Jesus

Reputation: 1126

MVC, can Model have a Controller instance?

it's a short question, according to this: http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

Can I do a MVC implementation where my Model have a Controller instance? I mean something like this:

enter image description here

The blue arrow means Updates.

Thanks for your time.

Upvotes: 0

Views: 523

Answers (2)

Sviatoslav Yakymiv
Sviatoslav Yakymiv

Reputation: 7935

It's better to use Observer pattern for update.

Here is good description of MVC(as for me): https://developer.apple.com/library/ios/documentation/general/conceptual/CocoaEncyclopedia/Model-View-Controller/Model-View-Controller.html

Upvotes: 1

Pevara
Pevara

Reputation: 14310

I believe not.

Personally I would put the update method in the model layer, probably in my DataObjectMapper, and call it from the controller.

Your models should never talk to the controller, only the other way round.

Upvotes: 1

Related Questions