MVWTF: Demystifying Architecture Patterns

Adam McNeilly on August 16, 2019

Originally published on Android Essence. As an Android developer, one of the questions I constantly see asked within the community is "what archi... [Read Full]
markdown guide
 
  1. MVC diagram is missing the link between a model and a view. The view observes the model in MVC.
  2. MVI is not a pattern. Disagree? Try to draw a diagram, as you have for other patterns. It's hard because MVI really depends on implementation. Though, MVI is a good helper for any other pattern of choice.
 

I think MVI is a pattern and a diagram could be drawn easily. I would just replace the View portion of the redux diagram in the post with a ViewModel or Presenter from the other diagrams.

 

@adammc331 : There is an error in the article, namely all of the Model-View-Controller images are Model-View-Presenter diagrams.

 

MVC is often described in different ways unfortunately, there's usually not a consistent answer.

How do you view the flow of data in MVC? And if what we have here is really MVP, what would you change about the MVP diagrams in this post?

 

Maybe I was not entirely clear. What I menat is that three first figures use the same image, with Model, Presenter, View and User nodes. (One at the beginning of the "MVC Diagram", one in "Why Don't We Use This On Android?" subsection, and one in "Model-View-Presenter").

They use exactly the same IMG tag, with the same image URL, and the same ALT attribute.

I thought I had the right picture but that the diagram itself was wrong. 🙈 Will fix once I'm at a computer.

 

Fixed! Thanks for pointing it out for me. :)

 

I like the post! A broad overview of architectures (and with actual code samples) like this is very helpful. I personally ended up with a different conclusion for android architectures though:

For what it's worth, I don't like MVI much at all. In theory it sounds great, but in practice I've found it requires large amounts of boiler plate for even simple UIs. Once we get to non trivial UIs (multiple loading elements, form validation etc), screens seem to take days instead of hours to implement. (To be fair I am also not a massive fan of MVVM as it's typically implemented - but it's ok).

I wrote something quite similar to your article that details my thoughts on it here: erdo.github.io/android-fore/00-arc...

 

I agree, MVI is a lot of work that we don't often need for simple pages that just load and display data. If there are a lot of moving parts/components to interact with, or flows based on complex decision trees, having that unidirectional state management can help a lot, though. I just hope this post helps highlight the differences well enough that people are able to decide for themselves. :)

I like your post! Your diagrams were given much more TLC than mine haha

 

That soft explanation about Android app architecture was kind of sublime, sir... Really!
Avoiding some might complex architectural concepts as Flux or Redux, for example, allows a easy compreension of our need to think what we should consider when building something.
I'd add just a detail about MVC. A lot of Android apps are just some kind of frontend component in a bigger architectural perspective, so the MVC you suggest makes sense. However, if the app purpose is to be a "single point" connected with some kind of datasource (files, databases, web services, etc.), I suppose the model can follow a Domain Driven Design, where you apply the Business Logic on your models (where you can/cannot use it to handle data, as well, or apply other kind of layer responsible for that business logic.).
Anyway, it was a refreshing way to study some of the complexity around Android app architecture.

 

I like the word Model-View-Intent than Flux or Redux or something.

 

Nice Article, completely explained in a very easy and understandable manner. Thank you...

 
 
code of conduct - report abuse