dddshelf / ddd-in-php-book-issues

Leave your comments, improvements or book mistakes as an issue! Thanks ❤️
https://leanpub.com/ddd-in-php
28 stars 2 forks source link

Page 10 mvc pattern figure #83

Closed hoseinz3 closed 7 years ago

hoseinz3 commented 7 years ago

in this figure why model connected to view ?

keyvanakbary commented 7 years ago

In classic MVC it's usual to pass the model to the view as a parameter (imagine passing a User model to the view). Without DTO's this couples the view to the model. The view has to know which methods and attributes the model has in order to render itself.

I hope it helps :)

hoseinz3 commented 7 years ago

@keyvanakbary it was acceptable for me that view depends on the model but I think that model never depends on the view.( in page 10 figure model depends on the view)

theUniC commented 7 years ago

Hi @hoseinz3,

Initially MVC was used mainly for desktop GUIs. In those MVC implementations, the View was subscribed (through an Observer pattern) to Model changes. That's the reason why there's a relation between the Model and The View.

Hope it helps! Christian.

hoseinz3 commented 7 years ago

@theUniC thank you :)