Understand & choose between MVC, MVVM, and MVP pattern variations | iOS Dev Live Mentoring

  Рет қаралды 10,029

Essential Developer

Essential Developer

3 жыл бұрын

Learn why there are so many variations of UI patterns and how to understand & choose between MVC, MVVM, and MVP for your iOS apps.
Join the iOS Lead Essentials program iosleadessentials.com
Like and share this content with someone that you believe will benefit from it. See you in the next episode.
---
How to Build iOS Apps with Swift, TDD & Clean Architecture series↴
www.essentialdeveloper.com/pr...
Caio & Mike's Book Suggestions ↴
www.essentialdeveloper.com/bo...
---
Subscribe to our channel ↴
kzfaq.info...
You can also find us on ↴
Twitter ☛ / essentialdevcom
Facebook ☛ / essentialdeveloper
Instagram ☛ / essentialdeveloper
LinkedIn ☛ / essentialdeveloper
Caio ↴
Twitter ☛ / caiozullo
LinkedIn ☛ / caiozullo
Mike ↴
Twitter ☛ / mrmichael
LinkedIn ☛ / mapostolakis
Join the iOS Lead Essentials program ↴
iosleadessentials.com
Visit our website ↴
essentialdeveloper.com

Пікірлер: 12
@alley8481
@alley8481 3 жыл бұрын
Good session. It would be a good session teaching good API consumption practices and teaching VIP.
@sydsrirak6808
@sydsrirak6808 2 жыл бұрын
Thanks for covering this! I think it’s important to mention why MVC doesn’t work so well in the world of iOS and that’s because Views and Controllers are essentially the same thing with UIViewControllers. Makes it hard to decouple Business Logic to UI and hard to cover with tests
@EssentialDeveloper
@EssentialDeveloper 2 жыл бұрын
Hi Syd, thanks for your message. MVC works well too. And MVC is also easily testable - check this session: www.essentialdeveloper.com/articles/testing-refactoring-existing-ios-swift-code-mvc-vs-mvvm-singleton-vs-di-ios-dev-live-mentoring
@jonathanchua6816
@jonathanchua6816 2 жыл бұрын
Very clearly explained! Good use of the flowchart visuals in explaining the concepts. Question: when you explained MVP and gave the example of the View modifying the Model, that would require layout code to be combined with user interaction code right? Would that make the View more of a View Controller?
@EssentialDeveloper
@EssentialDeveloper 2 жыл бұрын
Thanks, Jonathan! The view shouldn't modify the model. The view only sends events through delegation, closures, target-action, etc. The model will be notified of the events and modify itself as needed ✅
@PavelPalancica
@PavelPalancica 2 жыл бұрын
In my opinion, thinking of M, V and C as separate layers - is the main issue that leads to all problems (we may have a ModelController - it's part of the Model functionality though, we may have a TransitioningController - it's part of the View functionality though, we may have a DataSyncController - we may think of it as part of the Model or as part of the Controller layer, it has both Data and Controller in its name, lots of confusion if we try to think of each layer it would belong to and in my opinion - it should probably not have anything to do with MVC since it shouldn't be part of the UI layer at all). I like to think of the simplest 3-Layer Architecture instead (Data Access layer, Business Logic layer, and User Interface layer), and no matter if we use MVC, MVVM, MVP - they all belong to the top UI layer. The confusion most developers make is that each of M, V, and C should map with one of those layers, which is not true I'd rather think of them as camps/categories, and instead of having 3 folders/groups in Xcode, say Models, Views and Controllers... I'd rather have some Screens folder, and Models, View, and Controllers folders inside each specific screen-name folder if we wish so (it's easier to navigate a new codebase as well if done that way, no need to spend time what files from Views folder relate to what files from Controllers folder as it would be in first case scenario). I know some people say, for instance, Networking and JSON to class/struct instances conversion would be part of Model as well in MVC, which is fine (since it's related to the source of truth), but I'd rather introduce a Coordinator (even in MVC), some Utility data conversion / mapping classes, and create a separate Service Layer that would contain a lot of functionality for backend APIs interaction. We may have different modules where different teams use different architectures, and they may all use same HTTPClient or some Service instance - which would mean that these classes have really nothing to do with MVC, MVVM, MVP etc. And the problems with MVC especially start happening when we start think of those letters as Layers instead of camps/categories to start implementing separation concerns. Software became more complex over time, and if we shouldn't think each of the three "layers" of MVC is enough for us. Some objects simply don't fit into MVC, MVVM, or MVP and that's ok. Those are UI architectures / Design Patterns as already mentioned, and not App Architectures. P.S.: Also we should not confuse Business Logic with App Logic, one is a separate layer, and ultimately should reside on the server since it can change at any given time, but the app should be smart enough to adjust/replicate it locally on the fly ideally (for instance, can we have a . in the username) and the other one can be something that's done while creating the UI/View functionality which has nothing to do with the business logic, business rules etc. cause it's simply application logic (for instance, disabling the password field if username is not entered yet has nothing to do with business logic, and can be removed from the client side functionality without any changes at all on the server side... business doesn't care, and if Android app does this small change and iOS app not yet - business logic remains the same [assuming it was implemented in first place])
@EssentialDeveloper
@EssentialDeveloper 2 жыл бұрын
Hi Pavel, that's it! MV* patterns can be used on the UI layer. But they're not the app architecture! There's much more to apps than just UI ✅
Son ❤️ #shorts by Leisi Show
00:41
Leisi Show
Рет қаралды 7 МЛН
小蚂蚁被感动了!火影忍者 #佐助 #家庭
00:54
火影忍者一家
Рет қаралды 30 МЛН
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 72 МЛН
Which Software Architecture Should You Use: MVC, MVP, or MVVM?
24:27
Model View Presenter
14:39
Swift Arcade
Рет қаралды 15 М.
Everything You NEED to Know About Client Architecture Patterns
5:51
MVVM is BAD for SwiftUI - Use MVC Instead! (Yes, MVC)
13:28
Rebeloper - Rebel Developer
Рет қаралды 4,2 М.
Son ❤️ #shorts by Leisi Show
00:41
Leisi Show
Рет қаралды 7 МЛН