Why do we authentically need them? ◦ Best practices. ◦ Speed up development. ◦ Programming independent. ◦ Flexible, reusable and maintainable. • How can we achieve it? ◦ e.g: MVC, MVP, MVVM, VIPER, VIP, etc.
own UI events. ◦ That informs the ViewModel about the user’s actions. ◦ It observes the ViewModel. • ViewModel ◦ Binds data to the View. ◦ Does not directly reference the View. ◦ It servers as a link between the Model and View. • Model ◦ Often split into layers itself: Business logic, Data access, Data retrieval. The separate code layers of MVVM are: 1 2 3 4
is decoupled from UI. • Code reusability. • Simplifies testing. “For simple UI, M-V-VM can be overkill. In bigger cases, it can be hard to design the ViewModel up front in order to get the right amount of generality” - John Gossman Disadvantages?