Letters from Readers

ViewModel Questions

Benjamin Day's exploration of leveraging the ViewModel in Silverlight and Windows Phone 7 development ("6 MVVM Tips") generated plenty of feedback.

Really great article overall, but I must advise caution with Tip 6. I agree completely that it's well worthwhile to create a design where you can have a custom entry control that displays the prompt, input control, validation message and so on in a consistent and reusable way. However, I see way too many architecture models where the business rules are coded in the ViewModel, and that's the only place they exist. Well, except for the next UI that uses the same data, and the one after that, and the service API after that and so on.

We must be vigilant to keep that code pushed well down the stack, deep into the Model where it belongs. Then, a model like the one described in Tip 6 can be a way to automate and facilitate the UI discovering and honoring them. It should not be a way to make doing the wrong thing easier.

Dan

Love for LINQ
Peter Vogel's Practical .NET column in the April issue on using Language Integrated Query ("Why You Really Should Be Using LINQ") produced a discussion of the performance of LINQ and, in particular, LINQ-to-SQL.

In my opinion, the best thing about LINQ is it speeds development. The best thing about LINQ-to-SQL is it speeds development without getting tied to an all-encompassing OR/M. If you build line-of-business solutions where the client states that every feature is vital, then building the features with LINQ and LINQ-to-SQL gives speed and agility. And when the client starts using the app and works out what the truly important features are, then it's easy to get in and optimize the plumbing that supports them.

Mike
Brisbane, Australia

Peter Vogel responds:
Interesting view: "LINQ as a rapid application development tool." I'm not as much of a fan of LINQ-to-SQL as you are, but that probably reflects that I'm an independent consultant: Not all of my clients use SQL Server and I miss LINQ when working on their projects. I'm really looking forward to seeing Oracle deliver LINQ support in the spring. LINQ-to-SQL has, however, a major feature that the Entity Framework does not: With the Entity Framework, only LINQ keywords that can be directly translated into SQL are supported. LINQ-to-SQL is far more flexible on that ground.

About the Author

This story was written or compiled based on feedback from the readers of Visual Studio Magazine.

comments powered by Disqus

Featured

Subscribe on YouTube