This project is read-only.

A Modeling Tool for the Presenter First Pattern

Presenter First

What is the Presenter First pattern?

Presenter First is a variant of the Model View Presenter user interface pattern in which the model and view are completely separated from each other, with the presenter acting as a mediator. The benefit of Presenter First is that features are clearly documented in the presenter class in a declarative manner, leading to simple discovery and maintenance of code. The pattern also enforces strict separation of the view, making it ideal for supporting pluggable interfaces.

Why do we need a modeling tool?

The primary tradeoff of Presenter First is that it requires a lot of repetitive plumbing code. The Presenter First DSL is a modeling tool that can be used to define the model view presenter triad. Separately, code generation templates can be written to render the repetitive plumbing code. The current release of the tool does not provide any code generation, but the next two milestones will add VB.NET and C# templates. Any templates can be run against the model, allowing for a great deal of flexibility in implementing the code.


What does this tool provide?

The Presenter First DSL allows you to create models within Visual Studio for designing the model view presenter triad. Swimlanes define the model, presenter, and view. Features are created by combining an event and one or more actions. (See Creating a DSL for Presenter First for more information on the roles of events, features, and actions.)

The example below defines a very simple user interface element. The view has a single event, AcceptChanges. The presenter receives the event and calls two actions (methods) on the model: PersistChanges and Navigate. The model has a single event, NotifyUser, which requires a message parameter to be passed to the view. The view has an action, also called NotifyUser, that receives the message parameter.

The properties shape defines properties that exist on the model and view. (The model and view do not share any properties; it is the responsibility of the presenter to mediate property changes from one side to the other.)

Presenter First


Presenter First DSL was created using Visual Studio 2008 and DSL Tools. (DSL Tools is part of the VS 2008 SDK.) Visual Studio 2008 is required to use the modeling tool. VS 2008 SDK is required for compiling and modifying the DSL.

Milestone plan

M1: Initial release of the modeling tool. COMPLETE
M2. Add code generation templates for C#.
M3: Add code generation templates for generating VB.NET code.

Last edited May 16, 2008 at 3:20 AM by Bruk, version 14