Abstraction [i.e. programming the interface] is useful if and only if loose communication is desired [ie. agnostic interdependence between consumer and producer].
Depending on your interpretation of the Model View ViewModel [MVVM], tight coupling is allowed.
In practice, the typical scenario I saw is a tight connection between View and ViewModel and between View and Model (s). Typically, since views are designed to fulfill a specific business requirement, ViewModels are tailored to the View approach to facilitate the View's business role.
As Ben Von Handorf suggests , the part of our application that actually adapts the base model (s) in the ViewModel should be separate from our presentation [at least the declarative part of the presentation]. Thus, adaptation is usually captured by the implementation of the View command. Thus, although the declarative aspect of View does not know the underlying model (s) and is loosely coupled, the business implementation or View command introduces a tight connection between View and Model. Again, this is awesome, because the purpose of the Single Submission is to use this data in a certain way as part of its activities.
I am also a fan of abstraction, in particular, programming the interface, dependency injection [DI] and control inversion [IoC]. However, when a tight connection makes sense, as in MVVM, abstraction is an over-complication.
IMO, the simplicity introduced through tight coupling, makes MVVM so attractive to its cousins ββin the Model View Controller [MVC] space.
source share