Silverlight, JavaScript and HTML 5 - Who wins?

Posted on 1/5/2011 @ 2:13 AM in #Vanilla .NET by | Feedback | 6063 views

 

Disclaimer: These are just opinions. In the past I have expressed opinions about the future of technology, and have been ridiculously accurate. I have no idea if this will be accurate or not, but that is what it’s all about. Its opinions, predicting the future.

 

This topic has been boiling inside me for a while, and I have discussed it in private gettogethers with fellow minded techies. But I thought it would be a good idea to put this together as a blogpost. There is some debate about the future of Silverlight, especially in light of technologies such as newer faster browsers, and HTML 5. As a .NET developer, where do I invest my time and skills – remember you have limited time and skills, and not everything that comes out of Microsoft is a smashing success. So it is very very wise for you to consider the facts, macro trends, and allocate what you have limited amounts of – “time”.

The time is January 5th, 1AM, and I am penning my thoughts down on this topic with the following technology spectrum -

  • IE9 is still in Beta
  • Chrome is one of the fastest browsers around, and most browsers now have a fairly fast JavaScript engine.
  • Anecdotally, even though Silverlight has been out for many years now, I still see more usage of flash on the web. Well the highest usage is of HTML and JavaScript, followed by flash.
  • HTML 5 is now partially supported by many browsers, though it is not at a point where it is the defacto application choice.
  • App stores and mobile phones/tablets are the rage.

 

So, before I make my case on what the future, let me analyze what SL4 offers (source), versus what SL 5 offers (source), and express my real world thoughts on what this means vis-à-vis with JavaScript based solutions.
The reason I am comparing this vis-à-vis with JavaScript based solutions is because HTML5 is not yet a mature platform – your choice effectively today is HTML4+JS or HTML+SL for rich internet apps. I am not well educated enough to compare it with flash.
Though as a blanket statement about flash vs. silverlight, I love the fact that SL is .NET and comes with pretty good tools, the fact remains that flash is more widely accepted and in use, which sometimes forces me to pick flash over SL. I don’t like it, but it is what market demands require me to do.

First, lets see what SL4 brings to the table.

Feature Description

HTML + JS story

Conclusion

Silverlight Score

Print capability

HTML cannot match up to Silverlight’s print capabilities. But that said, it is important to realize that most content on the web is still HTML. Silverlight does not do readable text well, both from a user experience, developer experience, or search engine experience point of view. Thus, it is important to see that you will want to print what the users wish to see, which is HTML. And for that reason, the de-facto print choice has been PDF. I was hoping the XPS format would change things, I have no idea why it didn’t, but it didn’t – the world still uses PDF.

Silverlight has a really nice feature that you will almost never use.

0

Form controls

Silverlight forms don’t even come close to what HTML offers. The process of creating and maintaining a SL form is frustrating in comparison, plus you will find an HTML developer easier than you will find a XAML developer. RIA services makes some things easier, but some things harder

Silverlight loses here. HTML forms are better. While Silverlight forms potentially can offer the jazz/animations (read more on that later), who cares, forms are about functionality, not animation and fru fru effects. Disagree with me? How many SL forms do you see in use in the world? Is TurboTax Silverlight or JavaScript?

-0.5

WCF RIA Services

The theory here is that RIA services let you be more productive because it is a better architected paradigm. For the most part I would agree. Strongly typed business objects do bring their set of advantages, but they also bring a set of disadvantages. While you have validation in objects, you also have less flexibility. And then RIA services has its own issues. Many of the issues RIA services solves, are issues JavaScript does not have.

The newer javascript frameworks can work very well with strongly typed languages that exist on the server side. So the RIA services advantage is diminished. From a business perspective, I don’t think a CIO cares much about MVVM vs. MVP, as much as they care about the app working on mobile browsers and citrix without client side installs. However, this can be argued either way, so I am going to be lenient and give SL a 0 here for no clear advantage. It is advantage is some scenarios, and disadvantage in others.

0

Localization enhancements

Don’t even get me started here. SL doesn’t even come close to the localization story that HTML offers.

SL is playing a catchup game here.

-1

Out of Browser Apps

Okay, this is interesting. SL apps let you do OOB apps. This means toast notifications, writing to my documents etc., group policies etc. This is clearly what HTML cannot do

SL wins here. Though it is to be noted that with thinner clients, less reliance on your desktop storage, and “cloud” everything, this may not apply in some scenarios. So for windows machines, which are still the dominant OS out there, I say SL wins.

1

Better data binding support

SL has amazing data binding when compared with JavaScript. But for a moment, consider why you need this? For forms? Well usually! I’m sure you can come up with other crafty scenarios. But for business apps, it’s usually forms and data presentation UI. So, SL’s better data binding still puts SL’s forms behind HTML.

SL looses here, not because it’s databinding is worse than JS – it’s better. But the overall result is less compelling, so Forms + Databinding, I am giving it a total of -1.

-0.5

MEF for large composite apps

This is a perfect example of where SL sucks. Not because MEF is bad, MEF is very intelligent and awesome. But MEF is trying to work around a big limitation SL has, it is precompiled, zipped, and downloaded on demand. JavaScript can be generated at runtime, and added to the DOM on demand. With IE9, it will even get compiled.

SL loses hands down here. Not because MEF is bad, but in JS it is unnecessary. SL + MEF still doesn’t hold a candle to the flexibility JS offers. I wish I could give SL -2 here.

-1

Better tooling in VS2010

Seriously!? Okay it is better, but that still doesn’t mean adequate. Heck even debugging XAML is a pain, which is addressed in the next version of SL (5). But the debugging capabilities of JS in most of today’s browsers make VS2010 SL debugging look like rocks, bows and arrows.

SL looses

-1

Fully Editable design surface in VS2010

Again! Seriously? Have you used Expression blend? I’ll tell you what, I won’t argue this point. It’s just my opinions anyway, but why don’t you try and create a nice looking SL UI in blend. Give it a try, really!

HTML wins. VS and many other tools offer HTML design experience way better than SL does.

-1

Drag drop databinding

I’m gonna give it zero, because read my above comments about SL forms and Databinding in general.

-

0

XAML intellisense, C# and VB intellisense

Okay, this is where SL wins. No its not because I love XAML. XAML is pretty cool, but not so revolutionary that I am dumping C#/HTML everything else. But it sits in a nice middle ground between higher level languages and html-ease. And you cannot argue that C# is easier to program in than JavaScript. Intellisense, object oriented capabilities, strong typing, does make it easier to code.

SL wins

1

Animation effects

AHA! This is what SL is good for, right? Yeah! Marginally! When you talk of extreme animation, like the pivot viewer, then SL wins. But here is a perfect example. Compare bing maps in javascript, and bing maps in Silverlight. What do you see? SL is better. But, why? It’s graphics acceleration mostly, which is an advantage that will go away. Since this is a future looking opinion article, I am going to take this advantage away from SL.

I am giving SL 0 on this. Why? Because 99% of the animation I need, JavaScript is enough for. And with newer technologies, that 1% is shrinking further and further

0

Webcam support

SL wins. JavaScript cannot do webcam, though flash’s webcam support is better

Okay fine, SL wins this one

1

Copy Paste/Drag Drop

SL loses. SL’s copy paste/drag drop is still inferior to javascript

 

-1

Long lists can be scrolled effortlessly

Again SL loses. Browsers run as thick clients themselves. They have no such issues, and you can do load on demand etc. very easily.

 

-1

Right click context menu

SL loses. JS can do right click context menu in a cross-OS way.

 

-1

Support for Chrome browser

Seriously? Okay HTML-JS works everywhere. Even your iPhone, and let me rub it in, even Windows Phone 7 browser, where SL doesn’t work.

Again, this is where I wish I could give SL -2.

-1

Performance optimizations

SL will perform better, but with IE9 and compiled JS, the advantage is very very thin. Same explanation as animation effects.

 

0

Multi touch support

Wake me up when Windows supports multi touch properly. But do read my comments on Windows phone 7 at the end.

 

0

Media support

SL wins, hands down. This is where you do not have any competition to SL. SL’s DRM and mutlirate optimization etc. is very very hard to beat.

Okay, this is where I wish I could give SL a +2, but staying with the above trend. It gets a +1.

1

 

Okay good. But SL4 is production, getting stale even. Lets talk about the new exciting SL5 now.

Feature Description

HTML + JS story

Conclusion

Silverlight Score

Media Support

Again, SL wins – it increases it’s already comfortable lead

Hardware decode, Trickplay, etc.

But then again, if you listen to Scott Guthrie talk in this dotnetrocks show, he says that this will enable scenarios like playing 1080p on netbooks. Future looking,

a) Netbooks will get more powerful.

b) Slates have effectively killed the netbook. The iPad which is way thinner, has amazing battery life effortlessly plays 720p. Which tells me that netbooks inability to play 1080p isn’t due to current technology limitations anyway.

Okay I give it a 1, because SL is better at media than anything else.

Power awareness

HTML JS piggy backs on the OS’s power awareness features. But where this really makes a difference is media. SL now knows that if a video isn’t playing, it is okay to run the screen saver.

Hmm, again, SL is better here, but for only media reasons. I’ve already given SL a +2 on media, so I’m gonna give it a zero here.

0

WS-Trust support

Okay HTML can’t do this. This opens some borderline scenarios which are cumbersome in HTML-JS to solve.

I wish I could give it a 0.1 here, because the scenarios are very border line. But heck I’m being very lenient here with SL.

+1

Better OOB apps

OOB apps can create child windows

I already gave SL a +1 here

0

64 bit support

Eh!? SL, welcome to 2004.

Most browsers are still 32 bit, so the benefit is marginal.

0


Now, let me talk about features that did not get elucidated in either of the above, but are important to consider.

Feature Description

Argument

Silverlight Score

Wider applicability

SL loses here. It’s been around for 5+ years, and yet flash and html are still the king. HTML JS, will work on iPhone safari, Citrix etc. with no requirement to install anything. You can be sure that if you target JavaScript, your app will run everywhere. SL maybe the most technological advanced thing since fire, but if it doesn’t run, it’s just a broken embed tag.

-1

Windows Phone 7 Apps

These are written in SL. So the future of success of SL is tied to Win Phone 7. And while fanboys will either argue against or for Win Phone 7 to be the best thing since sliced bread, I am going to sit and wait and watch how it goes. This is the wildcard that could make or break SL.

*

Applicability of SL

I see some borderline scenarios where SL makes sense. Example Office Web Apps (specifically word and powerpoint), will work with pure javascript, but if have you Silverlight, they work so much better and nicer. Same goes for borderline scenarios where you need WS-Trust, you need a persistent TCP connection to the server (HTML 5 can do this), etc. Anyway, for these borderline scenarios, SL wins.

1

ActiveX

Let’s not forget, SL is ActiveX, or a plugin. So it doesn’t blend well with HTML. It likes to sit on top, and own the area it is sitting on. You can do windowless, but then you lose graphics acceleration, which is one of the biggest reasons to use SL anyway. With IE9, windowsless mode will use graphics acceleration, but so will javascript. So this is a huge disadvantage SL has.

-1

 

Great. Now lets add the scores up. The overall score is     

Minus 4 + *. (The * being Windows Phone 7).

Conclusion: And finally, here is my long drawn conclusion.

Silverlight will be around. But I don’t see Silverlight growing much bigger than it is. It just doesn’t offer any real advantage on top of what we already have. But for the borderline scenarios it enables, I see SL as one of those skills that you should pick up. Things that could greatly improve SL’s chances in the future.

a) Microsoft could package it as a part of Windows 8, which would help it’s adoption.
b) Windows Phone 7 is a smashing success.
c) SL becomes the defacto development platform choice for even more scenarios.

So all in all, if you’re trying to budget your time, it is in my opinion wiser to pick up JavaScript skills first, and Silverlight Skills next. Of course knowing both is the best, but we have limited time.  I know JavaScript and Silverlight both quite well. But I find myself using JavaScript more. Sometimes I start projects with Silverlight and then end up jettisoning it for a JavaScript based solution because it was quicker/easier to create and nicer to look at once you considered the effort involved.

And finally, don’t believe canned demos, isolated scenarios. There is an insane amount of misguidance out there in the form of 30 minute canned demos. Try it out yourself before you make any firm opinions.

Sound off but keep it civil:

Older comments..


On 1/5/2011 3:07:55 AM Marcus said ..
I've invested a lot in Silverlight so I'm biased (but who isn't). I'd like to add a couple of things:

1. Don't completely agree with you on the forms and data binding stuff. Well, I agree in terms of "name-and-address"-forms, but data grids with editable content and row details and all sorts of weird stuff is a mess in HTML (it seems I don't like ANY of the jQuery table/grid plugins I've seen) and really easy in SL. Validation, dirty data, partial updates etc. is really a walk in the park with SL.

2. I really, really wish the SL pentration was higher, because the HTML "write once, test everywhere" terror is KILLING me. But on the other hand, FF and Chrome (and others) do strange stuff with SL too (like unloading the xap if the markup container is set to display: none) so perhaps I just have to accept reality: *NOTHING* is cross-browser, cross-platform.

3. OOB doesn't do it for me at all. The browser is the OS, kind of. I'm coding for the web, not the desktop.

Something like that. I didn't really think this through, but I thought you put an effort into your post so I just wanted to throw a couple of cents in there. Thanks.


On 1/5/2011 3:17:33 AM Sahil Malik said ..
Marcus,

Thank you for your comments.


I am interested in impartial commentary, so your comments are very appreciated.


What do you think of this grid? http://trirand.com/blog/jqgrid/jqgrid.html


This is pure javascript (jquery). Do you think it is ok for 99% of the scenarios out there?

Sahil


On 1/5/2011 3:40:10 AM Marcus said ..
Yeah, tried the jqgrid. Didn't like it. I mean, it's a nice piece of code and flexible and everything, but the default look is really 1998 and after spending some time customizing it (or trying to) I abandoned the whole thing and got the SL counterpart up and running and looking good in no time. But again, I'm much more fluent in SL.

I forgot something in my last post; I was really intrigued by your cryptic entry regarding Blend. My experience with Blend is that it MUST be good since cool people say it's the shit (like Laurent) and it's really black and got a lot of buttons and arrows and stuff, but every time I try to use it I end up in total misery and my app looks like a XAML atomic explosion. I realize Blend might have a steep learning curve and I'm just a ball trying to roll uphill, but it really annoys me that I never get Blend to do what I want. I can't even get design time data to do what I want it to do, let alone the app itself.


On 1/5/2011 8:15:19 AM Brian Bedard said ..
HTML+JS would gain even more traction if there was better tooling. No one wants to write reams of code anymore. And they certainly don't want to have to learn jQuery/some GUI adapter at a level where they can easily extend the class and not have bad side effects. If a tool like Visual Studio had designers and intellisence for jQuery and its plugin, you'd see even quicker adoption. Some of us don't have time to figure how to make the widget do this and that and stay on schedule with our client demands so we use what's available and seems to have good tooling, i.e. Silverlight.


But you're right SL has some issues like printing and data validation -- maybe I'm just doing it wrong. I didn't follow all your points because I have narrow scope and just trying to satisfy my clients needs. We had this argument about HTML+JS vs. Silverlight at my client. We went with SL thinking it would be easier to develop -- it wasn't. I ran into a whole new set of problems I never had with HTML+JS. But we did it because we were led to believe because SL has better tooling and its .NET based, it would be easier to find resources than if we stayed on the JS path and looked for jQuery devs. Our long term resources complained they couldn't get anything done with jQuery and it was too hard to figure out the side effects of extending one of those UI classes. Although I guess we made it more difficult for them because we wrapped the UI into the rendering logic of SharePoint as a framework and that made a little mess. Not sure what to do now. These Silverlight apps we wrote will work for the client but they are fragile, maybe as we get better at developing in SL they will get better. But I'm always going to wonder if we should have stayed with HTML+JS for the long haul.


On 1/6/2011 5:35:23 PM Becky Isserman said ..
I think that you have some valid points, but right now it feels like it's a sit and wait game. I think that Microsoft is gearing up to move Silverlight in a new direction. Each version they fix some of the problems of the previous version too. I am very curious to see what they are going to do with Silverlight 5. Who knows maybe Silverlight will be a great media platform, instead of the flash clone that it was intended to be initially. I think that in some cases Silverlight might win if you are at an enterprise environment over HTML 5. There is already a great object model in SharePoint that is built in. I think in 2010 Development Silverlight will win, because I know a lot of government clients are barely on IE 7. Who knows when IE 9 will come into play. Otherwise for public facing sites I can see HTML 5 winning in a couple of years once browser adoption occurs for IE 9 on a wide scale. Great blog post I enjoyed it. It's been a long time since I've been to your site.


On 1/9/2011 4:20:47 AM Sahil Malik said ..
Marcus - okay. And Glad you got my point about Blend. You have to have died to see hell y'know! :)

Brian, see perfect example of someone who has been through a real SL project. Too many demo monkeys out there trying to push SL down our throats. It does have applicability, but not a replacement for JS.

Becky, good to see you here. Sit and wait game, I think mostly due to WP7. WP7 is pretty cool I admit, and I think iPhone's hegemony is seriously challenged here. But yes lets see where it goes. And, I haven't been blogging much, but that's gonna change .. hehe :).


On 1/31/2011 3:34:17 AM Frank said ..
Expression Blend 4 is very powerful and very easy to use, you can realize layouts that you cannot realize in Html + Js, or that you realize in 50x the time with browser compatibilities problems.

I think that the problem it's you that can't use it, not Blend.


VS2010 is not for the design of the application, the design surface is a surplus, Blend is the tool to use to design a Silverlight Application or a Game.


On 2/9/2011 1:59:34 PM Pedro Dias said ..
I'm going to say it, because Sahil didn't have the guts to say it himself:


SL without Android and iOS is never, ever, in a million years, going to go anywhere. SL5 isnt going to change that unless they have some magic "Run this as a HTML5/JS thing".

Windows Phone 7 isn't taking off. I've only seen MS people using them so far, and every time they show me something, I whip up my iPhone and just blow them away with something that is faster, better looking, and smoother to the touch and feel. There is no killer app on WP7. Every phone app I've seen so far is jerky, and even the the tiles are FLAT, not even a tiny emboss effect to make stuff pop out JUST a little. - Everyone that I know (and I only know geeks, nerds, and Maliks) are using iOS or Android devices - with DEEP icons. We want deep! Flat belongs in the 70s and Windows NT!

I agree with you on almost everything you've said in here, but you did forget one MAJOR issue that is a serious factor in my own process of starting to dislike xaml: WPF and SL are diverging technologies! I can do fancy webcam stuff on SL that I cant repeat in WPF. Where are my data triggers in SL?? Why didnt they offer MEF in WPF? In my view, letting WPF and SL diverge is bad, bad bad - One of the reasons that compelled me to dive into xaml based application development was the joy of being able to apply knowledge from one platform to the other. Instead, I'm tearing large strands of THICK hair from my armpits in agony of not knowing why they arent working the same way.

I actually love xaml. MVVM is a funny pattern, it does break SOLID principles of software design, but we can rant over that some other time. Always enjoy your writings, Sahil, and I havent forgotten you - we WILL do that walk in the park -honest :)

P.


On 2/10/2011 1:41:30 AM Sahil Malik said ..
Pedro - excellent comments. And I love your sense of humor, though there is a guy in my class this week with a natural Scottish accent, so he is naturally funny. I am learning Scottish accent from him, in fact I am writing this comment in a deep Scottish accent. Seriously, he makes me want to go to Scotland where everyone talks like that.

I'm here this wknd, we could do the walk in the park, but the hot Norwegian chicks have probably migrated and been replaced by arctic seals at the moment.


On 5/15/2011 2:04:09 PM Hey said ..
I stopped reading at Form controls section, which proved your total ignorance.


On 5/25/2012 2:56:42 PM user said ..
Author is either brain dead or doesn't have silverlight expirience.


Printing is a must in enterprise environment.


Form control is 100 times better in SL. There are no browser compatibility issues at all.


HTML doesn't bring anything special for localization.


There is no sense to read forward. Everything is absolutely incorrect.