Silverlight as AJAX replacement
Posted: Mon Apr 11, 2011 2:46 am
In my journey of learning Silverlight, I came across some pretty nifty functionality it has. It can both read and alter the DOM in a very consistent manner, making it more akin to jQuery than Javascript. There are some projects out there that are creating small, single-color Silverlight applications that sit in the corner of a page that are only big enough to display the "Get Silverlight" logo if the user does not have it, and then turn the same color as the background if they do, where they will exist only to control the DOM and communicate with various servers. Instead of making a very lengthy article about it, I figured I would make a Pro and Con style list for the idea of completely replacing, or nearly replacing Javascript/AJAX with Silverlight.
Pros:
- An extremely robust programming platform that is fully object-oriented with many modern features that will likely never make their way into Javascript.
- Full, real-time networking access through either WCF, sockets, or any other solution.
- Fully cross-browser, relieving the developer of normal Javascript-related cross-browser issues.
- Client-side access of web services.
- Fully unit-testable with excellent libraries and tools to support it.
- Visual Studio.
- Cross-language support, being able to be used by any .NET language (C#, VB.NET, IronPython, F#, etc.).
Cons:
- Requires a plugin. Even though Silverlight has greater than 60% installation base, that is a far cry from the 95%+ Flash install base. This means you are pretty much guaranteed to have some users that won't have the plugin and will need to download and install it. While this is relatively painless and fast process, some users may not feel comfortable downloading it, or some inexperienced computer users may get confused during, or not understand, the process.
- Using an RIA plugin means that your page may not be usable on most mobile devices.
- Some projects may be better off designing with WebSockets in mind, depending on the future support for WebSockets among browsers and some issues with browser WS lock-outs being resolved.
- While there are work-arounds, Silverlight is not equally supported in the Opera browser and on the Linux OS. The Moonlight project and a community-created hack for Opera can fix both of these, but it is fairly unrealistic to think that a user will go through all that effort just to use your application, particularly if they are trying your application on impulse.
Pros:
- An extremely robust programming platform that is fully object-oriented with many modern features that will likely never make their way into Javascript.
- Full, real-time networking access through either WCF, sockets, or any other solution.
- Fully cross-browser, relieving the developer of normal Javascript-related cross-browser issues.
- Client-side access of web services.
- Fully unit-testable with excellent libraries and tools to support it.
- Visual Studio.
- Cross-language support, being able to be used by any .NET language (C#, VB.NET, IronPython, F#, etc.).
Cons:
- Requires a plugin. Even though Silverlight has greater than 60% installation base, that is a far cry from the 95%+ Flash install base. This means you are pretty much guaranteed to have some users that won't have the plugin and will need to download and install it. While this is relatively painless and fast process, some users may not feel comfortable downloading it, or some inexperienced computer users may get confused during, or not understand, the process.
- Using an RIA plugin means that your page may not be usable on most mobile devices.
- Some projects may be better off designing with WebSockets in mind, depending on the future support for WebSockets among browsers and some issues with browser WS lock-outs being resolved.
- While there are work-arounds, Silverlight is not equally supported in the Opera browser and on the Linux OS. The Moonlight project and a community-created hack for Opera can fix both of these, but it is fairly unrealistic to think that a user will go through all that effort just to use your application, particularly if they are trying your application on impulse.