Become a member!

Simple start with MVP (Model View Presenter) - Part 1

Today every web framework claims to be an “MVC” framework, and many really are!

Many MVC framework are available for many languages: Ruby (Ruby On Rails, Merb), .NET (ASP.NET MVC), PHP (CakePHP, LightVC, CodeIgniter), Java (Struts) and Python (Django). For a longer (and more complete) list you can click here.

Despite their names many frameworks use a “variation” of MVC called MVP.

For  the differences between MVC and MVP, see this article.

Moreover, MVP has been retired by Martin Fowler and splitted in 2 different patterns often identified as “MVP Implementations”: Supervising Controller (SC) and Passive View (PV).

Delphi for Win32 is a great tool for RAD development but it doesn’t have direct support for MVP.

With this post I’m starting a small series on MVP in Delphi for Win32.

You can find some interesting articles in J. Carter web site too.

So, let’s  start!

Link between View and Presenter

We start with link between the view and the presenter object.

MVP: Supervising Controller[/caption]

In the MVP View and Model are separated from each other using the Presenter. Any interaction between View and Model take place in Presenter.

Controller doesn’t has a direct link to view but use it trought an interface.

\

With this is mind we can write a simple application in MVP (SC) style. For this article we don’t talk about the model, so my sample do not contain a model.

Comments

comments powered by Disqus