Saturday, March 08, 2008

Table Data-Binding and MVP in Glimmer

Glimmer now supports data-binding for table content (actually has been for two months, but I didn't get time to report it till now.) So, I test-drove a sample Contact Management search application to demonstrate table data-binding following the Model View Presenter architectural pattern.

Click here to see the tests.
Click here to see the source code.

Here is the process I followed:
  1. Design user-interface
  2. Write user-interface Glimmer code (without data-binding and event listeners)
  3. 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.
  4. 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.
  5. 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.

No comments: