On Wednesday morning I attended Steve Miller’s (Atomic Object) – Presenter First Test Driven Development for GUIs. Steve presented an interesting approach to remove complexity from view and place it in a class called the presenter. The view and model are represented in the presenter via interfaces. The presenter contains only flow logic and can now be easily tested since the view and model can be mocked. Any time the view reaches any level of complexity you break out another small presenter.
In theory this all sounds appealing however after a little study I think my GUI code would grow by 30–40% to gain the benefit of TDD. I coming to think that we’re better off ensuring coverage through the acceptance tests and ensuring the absolute minimum amount of code in the views.
Read the original paper: Presenter First: Organizing Complex GUI Applications for Test-Driven Development and see if its for you.
This builds on the work of Michael Feathers “The Humble Dialog Box” and Martin Fowler’s “Model View Presenter” (now retired) – replaced by: Supervising Controller, Passive View and Presentation Model. My personal leaning is towards the Supervising Controller.
» Next Carnival of the Agilists – Agile 2007 wrap up
See all blog posts