Implementing the UI
When working with user interfaces, it is fairly customary to use one of these presentation patterns:
- Model View Controller (MVC)
- Model View Presenter (MVP)
- Model View View Model (MVVM)
The MVC pattern has been around for the longest time. The idea of separating concerns among collaborating model, view, and controller objects is a sound one. However, beyond the definition of these objects, actual implementations seem to vary wildly – with the controller becoming overly complex in a lot of cases. In contrast, MVP and MVVM, while being derivatives of MVC, seem to bring about a better separation of concerns between the collaborating objects. MVVM, in particular when coupled with data-binding constructs, makes for code that is much more readable, maintainable, and testable. In this book, we make use of MVVM because it enables test-driven development, which is a strong personal preference for us. Let’s look at a quick MVVM primer,...