The MVC Era
I remember back in 2016, when I worked at an e-commerce company, mobile development wasn’t in its infancy anymore. By then, we had about 8 years as a community to figure out best practices and architecture of iOS and Android applications. The apps were becoming more and more sophisticated and loaded with features and functionality, with team sizes growing as well.
But the best solution we could do was MVC.
On its own, MVC wasn’t a bad design pattern, but it was originally made only for UI concerns and not meant to be an architecture of an entire app. Hence its tendency to morph into a giant mess of Massive View Controllers…
There was no particular reason to go with it, though. It happened historically, mainly because “Apple said so” and kept pushing MVC as the defacto “best architecture” for mobile apps.
It was a very dark time…
What the “fringe” developers (including myself) were advocating for though, was MVVM, a seemingly similar design pattern popularized in C#/.Net world.
On its own, MVVM wasn’t too complicated and was not meant to be used as an architecture of entire apps. But it was not just a step forward but a leap from bloated Massive View Controller approach which was prevalent at the time. MVVM allowed for greater separation of concerns and extraction of business logic from the view/UI layer (i.e. the viewcontroller) into a separate viewmodel that would be responsible for the business logic and be much more testable.
Any attempts to introduce it however would face a vehement opposition. They would say things like:
“in a real world project, we can’t do that, we’ll run out of budget”
“we can’t do that, it will take too long!”
“why do you make me create more files and write more code??? I have it right here altogether, I can see everything in one place.”
“how dare you question the gods of Apple???!?!“
and much more
To be frank, talking to those developers back then felt like talking to a wall. It was so thick, unyielding, unmoving, rigid. Part of it was the dogma pushed on by Apple. Another part may have been simply the fear of the unknown and complacency. Some, if not most, devs at the time wouldn’t even allow a thought that there could be another better approach. The mindset of “we’ve done it this was for as long as we can remember, it must be the only way” was very prevalent.
At the end, despite all the “hardship” and “battles” with the established dogma, we won. MVVM became the defacto the golden standard on how to write mobile apps. The iOS community embraced it fully – now virtually every “respectable” project uses it. On Android it went even further, and it was adopted by Google itself as a first party built-in part of the framework.
The battle was won, but it was bittersweet victory…
The MVVM and Beyond Era
These days, there is another battle going on - between MVVM/Reactive “golden standard” and Clean Architecture.
The battle cries and songs are sounding too familiar…
Yet again, we have people who listen to Apple say:
“in a real world project, we can’t do that, we’ll run out of budget”
“we can’t do that, it will take too long!”
“why do you make me create more files and write more code??? I have it right here altogether, I can see everything in one place.”
“how dare you question the gods of Apple???!?!“
and so on and on
Sound familiar? It is! It’s exactly the same thing they say!
Clean Architecture and its implementations on mobile such as RIBs and VIPER advocate for even further and extended separations of concerns beyond what MVVM offers. There are more objects and layers, but there is also more structure, testability, and standardization. Unlike any other design pattern before them, Clean Architecture was made to be an actual architecture for an entire application.
Clearly, there are tremendous benefits to it and advantages over MVC and MVVM. People are still defending the status quo (which is now MVVM) as vehemently and as fiercely as they were back in MVC days.
To me, this is starting to become tiresome, here we go again…
I hope eventually that sanity prevails, and we will all move on to Clean Architecture becoming the defacto golden standard for mobile applications, just like how it happened with MVVM.
Only time will tell… For now, the only thing we can do is to keep fighting the good fight, and to keep evangelizing Clean Architecture wherever and whenever we can.