Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>1) Controller responsibility is primarily "execute an action, choose an appropriate view, provide some data to that view and return the view to a user".</p> <p>2) As MVC tries to separate presentation logic and UI rendering, I believe, controller shouldn't attempt to perform any of view responsibilities: listening to UI events or pre-formatting of values <code>dateString = data.ToString('YYYY-MM')</code> - that's all should go to view.</p> <p>3) in MVC view knows all about a model - model is rendered by view without any controller involvement (that's primary 'issue' fixed by MVP, where view should and model should unbound as much as possible). However it's not recommended for view to query model directly. Instead, all data changes should be reported to view by model using Observer pattern. Consider the following - <a href="http://upload.wikimedia.org/wikipedia/commons/b/b5/ModelViewControllerDiagram2.svg" rel="nofollow">schema from wikipedia article</a> - dashed line from model to view indicates that fact. Just keep in mind that model is more <em>viewmodel</em> here and shouldn't really be a part of BL layer.</p> <p>So here scenario could be the following:</p> <ul> <li>User clicks "add item"</li> <li>View sends request to the controller with the item data</li> <li>Controller makes call to BL, which makes changes to the model (adds new item to the list).</li> <li>Model fires "updated" event to the view (or "error" event, if there are some issues in underlying layers)</li> <li>View updates UI according to changes reported.</li> </ul> <p>4) The statement is perfectly true. In MVC you shouldn't do that. I assume, in MVP you shouldn't do that as well - I mean, listening to events from UI directly. That should be done either by forwarding event by view; or using a platform-independent view representation, like </p> <pre><code>inderface IMyGridView { event ItemEvent AddItemClick; } </code></pre> <p>(which doesn't make sense for MVC, as view is pretty much independent from a controller and mostly all view actions are result in calls to controller).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload