Agile RCP Presenter First using Spring Dynamic Modules Heiko Seeberger | metafinanz
Concepts 1 2 3 Application to RCP Agile RCP framework
What is agile? <ul><li>Develop exactly what is required. </li></ul><ul><li>Test-driven development. </li></ul><ul><li>… </...
How can we be agile? <ul><li>We need: </li></ul><ul><li>Agile process driving the design. </li></ul><ul><li>Architecture a...
Can UI development be agile? <ul><li>“ User interfaces are hard to unit-test” : </li></ul><ul><li>Tangling of presentation...
Example: Unit-testing UIs UI logic  Verify input Invoke addition
Test Cases <ul><li>How to implement these Test Cases? </li></ul><ul><li>Non-digits => Log error  “Illegal format …” . </li...
Vanilla approach <ul><li>Put “everything” into one Composite: </li></ul><ul><li>Text, label and button controls. </li></ul...
Vanilla tastes, but … <ul><li>Quick win for the implementation. </li></ul><ul><li>Disastrous for testing. </li></ul><ul><u...
Any better ideas?
Use Model-View-Presenter <ul><li>Similar to MVC, but: </li></ul><ul><li>Controllers for widgets, presenters for views. </l...
Passive View <ul><li>Does not listen to model updates. </li></ul><ul><li>All UI logic in presenter. </li></ul>passive UI l...
Interface abstractions <ul><li>Interfaces for model and view. </li></ul><ul><li>Mock model and view to test presenters. </...
Presenter First architecture <ul><li>MVP. </li></ul><ul><li>Passive View. </li></ul><ul><li>Interface abstractions for mod...
Presenter First process IView Presenter IModel The user can  query  for  books  by entering the  title  in the query form ...
Presenter First (PF) answers: <ul><li>How can we be agile? </li></ul><ul><li>Can UI development be agile? </li></ul><ul><u...
Presenter First approach IView Presenter IModel The user can enter two addends. Clicking “=“ will add and show their sum. ...
Presenter First approach Example Demo …
Test the presenter Example
Full test coverage for UI logic Example
Concepts 1 2 3 Application to RCP Agile RCP framework
How to create the MVP triads? IView Presenter IModel MockView MockModel View Model
Use Spring! Application context Presenter View Model
Spring Dynamic Modules <ul><li>Integration of OSGi/RCP and Spring: </li></ul><ul><li>Active bundle    Spring application ...
Example Application context ContactsPresenter ContactsView Contacts Model
Sharing beans across bundles <ul><li>Exporting  beans as OSGi services. </li></ul><ul><li>Importing  OSGi services as bean...
Im-/exporting services <ul><li>Importing an OSGi service: </li></ul><ul><li>Exporting a bean as OSGi service: </li></ul>< ...
Example org.agilercp.demo.contacts.ui Application context ContactsModel org.agilercp.demo.contacts Application context Per...
How to create ViewParts? <ul><li>ViewParts are created by the workbench. </li></ul><ul><li>How can we use the Spring creat...
The workbench is flexible! Workbench ViewPartFactory views xPt IExecutable- ExtensionFactory IExecutable- Extension getBea...
Example
How to create Dialogs? <ul><li>Let Spring create the Dialog. </li></ul><ul><li>Inject it into opening MVP triad. </li></ul...
Example
Concepts 1 2 3 Application to RCP Agile RCP framework
Agile RCP <ul><li>Presenter First framework for RCP. </li></ul><ul><li>Emerged from a real-world project. </li></ul><ul><l...
Challenge <ul><li>Spring instantiates views, </li></ul><ul><li>but controls created later. </li></ul><ul><li>How can a pre...
Agile RCP supports MVP life cycle
Showing views … M and V are instantiated. P is instantiated and M and V are injected. P initializes V. P registers itself ...
Agile RCP delivers a view factory <ul><li>Has access to Spring application context. </li></ul><ul><li>Gets workbench parts...
Agile RCP delivers a lot more <ul><li>Base classes for ViewParts. </li></ul><ul><li>Base classes for Dialogs. </li></ul><u...
Agile RCP approach Example Demo: New requirement: Initialize view with “123 + 999 = 1122”
Thank you! <ul><li>Website:  http:// agilercp.metafinanz.de </li></ul><ul><li>Agile RCP at sourceforge.net:  http://source...
Upcoming SlideShare
Loading in …5
×

