One way.. or another..
Posted: Wed Jul 26, 2006 5:03 pm
(Apologies for vague title.. it just so happened I was listening to Blondie at the time..)
I'm unsure which way my application should operate when it comes to View <-> Model.
Should my View Controller/Class ask for the page variables from the Model, or should the Model feed them to the View?
E.g.:
vs:
should it be the former and my View class implement:
or, the latter, all my model classes will implement:
I'm at a bit of a cross roads with it, because in all other scenarios, it's always take, not give, but with my view <-> model interaction, it's give..
It works, but it's bugging me.. I like uniformity but also I like to meld with 'the norm', and as I need to revamp one of my projects this would be an ideal time to make this change, however being as indecisive as I am.. what do you guys think?
I'm unsure which way my application should operate when it comes to View <-> Model.
Should my View Controller/Class ask for the page variables from the Model, or should the Model feed them to the View?
E.g.:
Code: Select all
$model = new Model(new View);Code: Select all
$view = new View(new Model);Code: Select all
interface iView
{
public function assignVariable ($var, $val);
public function setTemplate ($template);
}Code: Select all
interface iModel
{
public function getTemplate ();
public function getVariables ();
}It works, but it's bugging me.. I like uniformity but also I like to meld with 'the norm', and as I need to revamp one of my projects this would be an ideal time to make this change, however being as indecisive as I am.. what do you guys think?