Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create a contract (Java interace) that has for each concept and define interfaces for the view, model and presenter in the contract
  2. The three components should implement interfaces from the contract created in rule 1 above.
  3. In each component, reference the interface of the other component rather than the implementation.
  4. Model should be referenced in the Presenter and not the View.
  5. View should not be referenced in the Model.
  6. Avoid android dependencies in the Presenter.
  7. Use an interactor to calls make calls to the database or network layer i i.e. using Async Tasks or Handlers.
  8. Interactor should sit between the Presenter and the model.
  9. Interactor should be initialized in the Presenter
  10. Have one contract for each concept that defines the interfaces for the view, presenter and model
  11. Start async tasks in the interactor
  12. .
  13. All database calls should be made using:
    • Async tasks
    • Future tasks (TODO find We need a way to move waiting of moving this from the main thread).
  14. Prester tests should mock the view and the interactor (If implemented).
  15. Model tests should mock the presenter.



We have created sample mvp applications that respect these rules in https://github.com/OpenSRP/opensrp-client-architecture/tree/mvp 

Please check them out and if possible add your sample mvp application there.


Instrumentation Tests


References

https://developer.android.com/studio/test/

...