Last time, I have tried to show, how do decouple the presentation layer. Today the topic or point of view is slightly different. The Model-View-Presenter patterns can be integrated as default construction of your presentation layer into your development process. Atomic Object has build a complete agile process around the MVP pattern, called "Presenter First". This process includes Test-Driven-Development (TDD), Story-Driven-Development and the MVP pattern.
The Model-View-Presenter pattern can be used to build domain logic and presenters based on the user stories, without a single line of UI code (or a single click). The views are all mocked out using a mocking framework (JMock, EasyMock, NMock, RhinoMock, ...). All domain logic and presentation logic is tested in isolation, the presenter comes first (well, before the view).
So I would see this process broken down into the following steps:
- Write a unit test, covering your user story in the domain layer
- Fulfill with domain code, until green
- Write a unit test for your presenter
- Fulfill with presenter code, until green
- Write an integrative unit test from the presenter down to the domain (at least you should)
- Now it's time to build some UI
My conclusion is, that the Model-View-Presenter pattern really decouples any UI concerns from the actual user stories and their presenter/domain implementation.
Reference Material: Atomic Object - Presenter First
Tags: process