In-Depth

Silverlight: What Web Forms Wanted to Be

ASP.NET Web Forms was ahead of its time. An ambitious attempt to make programming for the Web feel like programming for Windows, Microsoft introduced an innovative platform in January of 2002 that heavily abstracted the complexities of developing user interface elements with HTML and transformed Web development into an experience nearly indistinguishable from the complementary Windows Forms. Web Forms is a style of ASP.NET Web development designed to bring the familiar event-driven programming model of Visual Basic and Windows Forms applications to the Web. It unlocked the opportunities of Web development for the masses of existing client-application developers coming from a decade of Visual Basic. Almost.

The key problem that Web Forms had to solve: making a “stateless” development environment behave as if it had state. The Web is inherently “forgetful.” Once a server delivers a page, it forgets about it. This presents a challenge for line-of-business applications that often need to do some processing and redisplay a form while retaining changes made by the user.

Microsoft's Secret Sauce

Overcoming this forgetfulness in a standards-based way, relying on nothing but the Web’s traditional HTML and HTTP infrastructure, borders on magic. The underlying features that grant state to the Web might as well be magic for many Web developers. Microsoft created a complex processing system that included a secret sauce called “ViewState” to overcome the forgetful nature of Web servers toward the pages they serve. At the same time, Microsoft heavily abstracted developers away from the core technologies of the Web--HTML, CSS and JavaScript--and instead introduced a model that interpreted server markup to produce the needed output. Ultimately, Microsoft created a Web development platform tuned for line-of-business applications, and abstracted as much of “the Web” as possible without requiring custom browser software.

Unfortunately, the Web and magic do not mix. Eventually, Web applications must pay a price for the illusion they have the state that comes naturally to their desktop counterparts. As much as Web Forms tries, it cannot overcome the fact that it is operating in a stateless environment. While it goes a long way to close the gap between desktop and Web development, it never fully realizes the goal of making Web development feel like desktop development.

Does that mean Web Forms is a bad idea? Of course not! Businesses understand the value of applications that can be easily deployed and updated via the Web, avoiding the slow and resource-intensive process of building, testing, and deploying software to desktops. In a perfect world, businesses would be happy to take existing desktop applications, along with the associated “stateful” development model, and marry that to the Web’s simplified deployment. Web Forms tried, it just failed to go far enough.

Plug-in to a Rich Internet Experience

With nearly a decade of hindsight, Microsoft recognized that the only way to truly achieve the utopia businesses desired was to stop trying to work magic with the Web and instead build and deliver a plug-in that completely avoids the limits of browsers. Silverlight is the solution. A cross browser, cross platform plug-in, Silverlight is a Microsoft technology for building Rich Internet Applications using the popular .NET programming model and tools.

Silverlight is what Web Forms wanted to be, a stateful application development model that can be deployed and updated as easily as traditional Web sites. Unencumbered by the limits of stateless pages, developing for Silverlight finally achieves what ViewState could not: It allows traditional desktop application developers to reuse their skills and development patterns for applications that can be deployed with no installation, save for the Silverlight plug-in.

It also solves many of the other “problems” Web development creates for client application developers. With a consistent run-time not pegged to unpredictable browser implementations, Silverlight is able to deliver a consistent user experience without requiring days of extra testing and tweaking. The improved statefulness enables rich experiences often omitted in Web Forms applications, such as real-time field validation and error messages. Web Forms attempted to offer solutions to provide similar richness, but the perceived complexity of JavaScript, AJAX, and a host of other technologies needed to make it all come together often left time-strapped enterprise developers on the sidelines.

Browser and Desktop

It is clear that Silverlight is the natural successor to Web Forms, but its value extends beyond the original vision of Web Forms. Able to run out of the browser context and in absence of a network connection, Silverlight is arguably an up-and-coming replacement for traditional client application development, too. In all but the most unique applications, Silverlight’s capabilities make it a suitable replacement for apps that today may be built with Windows Forms or Windows Presentation Foundation (WPF).

With a single development and deployment model, Silverlight applications can target both browser-based and desktop use cases. Whereas Windows Forms and Web Forms require two distinct approaches to .NET application development, Silverlight allows developers to focus on mastering a single approach. If more evidence is needed to prove this is the future, examine the new Visual Studio LightSwitch from Microsoft. Targeted exclusively at simplifying line-of-business development, LightSwitch produces applications that can be deployed to the Web or desktop, and it uses Silverlight to produce both experiences.

Silverlight is not a silver bullet. It requires a software install to load the plug-in. With locked-down corporate networks, or devices such as Apple’s iPad, this software is inaccessible. In many ways, Silverlight is best viewed as a replacement for client application development and not a replacement for Web development. Even Web Forms is designed more to help with “client-like” application development than “pure” Web development. That point is reinforced by the recent introductions of ASP.NET variants, such as ASP.NET MVC, that move away from the simulated stateful programming model in Web Forms. For Web site development, or for applications where the Silverlight plug-in cannot absolutely be guaranteed, one of ASP.NET’s powerful variants is still the best choice for development.

Microsoft envisioned a world in 2002 where developing for the Web and Windows would be indistinguishable. Windows Forms and Web Forms tried to present a uniform approach, but ultimately Web Forms was bound by the limits of the Web and the vision was never fully realized.

