Recorded – watch the full episode on YouTube.
Which architecture do you prefer for building iOS apps, MVC or MVVM?
Sean Allen: Yeah, so it's MVC. I've found MVC works 90% of the time, I haven't really explored others. Besides like a basic tutorial, you know what I mean? So take this opinion with a grain of salt, because I don't have full-blown experience in MVVM, and from what I understand and know, MVVM makes your code more easy to test, which we've talked about.
I haven't gone down that road either, so the question to that is, MVC, again, I feel like that's going to work 90% of the time. Most of the time you're using VIPER, MVP, whatever, I feel like you're just shoving that in there when it's unnecessary.
And let me go on this rant real quick, sorry.
“I think MVC's the vast majority of the time going to be perfectly fine. And make your life easier as a team.”
When you get, because MVC is like the norm, right? That's what most developers are going to know. I believe when you try to be clever, and throw in this random architecture, you're also making it hard on new people coming into your team.
I don't know, I think you're trying to be clever for the sake of being clever, for the most part. You got to give that disclaimer, there's absolutely times when those things are necessary, but again, I think MVC's the vast majority of the time going to be perfectly fine. And make your life easier as a team.
“MVC does a fantastic job when implemented correctly and well, and in small chunks. Not like just huge, massive view controllers, but break them out of the view controller. That works brilliant in MVC. There's no need to go much further.”
Paul Hudson: Yes. MVC, for me, is not 90%, it's 100% of the time it will solve the problem perfectly fine in UIKit land. I'd happily work on a project with MVVM – I get that, and it’s cool, but I would not work on a project using VIPER. I would not work on a project using Clean Code. If they were using that, I would say, thanks for the interview folks, but I'm leaving. Because at that point, you're wasting time with being an architecture astronaut, quite frankly; you're not focusing on shipping good code, you're simply focusing on shipping architecture niceties, and that has no interest to me.
MVC does a fantastic job when implemented correctly and well, and in small chunks. Not like just huge, massive view controllers, but break them out of the view controller. That works brilliant in MVC. There's no need to go much further, if you want MVVM, fine, I get that, it's a very nice architecture, testing as you say, not least, but VIPER… I just don't see the point, quite frankly.
This transcript was recorded as part of Swiftly Speaking. You can watch the full original episode on YouTube, or subscribe to the audio version on Apple Podcasts.
SPONSORED From August 2nd to 8th you can join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer!
Link copied to your pasteboard.