Response to MVVM is lipstick on a pig

In the last view years Unit Testing has grown more important in iOS land. Because Unit Testing UIViewControllers doesn't lend itself naturally to Unit Testing the MVVM pattern has found its way in the iOS universe. 

Patterns always add complexity to the problems that they are supposed to solve. Especially if you are unfamiliar or worse yet, we can't agree on the definition of the pattern.

My thoughts on MVVM boil down to Unit Testing. I've used MVVM for unit testing, and I can't say that I'm in love with it, but like Winston Churchill said,

"MVVM is the worst pattern for testing ViewContollers except for all of the others" .

So this blog caught my eye

https://sharpfivesoftware.com/2016/07/20/mvvm-is-lipstick-on-a-pig/

Which main point is that we need better defined classes, and who would argue with that?

Anyway here is my comment on the article. 


A downside of MVVM is that you can see a Massive View Controller become a Massive View Model which only transfers the same problem somewhere else with added complexity. 

I agree with your premise that the real problem is with class design. In both cases, what should be abstracted out, becomes code in a class that is bigger then it should be. 

However if Unit Testing is a concern, MVVM can be a good pattern where these better designed classes (dependencies) are passed in (injected) to a ViewModel where they can be tested. 

With ViewControllers this becomes harder, but not impossible. 

This also makes in clearer to see that this view is dependent on these nicely designed classes with clearly defined responsibilities, more so than a ViewController instantiating dependencies in a say an action handler. 

With a ViewModel I could test.
1. Button tap
2. Service call
3. Update label with some formatted text, is the text in the view the required format. 

Doing that with a ViewModel, the interactions between all of those parts becomes natural, but in a ViewController not so much.

You could argue that unit testing is of little value and let’s use UI testing for these types of test, but I think that really the value of unit testing is better code, with better separation, which should be the end result here.