Click here to see the tests.
Click here to see the source code.
Here is the process I followed:
- Design user-interface
- Write user-interface Glimmer code (without data-binding and event listeners)
- Write presenter API without any logic or behavior. The presenter is simply an abstraction of the user-interface where every field is represented by an attribute and every button is represented by an action method. In a way, the presenter is the Controller of the traditional Model View Controller pattern. Using a presenter enables us to strip all logic out of the view.
- Write tests for presenter to test-drive behavior into it gradually. This step will also drive creation of domain models gradually, such as Contact and ContactRepository.
- Revise user-interface Glimmer code to add data-binding and event listener hooks to presenter
At this point, you will have a fully-functional data-bound Glimmer application following the Model View Presenter pattern.
Please post a comment if you have any questions.