Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCU-478

Model-View-Presenter pattern

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Neutral
    • None
    • None
    • None
    • None

    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

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              gstockdale Gavan Stockdale
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR