In a MVC approach, who is responsible to create a right view for one specific model?
I have two classes C
and D
both subclass of A
. My controller knows how to manage instances of A
but it needs to instantiate differents views when objects are instances of C
or D
.
I have three possible approacs:
I can move the complexity on the model, adding a method like getView
but i think the model has to be more light as possible.
I can move the complexity on the controller, adding a switch based on model's class, but in this way the controller has to know all internals detail of the model.
I can move the complexity on the view, adding a metod like createViewForModel() but i have to put a switch inside this method...and is not a good thing.
Can someone share a link or a discussion about this topic? thanks