- Presenter First
Presenter First is a software development approach that combines the ideas of the
Model View Presenter (MVP) design pattern, Test Driven Development, and Story Driven Development.Approach
Presenter First concentrates on transforming each of a customer's requirements into a well tested, working feature as quickly and with as much correlation to the customer's story language (requirement) as possible. The language of the story or requirement is used to directly guide development of the feature - even naming the modules and function calls. As a consequence, the feature implementation tends to closely represent the customer's desire with little extraneous or unneeded functionality. The language of the source code also corresponds closely to the customer's stories.
Presenter First is often applied in
Graphical user interface applications. It is equally well applied to the development of command-line interfaces. Further, a slight variation of the approach has been used effectively inEmbedded software ; here the integral design pattern is known as Model-Conductor-Hardware and the approach is termed Conductor First.When used in GUI applications, this approach allows the presentation logic and business logic of the application to be developed in a test first manner decoupled from on-screen widgets. Thus, the vast majority of the application programming can be tested via unit tests in an automated test suite. In so doing, the reliance on GUI testing tools to perform extensive system testing can be reduced to verifying basic GUI operation or eliminated entirely.
Implementation
The MVP design pattern decouples on-screen widgets, presentation logic, and business logic. Presenter First starts the development process with the Presenter component of an MVP axis. Test Driven Development is accomplished by mocking the View and Model and writing unit tests for the Presenter. Production code for the Presenter is then written and revised until the Presenter unit tests pass. The cycle is repeated for the Model. Unit testing the View is usually impractical or impossible; thus, view code is left as "thin" and devoid of logic as possible (i.e. the View is a wrapper around widget library calls and presentation logic is contained in the Presenter). The Presenter First approach applied to the MVP pattern allows the vast majority of application logic to be tested under automation leaving only simple on-screen verification testing of the View and its widgets.
The test cases for the Presenter are determined from the customer requirements or stories. A customer will generally explain features in terms of 'when' statements - for example, "When I click the 'save' button then the file should be saved and the unsaved file warning should disappear." Unit tests and Presenter code follow the flow of the 'when' statements. The Presenter expects View events to be fired (e.g. the click of the save button), and in turn it will make calls on the View (e.g. hide the warning message) and the Model (e.g. initiate file save operation) in response.
The many features of an application can make a single monolithic MVP axis unwieldy. Presenter First advocates breaking an application into multiple MVP axis. In a GUI application, each screen, dialog box, and complex widget is represented by an MVP axis (its functional design dictated by a customer story). Communication among the aggregated axis is accomplished through programmatic connections between Models.
References
Micah Alles, David Crosby, Carl Erickson, Brian Harleton, Michael Marsiglia, Greg Pattison, Curt Stienstra, [http://atomicobject.com/files/PresenterFirstAgile2006.pdf "Presenter First: Organizing Complex GUI Applications for Test-Driven Development"] , agile, pp. 276-288, AGILE 2006 (AGILE'06), 2006. [http://scholar.google.com/scholar?q=Presenter+First%3A+Organizing+Complex+GUI+Applications+for+Test-Driven+Development&hl=en&lr=&btnG=Search Google Scholar search]
[http://atomicobject.com/files/BigComplexTested_Feb07.pdf "Big, Complex, and Tested? Just Say 'When'"] , [http://www.stickyminds.com/BetterSoftware/magazine.asp Better Software Magazine] February, 2007
External links
* [http://atomicobject.com/pages/Presenter+First Presenter First papers and examples] A collection of resources by one group of the Presenter First originators
* [http://Exampler.Com/old-blog/2007/01/05/#wireframe2 MVP Example by Brian Marick incorporating Presenter First] A video presentation
* [http://www.stickyminds.com/BetterSoftware/magazine.asp?fn=cisno Sticky Notes] Online resources accompanying Better Software print article
* [http://channel9.msdn.com/ShowPost.aspx?PostID=312305 Part 1] [http://channel9.msdn.com/Showpost.aspx?postid=313257 Part 2] & [http://channel9.msdn.com/ShowPost.aspx?PostID=317581 Part 3] of video Podcast series with Ron Jacobs of ARCast.TV
* [http://www.computing.dcu.ie/~jmurphy/MSCpaper.doc “Multiple Case Studies On Presenter First: TDD for Both Stand-alone GUI-based application And Eclipse Plug-in Development”]
Wikimedia Foundation. 2010.