Home > English > MVVM Survival Guid for Enterprise Architectures in Silverlight and WPF

MVVM Survival Guid for Enterprise Architectures in Silverlight and WPF

I finished just reading this book and I thought I would do a review while it is still fresh in my head.  I believe the book has good content and is a great reference for building application architectures using Silverlight or WPF.

Chapter 1 takes us through the various Presentation Patterns.  We first are introduced with a brute force monolithic approach and then look at MVC and MVP while evaluating any issues or concerns.  Its primary focus is to demonstrate the power of these patterns and enforce separation of concern (SoC).

Chapter 2 introduces us to MVVM and the benefits it offers do to Silverlight and WPF’s rich data binding.  The user is presented with strategies for sharing code between both Silverlight and WPF.  I was surprised that there is no mention of Prism or Caliburn.Micro or any other framework besides MVVM Light.  I think that MVVM Light is a great framework but I don’t agree that Microsoft leaves you without any direction as was mentioned in the book when they have an excellent guidance using Prism.

Chapter 3 uses the Northwind database as the primary data storage throughout the book.  It uses Entity Framework and also introduces Unit Tests for testing.  We are exposed to a new pattern, “Service Locator Pattern” and how it interacts with View and ViewModel.

Chapter 4 goes a step further with our Northwind database and discusses services and persistence ignorance.  It basically follows the best practices as established by Martin Fowler with regards to using a “Service Layer” to remove tight coupling.  Transaction Script, Domain-Driven Design, and Service-Oriented Architecture and presented in this chapter as well.  We then look at persistence ignorance and custom models and the pros and cons for each.

Chapter 5 is all about Commands and User Input dealing with the Northwind database.  It does a good job of demonstrating the commanding API supported in both Silverlight and WPF.  It also deals with InputBindings such as KeyBinding and MouseBinding.  We then discuss attached behaviors.  I did not see any true behaviors or actions that are also supported by both Silverilght and WPF.  Neither did I see any examples of EventAggregation which is very important when trying to communicated across projects or classes.

Chapter 6 handles hierarchical view models and inversion of control.  We are presented with master/detail scenarios and also take a look at the ObservableCollection<> object.  With IoC, we are presented again the Service Locator pattern.  Next we are presented with StructureMap.  I am again surprised in that we are not presented with Unity or MEF as these two come straight from Microsoft.  I would also like to have seen others like Ninject but we are at least presented with IoC best practices.  I do like that they introduce the Single Responsibility Principle (SRP) and give the reader a good idea of how it works works and how to use it.

Chapter 7 is all about dialogs and MVVM.  Dialogs can be a tricky part of an application architecture in that it is easy to break all the hard work we established by using MVVM.  We are presented three options for using dialogs:  Dialog Service, Mediators, and Attached behaviors.  With dialog services, we are presented with data templates and the flexibility they provide as well as some common conventions to give us one of my favorite patterns, convention over configuration.  With mediators, we are finally introduced Event Aggregation and Messaging.  Finally with attached behaviors we see a way to controls dialogs via XAML.

Chapter 8 this chapter is a nice surprise in that it discusses Windows Work Flow and building MVVM applications.  We discuss several patterns in this chapter, “Unity of Work” and “Memento“.  Next we are shown how these patterns are supported and implemented using WF and how they support handling application flow.

Chapter 9 is all about validation and error handling.  IDataErrorInfo, INotifyDataErrorInfo, and ValidationSummary are a few of the objects presented in this chapter.  We also discuss the Enterprise Library Validation Application Block and how it interacts with both WPF and Silverilght.

Chapter 10 talks about using non MVVM third party controls.  It deals with strategies for incorporating controls such as the WebBrowser control and still achieve rich data binding using MVVM with these controls.  We look again at the power of attached behaviors and a technique such as exposing a binding reflector to help with our data binding.  Another technique is to use the adapter pattern and leverage inheritance to expose and surface the functionality we want to support MVVM as well.

Chapter 11 focus on MVVM and application performance.  For WPF applications, we look asynchronous bindings.  Another area of performance concerns with controls is the concept of virtualization and paging.  Not a lot is addressed here but at least the concepts are presented.  The BackgroundWorker object is presented to facilitate work being done on a separate thread.

Appendix A claims to evaluate other MVVM libraries but I only see a list and not much discussion as to the power or differences among them.

Appendix B is titled “Bindings at a Glance” but I really only see a glossary of terms and now real good examples of bindings or real-world examples.

All in all, this seems to be a good book.  It doesn’t answer all the questions but it does present you with enough information to give you a good direction as to where you need to go when building out your own architectures.

  1. No comments yet.
  1. August 27, 2012 at 11:49 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: