Is iOS An MVP Framework?
I recently read a fantastic article written by Martin Fowler about the history, underlying construction and reasoning behind many common user experience design patterns.
- ios
Originally published at rexstjohn.com on November 15, 2013. Recovered from the Internet Archive.
I recently read a fantastic article written by Martin Fowler about the history, underlying construction and reasoning behind many common user experience design patterns.
The following was a stand out quote for me:
Probably the widest quoted pattern in UI development is Model View Controller (MVC), it’s also the most misquoted. I’ve lost count of the times I’ve seen something described as MVC which turned out to be nothing like it. Frankly a lot of the reason for this is that parts of classic MVC don’t really make sense for rich clients these days.
In short: No one actually uses the actual MVC pattern as defined anymore yet everyone seems to think they do.
It’s a long and technical read, but he goes into extensive detail about why MVC doesn’t actually work in the real-world and how decades of work have gone into figuring out better ways to structure UI applications.
Reading this article caused me to rethink a couple of things about iOS.
Not Quite Traditional MVC
Apple iOS is described as an “MVC” pattern in their own documentation.
Note that views generally never communicates directly with any sort of model without having that transaction brokered by an intermediary View Controller of some sort (see diagram).
No communication between model and view?
If you read a traditional definition of Model-View-Controller you will note that views are expected to update the model via some sort of event. This usually doesn’t happen directly in iOS.
As a result, iOS more often tends to resemble the Model-View-Presenter pattern where the presenter handles all communications between the view and the model.
Here is a comparison of the two patterns side-by-side:
Note in MVC: The view updates the model