With Silverlight, Microsoft’s vision is nearly complete. A single, unified programming model for building applications that run on the Web, desktop, and with the release of devices like Windows Phone 7, the emerging Internet-connected device, too. Web Forms and Silverlight will continue side-by-side long into the future, but for line-of-business applications, Silverlight has the momentum and Web Forms to thank for laying the foundation.

The opinions expressed here are those of the author and do not necessarily reflect the views of RedDevNews.com.

About the Author

Todd Anglin is Executive Vice President of Cross-Platform Tools & Services for Telerik, a provider of tools and solutions for web, desktop and mobile application development. In his role Todd is responsible for teams focused on cross-platform solutions, which include the company’s popular HTML/JavaScript framework, Kendo UI, as well as Icenium, the easiest way to build hybrid mobile apps. Todd is an author and frequent speaker on HTML5 and web standards development. Follow Todd @toddanglin for his latest writings and industry insights.

comments powered by Disqus

Reader Comments:

Thu, Nov 18, 2010 Ray Burns

Last spring I had the opportunity to teach a seven hour mini-class to a group of high school kids, only one of whom had ever written a line of code, and several of whom had no interest in programming at all. I taught them Silverlight. At the end of the class every one of them was writing Silverlight applications that would have taken a professional days to write using ASP.NET/HTML/jQuery. Silverlight is beautifully simple and wonderfully powerful. Yes, if you want to write custom controls or re-implement the data layer there is a lot to know, but you don't need all that for most normal programming. And even the advanced topics in Silverlight are simple compared to the tortuous complexity of AJAX, JavaScript, DOM, ViewState, HTML, CSS, etc.

Thu, Nov 18, 2010 Marc Schluper Beaverton

Developers who know Silverlight do not reject it. It's awesome. Sure, it might be possible for some people to create my Silverlight applications in HTML5 but surely they cannot do it as fast as I can do it with Silverlight. Its databinding and templating are delicious. They save lots of time and allow me to add more and more features while hardly adding complexity. Moreover, I can use a mature and evolving language like C# and don't need to waste time struggling in JavaScript. And then there is the tooling. And indeed, the performance - no need to send state info back and forth, no need to use a DOM, no need to peel the data out of the mix of data and markup. It's easy (even the most obvious thing to do) to retrieve data only once and cache it on the client. And there is more: tons of controls whereas after 15 YEARS (!!) HTML still does not have any (well, there are some in jQuery, but jQuery does not even have a TreeView or a splitter control). Imagine: you could have a Datagrid in your application in minutes, and it comes out of the box with scroll bars, sorting, paging, frozen columns etc. Data visualization is a blast with Silverlight. And it's all free! So. Before you reject anything, make sure you know what it is.

Fri, Nov 12, 2010 Greg Newbrough San Diego

Great article. Would like anyone who offers an opinion to state the amount of hours of actual Silverlight development time invested or provide links to Silverlight 4 applications they have actually created. Myself? 3 books, about 40 hours of keyboard time and still trying to make up my mind if becoming proficient in Silverlight will be worth it in a year. Seems public opinion is slanted more towards bashing Silverlight than towards it's merits...

Thu, Nov 11, 2010 Navot

Way to go! Todd. I believe this is the first that time that it is spelled out loud. The king is naked. Silverlight is in no way the "elegant" solution for reasons already pointed out: plug-in, stiff learning curve. The real challenge is to reproduce the desktop development experience statefull Web Forms for HTML and better still for HTML5 – Silverlight and Flash killer. If it also communicates with the server the Ajax way this could be the best of all worlds: Web Form, richness and responsiveness all in a plain browser, and the ultimate solution – cross browser with no need to develop for each browser. There seems to be few solutions that target this best of all worlds; I believe one of the fast maturing solutions is Visual Web Gui. It seems to be the closest to what Microsoft was trying to establish. So Microsoft, keep working, do not give up – you will do it sooner or later….

Tue, Nov 9, 2010 Phil

Sorry but Silverlight was not created out of technical necessity or desire. It was created, as are so many failed Microsoft products, as a response to a perceived threat. In this case Flash.

Mon, Nov 8, 2010 TJ

Very one-sided article, Todd. Siverlight is clearly not WebForms successor nor alternative. It is a radical and not completely well though of u-turn of what semantic and accessible Web should be. To top it off, it is a completely different paradigm, making skills people acquired over 15 years useless. 99% percent of designers are now skilled with HTML,CSS,Photoshop and now out nowhere - Blend? XAML? Why? To see why this technology was a particularly bad decision, just look at its lifecycle 1. The uber-web. Will replace HTML and all. 2. Well, not quite, only "sweet" spots. 3. Ok, Silverlight is now a desktop OS. 4. Oh, noes, it is now Windows 7 Phone development system. I was originally glad that Microsoft acknowledged this in the last conference, but the outcry of the "community" made them issue follow-ups that will prolong the agony for several more years instead on focusing on something more productive.

Sun, Nov 7, 2010 Bassam

Clear and very good article , you know if Bob Muglia's apology article was this one, that would have been much better ! , fully agree with you.

Fri, Nov 5, 2010 Bryan Morris

Excellent article. Too bad Microsoft's current management seems to lately be having trouble understanding the value of what it has in Silverlight. If Steve Jobs owned Silverlight, Apple would, in short order, rule the world.

Add Your Comment:

Your Name:(optional)
Your Email:(optional)
Your Location:(optional)
Comment:
Please type the letters/numbers you see above