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

  • Cloud-Focused .NET Aspire 9.1 Released

    Along with .NET 10 Preview 1, Microsoft released.NET Aspire 9.1, the latest update to its opinionated, cloud-ready stack for building resilient, observable, and configurable cloud-native applications with .NET.

  • Microsoft Ships First .NET 10 Preview

    Microsoft shipped .NET 10 Preview 1, introducing a raft of improvements and fixes across performance, libraries, and the developer experience.

  • C# Dev Kit Previews .NET Aspire Orchestration

    Microsoft's dev team has been busy updating the C# Dev Kit, a Visual Studio Code extension that enhances the C# development experience by providing tools for managing, debugging, and editing C# projects.

  • Hands On: New VS Code Insiders Build Creates Web Page from Image in Seconds

    New Vision support with GitHub Copilot in the latest Visual Studio Code Insiders build takes a user-supplied mockup image and creates a web page from it in seconds, handling all the HTML and CSS.

  • Naive Bayes Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the naive Bayes regression technique, where the goal is to predict a single numeric value. Compared to other machine learning regression techniques, naive Bayes regression is usually less accurate, but is simple, easy to implement and customize, works on both large and small datasets, is highly interpretable, and doesn't require tuning any hyperparameters.

Subscribe on YouTube

Upcoming Training Events