I used to be a code behind event driven loving developer! but since I found MVVM, I never looked back, MVVM all the way!
From Code-behind Event-driven addict to MVVM fanatic…
So for a developer who’s coming from a code behind event based implementation loving developer, I understand, adopting MVVM to your application could be pretty confusing and hectic at the beginning!
Because I know it very well by my own experience, whereas I used to be a stubborn noob developer in the good old days thinking Event Driven WinForms approach is the best way to developer software. Which led me to suffocate massively when the code base got bigger and bigger, having massive hard time debugging, maintaining and even upgrading programs I was coding. Honestly I couldn’t understand the cause for this at the beginning due to my stubborn mindset of praising code-behind even driven programming style.
Then when I got into my career I had to force myself to start using MVVM based implementation. And yes it was super confusing and troublesome to understand.
But trust me after a while, step by step, you start to see how fun it is, makes you feel like wiring up some electronic circuit to get it to work, how all those components gets wired up each other while still having the modules separately.
And you will notice how easy it is to maintain and extend your code base… 😉
Short and sweet,
MVVM stands for Model View View-Model
and it’s AWESOME!
Here is why?
- MVVM enable true separation between your User Interface(Views) and Logical Code(ViewModel/ Model)! Yes decoupling is ghuuud!
- Easily handle events with Commands – ICommand
- Never underestimate the power of INotifyPropertyChanged
- Take the best use of Binding (View to ViewModel properties)
- With ViewModel you can easily manipulate Model’s data as you wish and set them to be bound to any Views as you wish and vice versa. Yes it’s that flexible!
- Yes, the ultimate portability of your project’s components
- Testing made super easy as the separation between UI and Code behind logic
- Extremely ease of maintenance and adding changes to your code base
So there you go, a short and sweet post I made during my free time! 😀
hope it helped anyone or may be inspired someone to make the switch! 😉