MVVM, which is an abbreviated form of (M)odel-(V)iew-(V)iew(M)odel is not new to you all. But there are someone who don’t know about it. If you are a Core ASP.Net developer you may know about MVC & MVP, may also know about MVVM which mainly used in WPF/Silverlight. For them, it is tough to remember about its concept.
In general in any of my discussions or presentations, I used to describe MVVM in a way which is very easier to understand and easy to recall. Hence thought, why shouldn’t I share this to you? That’s why writing this post. Read it. I hope that, you will enjoy it much while reading it fully.
First see the below image snapshot. Can anyone tell me, what is this? Yes, that’s a car. Everyone knows about it. You may say that, why I am showing you a Car here. I was supposed to discuss about MVVM. Hmmm… Don’t stop, just read it.
So, it’s a car. What else? It has an Engine, which actually moves the car. What else? The driver sits inside the car and drives it. Ok fine, what else? It runs with fuels.
Yeah!! That’s fine. So, what is the relation between the “Car” and the “MVVM” Framework? Want to know? Umm, this is just my example that I always use to give while explaining about MVVM.
So, think in this way. The car runs on the fuel, which is your data. We will better call it as Model. Hence, Model is the data that you present in your UI.
The car has a body which we can see from outside, nothing else is visible, neither the engine nor the fuel. Hence, we can say it as the View of the car.
Interesting? Ok, so what is the engine? Engine is the interior part of the car which is responsible for moving the car (i.e. the View) with the help of driver and fuel, where driver sends the event to the Engine to use the fuel (Model) to move. So, this is your ViewModel.
So, what we learned here? The body of the Car (called as View) runs on Fuel (called as Model i.e. Data) with the help of Engine (called as ViewModel). I think, you got the basic idea of MVVM here. Hope this will help you to recall the Model-View-ViewModel very easily.
Need your feedbacks of how you felt about this explanation. Though it is a small explanation, but easy to remember for a newbie.