DevSmart

New Visualizations at Work

Is it time to move from classic Web apps to Silverlight clients?

Microsoft's tools for building rich Internet applications (RIAs)-ASP.NET AJAX and Silverlight 2-promise to help take the "developer ugly" out of line-of-business software.

The catch? Training your developers to know when and how to use this mix of tooling to render high-performance business apps that advance the user experience.

Several sessions at last month's technology conference VSLive! New York addressed how to take advantage of AJAX and Silverlight in the same app. In his "LOB 2.0 with Silverlight and AJAX" presentation, Infragistics Inc.'s Technical Evangelist Tony Lombardo acknowledged that line-of-business (LOB) apps traditionally have stressed function over form. Microsoft's advances in its Web technologies are enabling developers to move from HTML and ASP.NET's linked Web pages with Postbacks to HTML and ASP.NET AJAX-enabled "applications," and now AJAX and Silverlight animations that increase usability and appeal, he said.

ASP.NET AJAX consists of a client-side library and server-side extensions that remove some of the complexity of coding in JavaScript, which is based on a very different programming model than C# and VB.NET. Silverlight 2 beta 2 adds a subset of the .NET CLR, essentially offering developers a plug-in runtime in a browser.

"When Silverlight came out, it was this really cool thing and we could do things that we only dreamed of in JavaScript," Lombardo said. "But that doesn't mean that there's no reason to use JavaScript anymore."

Deciding Factors
Which dev tooling should your developers use to build effective Web applications? The traditional requirements for LOB apps haven't changed. In his presentation, Lombardo highlighted standard business concerns such as the application architecture, authentication, roles and profiles, support for user-defined options and data access.

He pointed out that while ASP.NET AJAX is a server-side and a client-side technology, Silverlight is a client-side technology that uses AJAX as the glue to the server. Silverlight doesn't offer a built-in authentication model. As an easy fix, developers can use the browser or the encapsulating ASP.NET page to provide authentication. Another option is to build a Web service to take advantage of the authentication services in ASP.NET 3.5, avoiding the look of the "old Web" ASP.NET log-ins in a Web 2.0-style application.

Microsoft Regional Director Vishwas Lele offered up his own experiences in his VSLive! session, "ASP.NET/ AJAX/ Silverlight: Which One to Use, and When?" Lele, the chief technology officer at Applied Information Sciences Inc., showed how developers could implement the same behaviors in an LOB Web client using ASP.NET AJAX, and then by dropping a Silverlight object control into the existing ASP.NET AJAX app.

"I'm constantly faced with the challenge of, how much ASP.NET should I be using?" says Lele. "Should I be using JavaScript at this point? Should I be using Silverlight? Have we reached the usefulness limit of HTML brackets?"

Silverlight 2 offers developers the ability to add RIA elements to the client such as video, data visualizations and text boxes. "The capability of Silverlight that excites me is you now have the ability to run a significant amount of code on the client without giving up performance," says Lele.

In the ASP.NET AJAX app example, every time the user wants data on a selected company, the app makes a service call to the server to download the data visualization. When the Silverlight control is added to the AJAX app, it enables data visualization, as well as drill downs on that data, directly on the client. Silverlight 2 uses the Isolated Storage API in .NET, enabling developers to store up to 1MB of data on the browser. Silverlight is just one object in the browser; it's still using HTML and JavaScript, which calls a Silverlight method to render the charts.

A common mistake that people make, according to Lele, is to start using the Silverlight control when it's not fully initialized.

Developers also need to make sure that all of the key validation checks that happen on the server also are performed on the client. In Visual Studio 2008, the Silverlight debugger feature can walk through the server-side code and also attach to the browser process, according to Lele. He also applauds the JavaScript IntelliSense that Microsoft has added in VS 2008.

Presentation and Logic
App dev is moving toward the decoupling of the UI and behavior, a trend that Microsoft has embraced in its use of XAML for client UI with code behind it for the operations and data binding. This "decoupling" is not easily accomplished with AJAX and JavaScript, according to Lele.

An application architecture that takes this idea a step further is the Model-View-ViewModel (MVVM) pattern, which was highlighted in Lombardo's VSLive! presentation. The ViewModel handles data surfacing and operations, essentially communicating between the data model and the view. This approach can help separate the developer's code from the designer's XAML files. It also facilitates testing, among other benefits.

Microsoft has worked hard to give developers and designers the tools to create RIAs that improve user experience. To get started, Lele recommends that developers who want rich visualizations incrementally implement Silverlight into their business apps and manage some of the JavaScript complexity by creating JavaScript components and behaviors.

About the Author

Kathleen Richards is the editor of RedDevNews.com and executive editor 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