Last year, I found myself starting the development of an Android app that would take me at least 6 months of work. At that point, I only had a year of experience in mobile development and I had only tried MVVM, but I started to see a lot of open source code that used MVP, and I wondered, is MVVM really the best option?

As I didn’t really know MVP, and with a so little experience, I started to investigate what others thought about the topic.

What did I found out?

Let’s go straight to the point. Mostly people used what they or their team were comfortable with. Other aspects like recent support from Google, performance or maintainability were not as important.

As I was open to learn MVP and try out different ideas, I did some more research about the topic, and I found this academic work, from the Eindhoven University, written by Tian Lou, A comparison of Android Native App Architecture: MVC, MVP and MVVM.

This article is quite extensive, and includes MVC too, so if you are really interested in the topic, I recommend that you read it, but here I’m going to show what I concluded, and I’m going to ignore MVC.

MVP and MVVM are actually very similar approaches, in terms of logic and code, but there are some differences when we think about testability and performance.

In terms of testability, MVVM is simpler and generally this involves that less test needed if we want to do a full coverage of its logic.

In terms of performance, the article uses memory usage to simplify the comparison, but if we want to be a 100% accurate, we should follow what Google defines as performance, which means that they take into account the response time, battery, memory, CPU and GPU usage.

To measure memory usage, he developed the same app using MVC, MVP and MVVM, and did the same actions in the app during 5 minutes, while he was measuring memory usage. These were the data that he got, and I put into a table to visualize it better.

Table comparison

We can see that in terms of memory usage, MVP is a bit lighter than MVVM. In this app, it may not be relevant, but it can be something to take into account when thinking in scaling and future development as the project grows or supporting lower end devices.

Conclusions

After seeing this data, to be honest, I don’t think that there is a better option for every case. We need to take into account if the app is big, if it’s a new project, what the team or yourself feel most comfortable with. So, if you are using MVP, and you are still comfortable with it, in my opinion, no, I wouldn’t migrate to MVVM.

Featured image by Jason Strull on Unsplash


If you want to read more content like this and support me, don’t forget to check the rest of the bolg or subscribe here to get an email every time I publish new content.

Categorized in: