Freigeben über


"MVVM - It's Not Kool-Aid" by Jesse Liberty

Jesse Liberty's blog post titled "MVVM - It's Not Kool-Aid" illustrates succinctly a key refrain in the MVVM mantra.

MVVMSketch

"Core Concept #2 Don't Look Up. We tend to conceptualize the View (User Interface objects) at the top, the ViewModel (objects that provide the UI with its data and behaviors) in the middle and the model (often the persistence layer) at the bottom. The View can know about the ViewModel, the ViewModel about the Model, and the Model, like the cheese, stands alone."

There is intentionally/explicitly NOT a red arrow from the View all the way down to the Model .  Also of note is the fact that the arrows are not bidirectional-this underscores the fact that the View knows about the ViewModel and that the ViewModel knows about the Model, but NOT any combination ofthe reverse.  When a field in the ViewModel has been bound to something in the View, the ViewModel is not specifically telling that particular View that the field has changed; instead, generically, the ViewModel's field is changed and the ViewModel notifies subscribers of the change.