RIA implementation patterns

Embed Size (px)

Citation preview

  • 1. Rich Client Implementation Patterns rgo Ringo Aqris Software

2. Complexity Classical web app client Rich client 3.

  • Rich clients have more state

AMS2.0 Model for week view 4. GUI complexity boosters

  • Distribution of business domain code among client and server

5. Remote IO 6. Custom widgets 7. UI state synchronization 8. MVC(1)

  • Model
  • is the application without UI

9. contains all application state 10. may communicate with DB or server View 11. Controller

  • adapts events from View to Model API

12. doesn't contain any business logic 13. MVC(2)

  • + Model is separated

14. + Controller can be testable 15. - Controller and View are tightly coupled 16. - View update logic cannot be tested 17. Model-View-Presenter with Supervising Controller

  • + Complex View update logic is testable

18. - View and Controller even more coupled 19. MVP with Passive View

  • + Even more View update logic is testable

20. - Controller is even more coupled to View 21. Presentation Model

  • + View update logic is testable

22. + Controller can be testable 23. - Model has more knowledge about UI 24. Distribution of complexity 25. Command

  • each user request is handled by separate command

26. used in Swing and SWT

  • +OO

27. + support for undo/redo 28. - can result in many small classes Relationship to MVC? 29. Various if(RoleManager. getCurrentRole ().equals(Role. PROJECT_OWNER )) { button.setEnabled( true ); }else{ button.setEnabled( false ); } AuthorizationManager. prepare (button, Role. PROJECT_OWNER );

  • Adaption
  • Widget assembly

panel.add( newOkCancelPanel()); panel.add(Factory. createOkCancelPanel ()); panel.add(Builder. create ( "btn:ok, btn:cancel" ));

  • Composable units
  • e.g EnterActivity MVC, ProjectViewPanel, TeamViewPanel

30. Swing

  • View and Controller merged into one component

31. Look-and-feel handled by separateUI delegate 32. Types of Models

  • GUI state (e.g ButtonModel, TreeSelectionModel)

33. application state (e.g ListModel, TableModel) 34. mixed (e.g ButtonModel if used for JCheckBox) Uses Actions (commands) public interfaceActionListenerextendsEventListener { public voidactionPerformed(ActionEvent e); } 35. Eclipse RCP

  • Workbench
  • e.g Windows, Editors, Perspectives

JFace

  • e.g Viewers, Dialogs, Wizards

SWT

  • e.g Buttons, Trees, Lists, Tables

36. Resources

  • Source code http://www.aqris.com/x/SgC Recommended reading http://www.kriso.ee/Professional-Java-User-Interfaces/db/9780471486961.html Photo credits yushimoto_02 @flickr:http://www.flickr.com/photos/yushimoto_02/3419855883/sizes/l/