Sunday, April 8, 2007

Presenter First

Presenter First is a pattern that includes Event Mapper (Presenter), Domain (Model), and Server (View) objects.

Figure 1.
The key point when designing with this pattern is to remember to keep the presenter stateless. Don't do any data manipulation in the event handling. Do it all in the Domain. Example:
You notice in the correct code you are using command messages to transfer the data around from Server (viewService) to Domain (domainService) and vice versus. All I am doing is wiring up the Server to to the Domain and Domain to Server. Next Post #2: How to utilize command pattern so that the Presenter holds no instance of Domain or View. Post #3: Encapsulation worth the effort for Presenter First? Post #4: Either Mocking and Unit Testing Presenter First or Event Handling. References: AtomicObject Marting Fowler Brian Marick Michael Feathers

No comments: