NM.

View Original

MVP Design Pattern

When writing an application, being aware of the various design patterns can be a great way to keep your code organized and avoiding one-giant-mess-of-an-activity. A design patter, such as MVP (Model - View - Presenter), may seem like a lot of additional coding efforts up front, but can be very beneficial in the future. MVP is a good way to decouple your code, so iterations to the UI layer will not affect your Model layer, for instance. There are also many benefits when it comes to testing. 

When exploring MVP further, I came across some helpful resources I wanted to share.

One of the most useful resources I've found is an example project from Israel Ferrer. I found this to be a practical and thorough resource. As a bonus, you can listen to him on the Fragmented Podcast episode 26


Here, Jeff Potter builds a simple sample application using the MVP pattern. This example is easy to understand and also demonstrates how to swap out a Synchronous task for an Asynchronous task without any real implications to the UI code.  

Github Repo


Another useful video is called "Building Better Android Apps with MVP" by Anup Cowkur. This is a decent talk that explores the advantages of this pattern for testing. 

Github Repo