Summary

The MVVM design pattern is one that all Silverlight developers should learn and understand, even if they don't use it in their projects. There are competing design patterns that you may wish to look into (such as the Model-View-Presenter design pattern, also known as MVP), but MVVM lends itself particularly well to applications developed in Silverlight.

However, this pattern is one with no fixed, agreed upon, or uniform standard. Therefore, don't become too concerned with whether you are doing it the right way—there isn't one. Rather than jumping in at the deep end, try to ease into MVVM instead, preferably by starting with a small project.

You will get overwhelmed if you try to read everything written about the pattern and understand it completely before actually putting the pattern into practice. You can easily fall into analysis paralysis by doing so; don't overthink it. The best approach is to take what's written here, start implementing the core concepts in a small test project, and expand on them as the project grows. It's often best to do this before jumping headfirst into using a complex framework.

Don't be too pedantic and go overboard in trying to put all the view's logic in the ViewModel and having zero code-behind, because often, this goal is unachievable, and attempts to do so will potentially result in messier and more complicated code than you would have when not following the pattern.

Do what's right for your project at the time. If a task takes more work than it should, requires messy workarounds, or requires you to fight the pattern to implement simple application requirements, you're taking the wrong approach. You will hit walls along the way, but do persist—it's worth the effort.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset