Think about it like this:

Imagine a clock - the ClockModel would contain information about the current time

you could have 2 seperate views - Analog and Digital

in order for them both to received updates (each 'tick' of the clock) from the model they would 'register' with the model

the model would hold a list of all it's observers and when a notifyObservers() method is called on the model it would send an update to all the views in it's list telling them about it's current state.

a view might also contain user interface controls (for instance, to start and stop the clock) - button might dispatch an event to the controller which checks with the model to see whether the clock is running or not, if it's running, it stops the clock - if it's stopped it starts the clock. the model changes state and broadcasts an update to it's views etc etc. etc.

this is how it works in Actionscript - which i'm familiar with - and in this situation you would certainly want a model to notify a view about things - you might also want the controller to tell the view about things rather than bother the model with it unnecessarily.


On 10/6/06, Chris Hartjes <[EMAIL PROTECTED]> wrote:

On 10/6/06, Marcelo de Moraes Serpa <[EMAIL PROTECTED]> wrote:
> From what I can see, the main purpose of Cake's MVC is to separate things,
> but you can't for example register Views on a model and the model doesn't
> automatically notifies the Views.
>

I don't understand what you mean by "you can't for example register
Views on a model."  Why would you want a view to modify your model?
That violates all sorts of rules about coupling code and defeats the
whole purpose of MVC in my opinion.

A Model returns you data in a format you need
A controller gets data from a model and passes it to a view
A view displays the data that's been passed to it.

"Registering" is a concept I have not heard of and would like an
explanation as to better understand it.   Why would you want a model
to notify a view about something?  Obviously, there is some concept
here I'm not aware of.

--
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to