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

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube