2009年6月3日星期三

[fw-mvc] Pattern / example?

Anyone happen to have their models designed to "render" themselves?
For example:

$model->display();

or

$model->draw();

This is more of a general OOP question, but I'd like to apply it as
much to ZF as possible since that's where I'll be implementing it. I
read how you're supposed to design your objects and assign them the
responsibilities to manage themselves. The article (mentioned in my
last thread) gave the example of having the model draw itself. It
sounds neat, so I'd like to try it and I'm wondering how to approach
it. I'm guessing the model would generate the data, send it to an
adapter of some sort, the adapter would apply a template (or
whatever), results would return to the model, which then returns the
results to the originating code. Is that correct? Anyone know / have
examples?

Thanks,

Ed

没有评论: