Agile 2007 Conference (Day 3)
Presenter First – TDD for Complex GUI (Scott Miller – Atomic Object)
- Repeatability of the manual UI testing is difficult
- Michael Feathers “The Humble Dialog Box” (initial MVP pattern)
- Separate GUI from business and separate business from flow control
- Delay the development of the model to as late as possible
- Start writing your code at the presenter level
- Presenter constructor take the model and the view, then registers event handlers
- Get ReSharper
- Use properties on the model, use methods on the view.
- Generally use events with no parameters. They are just event triggers that notify the class that it must get updated information.
- The presenter typically has just one test per user story.
- If the code for the UI becomes complex, create an adapter with its own model and view.
- Communications is generally handled by raising events.
- Spring – tool to let you define your object hierarchy in .Net projects.
- Multiple MVP triples communicate with each other through the models, or through another presenter that treats one model as a view and the other as a model. Having the external presenter is cleaner, since it reduces coupling between the models.
- For legacy code: pull out the view first, create multiple presenters, and one main model (eventually breaking out into multiple models).
- Create interfaces to handle file browser object and JavaScript popup dialog boxes, to make them mockable and testable.
- When firing an event, always copy the delegate and fire against that.