The View


TODO: write about...
  • the View's life cycle

In MVP, the View is concerned with visually laying out and representing content. The View does not have any "processing" logic - this is delegated to the Presenter. As such, the Presenter must have some knowledge of how to communicate and work with the View. This is accomplished by having an interface which the View implements.

In a DotNetNuke MVP module, the View is a User Control. The majority of the View's code lay in the mark-up of the user control; there is very little code-behind in a View. In fact, the majority of the code-behind methods of the View class will be defined in the View's Interface.

The View's Interface

The View's interface serves one primary purpose: Give the Presenter an abstract representation of how to work with the View. What the View's interface will have in terms of properties, methods and/or events will depend on whether one uses the Supervising Controller or the Passive View pattern.

A second purpose of the View's interface is to make it easier to test the Presenter. With this interface in place, it will be possible to pass a mock of the View to the Presenter during the unit tests.

Last edited Jul 3, 2010 at 4:50 AM by dagilleland, version 5

Comments

No comments yet.