Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering JavaScript Object-Oriented Programming

You're reading from   Mastering JavaScript Object-Oriented Programming Advanced patterns, faster techniques, higher quality code

Arrow left icon
Product type Paperback
Published in Jun 2016
Publisher Packt
ISBN-13 9781785889103
Length 292 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (13) Chapters Close

Preface 1. A Refresher of Objects FREE CHAPTER 2. Diving into OOP Principles 3. Working with Encapsulation and Information Hiding 4. Inheriting and Creating Mixins 5. Defining Contracts with Duck Typing 6. Advanced Object Creation 7. Presenting Data to the User 8. Data Binding 9. Asynchronous Programming and Promises 10. Organizing Code 11. SOLID Principles 12. Modern Application Architectures

The Model-View-ViewModel pattern


The Model-View-ViewModel pattern or MVVM tries to go further in reducing the dependencies among the presentation pattern components. This pattern introduces the ViewModel component that substitutes the Presenter. Of course, it is more than a simple renaming. Let's try to understand how it works by comparing it to the MVP pattern.

Just like with MVP, the View is totally unaware of the existence of the Model. But while in the MVP pattern, the View was aware that it was talking to some intermediate component. In the MVVM pattern, the View believes that the ViewModel is its Model. Instead of asking the Presenter to bind data and manipulate the Model, the View manages its own Model represented by the ViewModel. It acts as a wrapper around the actual Model and makes some consistency validations and other activities concerning the management of data.

The following image outlines the interactions between the components of the MVVM pattern:

Let's take a look at how we...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime