Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clarification :MVC,MVP,MVVM

I am reading the difference between MVC,MVP,MVVM

Source: here

alt text

My doubt is ,the diagrams (MVP) (MVVM) show bidirectional arrow between Modle and Presenter,Model and ViewModel.

Presenter and ViewModel obviously aware of Model.But does it mean Model is aware of Presenter and ViewModel?

like image 661
ASP.netBeginner Avatar asked Jan 20 '11 19:01

ASP.netBeginner


1 Answers

Presenter and ViewModel obviously aware of Model.But does it mean Model is aware of Presenter and ViewModel?

No. At least, the way I view these patterns, the Model should (ideally) be unaware of anything except itself. I tried to highlight that in my discussion of MVVM by only showing a uni-directional arrow to the Model.

However, many people use an arrow going both ways to/from the Model to represent events raised by the Model. It somewhat depends on how you see this - the Model will likely need to notify other layers of changes within itself. Depending on the language/framework, this may look like the model "talking" to other layers. However, I try to be very careful to keep this completely neutral from the Model's point of view. For example, in C#, I just use an event, where the types are all Model-specific. It knows "something" may be listening to the event, but does not have any knowledge of what comprises that "something".

like image 150
Reed Copsey Avatar answered Sep 21 '22 07:09

Reed Copsey