JAX 08 - Agile RCP

1,029 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,029
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
24
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • JAX 08 - Agile RCP

    1. 1. Agile RCP Presenter First using Spring Dynamic Modules Heiko Seeberger | metafinanz
    2. 2. Concepts 1 2 3 Application to RCP Agile RCP framework
    3. 3. What is agile? <ul><li>Develop exactly what is required. </li></ul><ul><li>Test-driven development. </li></ul><ul><li>… </li></ul>
    4. 4. How can we be agile? <ul><li>We need: </li></ul><ul><li>Agile process driving the design. </li></ul><ul><li>Architecture allowing for unit-testing. </li></ul><ul><li>… </li></ul>
    5. 5. Can UI development be agile? <ul><li>“ User interfaces are hard to unit-test” : </li></ul><ul><li>Tangling of presentation and logic. </li></ul><ul><li>Dependency on concrete UI technologies. </li></ul>
    6. 6. Example: Unit-testing UIs UI logic Verify input Invoke addition
    7. 7. Test Cases <ul><li>How to implement these Test Cases? </li></ul><ul><li>Non-digits => Log error “Illegal format …” . </li></ul><ul><li>123 + 999 => 1122. </li></ul>Example
    8. 8. Vanilla approach <ul><li>Put “everything” into one Composite: </li></ul><ul><li>Text, label and button controls. </li></ul><ul><li>Handling button clicks: </li></ul><ul><ul><li>Verify input, possibly display error. </li></ul></ul><ul><ul><li>Invoke “business logic”. </li></ul></ul><ul><ul><li>Show result. </li></ul></ul>Example
    9. 9. Vanilla tastes, but … <ul><li>Quick win for the implementation. </li></ul><ul><li>Disastrous for testing. </li></ul><ul><ul><li>Why? </li></ul></ul><ul><ul><li>Let me show you (demo) … </li></ul></ul>Example
    10. 10. Any better ideas?
    11. 11. Use Model-View-Presenter <ul><li>Similar to MVC, but: </li></ul><ul><li>Controllers for widgets, presenters for views. </li></ul><ul><li>Widgets hand off user gestures to presenter. </li></ul>View Presenter Model
    12. 12. Passive View <ul><li>Does not listen to model updates. </li></ul><ul><li>All UI logic in presenter. </li></ul>passive UI logic View Presenter Model Testing UI logic == Presenter testing
    13. 13. Interface abstractions <ul><li>Interfaces for model and view. </li></ul><ul><li>Mock model and view to test presenters. </li></ul>passive UI logic IView Presenter IModel PresenterTest MockView MockModel Presenter testing == Easy Testing UI logic == Easy
    14. 14. Presenter First architecture <ul><li>MVP. </li></ul><ul><li>Passive View. </li></ul><ul><li>Interface abstractions for model and view. </li></ul>passive UI logic IView Presenter IModel
    15. 15. Presenter First process IView Presenter IModel The user can query for books by entering the title in the query form … User Story -onQuery() … +getName() … +getBooks() … Requirements drive the design.
    16. 16. Presenter First (PF) answers: <ul><li>How can we be agile? </li></ul><ul><li>Can UI development be agile? </li></ul><ul><ul><li>Delivers an agile process driving the design. </li></ul></ul><ul><ul><li>Based on an Architecture enabling unit-testing . </li></ul></ul><ul><ul><li>Untangles presentation and logic. </li></ul></ul><ul><ul><li>Abstracts from concrete UI technologies. </li></ul></ul>
    17. 17. Presenter First approach IView Presenter IModel The user can enter two addends. Clicking “=“ will add and show their sum. User Story -handleAdd() … +getAddend01() +getAddend02() +setSum() +add() … Example +getAddend01() +getAddend02() +setSum() +registerAddHandler()
    18. 18. Presenter First approach Example Demo …
    19. 19. Test the presenter Example
    20. 20. Full test coverage for UI logic Example
    21. 21. Concepts 1 2 3 Application to RCP Agile RCP framework
    22. 22. How to create the MVP triads? IView Presenter IModel MockView MockModel View Model
    23. 23. Use Spring! Application context Presenter View Model
    24. 24. Spring Dynamic Modules <ul><li>Integration of OSGi/RCP and Spring: </li></ul><ul><li>Active bundle  Spring application context. </li></ul>Bundle Application context Bean Bean Bean
    25. 25. Example Application context ContactsPresenter ContactsView Contacts Model
    26. 26. Sharing beans across bundles <ul><li>Exporting beans as OSGi services. </li></ul><ul><li>Importing OSGi services as bean references. </li></ul>Bundle Application context Bundle Application context Bean Bean Bean Bean Bean
    27. 27. Im-/exporting services <ul><li>Importing an OSGi service: </li></ul><ul><li>Exporting a bean as OSGi service: </li></ul>< service ref = &quot;personRepository&quot; auto-export = &quot;interfaces&quot; > </service> < reference id = &quot;personRepository&quot; interface = &quot;org.agilercp.demo.contacts.IPersonRepository&quot; > </ reference >
    28. 28. Example org.agilercp.demo.contacts.ui Application context ContactsModel org.agilercp.demo.contacts Application context PersonRepository
    29. 29. How to create ViewParts? <ul><li>ViewParts are created by the workbench. </li></ul><ul><li>How can we use the Spring created ones? </li></ul>Workbench views xPt ViewPart
    30. 30. The workbench is flexible! Workbench ViewPartFactory views xPt IExecutable- ExtensionFactory IExecutable- Extension getBean viewId (viewId) Application context Presenter View Model
    31. 31. Example
    32. 32. How to create Dialogs? <ul><li>Let Spring create the Dialog. </li></ul><ul><li>Inject it into opening MVP triad. </li></ul>Application context Dialog ViewPart Presenter View Model Presenter View Model dialog
    33. 33. Example
    34. 34. Concepts 1 2 3 Application to RCP Agile RCP framework
    35. 35. Agile RCP <ul><li>Presenter First framework for RCP. </li></ul><ul><li>Emerged from a real-world project. </li></ul><ul><li>Open Source: http:// sourceforge.net/projects/agilercp . </li></ul><ul><li>Website: http:// agilercp.metafinanz.de . </li></ul>
    36. 36. Challenge <ul><li>Spring instantiates views, </li></ul><ul><li>but controls created later. </li></ul><ul><li>How can a presenter initialize its view before it is shown? </li></ul>
    37. 37. Agile RCP supports MVP life cycle
    38. 38. Showing views … M and V are instantiated. P is instantiated and M and V are injected. P initializes V. P registers itself as IViewListener to V. V is created. V is shown.
    39. 39. Agile RCP delivers a view factory <ul><li>Has access to Spring application context. </li></ul><ul><li>Gets workbench parts by view/editor id. </li></ul>
    40. 40. Agile RCP delivers a lot more <ul><li>Base classes for ViewParts. </li></ul><ul><li>Base classes for Dialogs. </li></ul><ul><li>Utility classes. </li></ul><ul><li>… </li></ul><ul><li>And a lot more is planned! </li></ul>
    41. 41. Agile RCP approach Example Demo: New requirement: Initialize view with “123 + 999 = 1122”
    42. 42. Thank you! <ul><li>Website: http:// agilercp.metafinanz.de </li></ul><ul><li>Agile RCP at sourceforge.net: http://sourceforge.net/projects/agilercp </li></ul><ul><li>Contact me: [email_address] </li></ul>

    ×