[DOCU-478] Model-View-Presenter pattern Created: 10/Oct/13  Updated: 28/May/18  Resolved: 28/May/18

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Gavan Stockdale Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

Draft page on MVP needs completion: http://documentation.magnolia-cms.com/display/DOCS/Model-view-presenter+pattern

  • History: Google/GWT and Vaadin recommend using an MVP pattern
  • Reasons why you should follow MVP:
    1. Separate business logic from rendering. The logic is in the presenter. View doesn't know about the model.
    2. Flexible: You can easily change the view implementation. We don't do it in Magnolia but in theory you can.
    3. It is easier to test when logic is separated from rendering. Better testability.
  • Simple use case: creating your own view
  • When creating your own UI, you need to:
    1. Define a view MyCustomView by creating a view interface which extends the ContentView interface which is provided by Magnolia. Add an inner interface called Listener.
    2. Implement your own presenter MyCustomPresenter. It must implement ContentPresenter which is provided by Magnolia and MyCustomView.Listener.
    3. Create a real view implementation which implements MyCustomView = this would then be MyCustomViewImpl
  • The draft document shows the workbench view which is very complex. Instead, show a simple UI: SampleApp
    • Change the code snippets
    • Change the diagrams to show the code example
  • Does the event bus belong to the MVP topic?
  • Check which diagrams we need and labels
  • Annotate the diagrams

Generated at Mon Feb 12 01:09:28 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.