There's not that much "wrong" with Silverlight. But I honestly can't find much "right" with it either. It just feels like Microsoft forked off and created this new platform that at the end of the day doesn't offer much benefit over HTML/JS/CSS. Granted, MS started Silverlight well before HTML5 started coming into form.
Absolutely, C# is far more pleasant than JS and XAML is a nice alternative to HTML+CSS. All in all XAML was well thought out IMO. And since I'm knee deep in Silverlight right now, it's easy to forget how frustrating HTML/CSS/JS can be across all browsers. It's also easy to forget how difficult it is to test JavaScript code.
My problems with Silverlight are:
-- I really don't think it's going to become a dominate player, making my investment in Silverlight skills not nearly as effective as if I had taken this time to continue brushing up on my webapp abilities.
-- It has its own CLR, making a lot of the .NET tool stack incompatible. There is still not an ideal way to test Silverlight components and especially no ideal way to integrate tests into your build tools. Silverlight is waaaaaaay behind here. There is a lot of people out there trying to solve this problem, but so far all the solutions (I've tried most of them) have serious drawbacks. Jeff Wilcox's Silverlight test framework is the best one so far, but it's very slow, cumbersome and buggy.
-- Silverlight is incompatible with mobile devices. I have no hope of ever making this app work on the iPhone, Android or Blackberries. I suppose there is hope it will work on a Windows 7 Phone, but that's not enough. My Boss doesn't think this will ever matter to us, I'm not so sure. If we ever do decide we want a mobile version of our app, then at least the frontend of it will have to be completely rewritten from scratch.
-- Absolutely everything in Silverlight is asynchronous. This isn't a real problem, per se, and is a good boon sometimes, but there are times when it's a pain in the butt.
-- We have found the Mac Silverlight plugin and the PC Silverlight plugins have significant differences. Currently our app has serious flicker issues when ran on a Mac. We're not doing anything hacky, home brew, anything like that. The stuff that looks bad on the Mac is pure Silverlight code the way Silverlight was intended to work. I simply think the Mac plugin has more bugs and is a lower priority. I have no idea where Moonlight stands, but I have a feeling similar issues would occur. If I have to fight to get my app to run across all Silverlight plugins adequately, then IMO a major selling point of Silverlight is gone and I might as well just use HTML and fight to get it to to work across all browsers. At least dealing with browser issues is a common problem with a lot of solutions out there (a framework like Rails will even hide a lot of it). Dealing with Silverlight plugin issues? My only resource is the Silverlight forums and Microsoft Connect. I'm not nearly as hopeful there.
-- We are forced to use the Microsoft stack. Yes you can host a XAP file in Apache on Linux, no problem. But if your Silverlight app needs to work with data, there's a very good chance you are going to choose WCF RIA Services (which we did). Bam, use IIS to host the app now or take the gamble with Mono. Not a gamble I want to take. I much prefer Apache over IIS.
-- And ultimately, my real problem is as I write this app I just don't see any huge compelling features of Silverlight that makes all this worth it. Just about anything Silverlight can do, an equivalent modern webapp can do as well. Yes Silverlight does allow you to do this from the comforts of Visual Studio, C#, Blend and XAML. Much nicer waters to swim in than JS, without a doubt. But I just don't think I care. I think I'd rather deal with the current state of HTML/JS/CSS and end up with an app that potentially could be used on any device (within reason), can be hosted in Apache running on Linux, and can be a far lighter experience for the end user to boot.
I'm doing a Silverlight app as well (project management/code editor tool--does it sound like a solved problem? Why, yes, it is!). I concur with much that has been written, but here's a few other comments...
If you are working with RIA/WCF Services and the Entity Framework, if your app isn't straight up CRUD, data access gets a bit kludgey really quickly. The asynchronous calls from the client don't help.
I also agree with another comment that points out that there is little that Silverlight can do that a good JS-driven UI can't. We grudgingly moved to Silverlight because it allowed some degree of interoperability with our main product (which runs on PDAs and tablet PCs--data collection devices)--the web app will allow users to build UI flows for the devices, and thus we can use the controls already defined for the devices in the Silverlight app. I suppose that's one on of the selling points of XAML, but I haven't done enough work on the UI to make an informed decision about it.
My experience with Silverlight has been different. I like it enough that I'm actively looking for a full time Silverlight job now.
-- HTML/CSS/JS cross browser issues are a huge problem. As a web dev I waste an INSANE amount of time dealing with them. Silverlight solves that issue (I've never seen the mac issues you spoke about though).
-- Javascript debugging is horrible. Firebug helps but it's not even close to using Visual Studio to step through a problem.
-- C# is a great language. I can use Ruby/Python/F# as well. The backend and the UI can both be developed in the same language.
-- It's a stateful environment. This one takes a mindset change but makes life so much easier than a stateless webapp. This one is huge IMHO.
-- XAML and the layout/databinding system are awesome. I don't need a phd in css and a pile of hacks to make a complex layout. Efficient and elegant layout are huge for productivity.
-- I like to unit test and it allows me to do model-view-viewmodel. Almost everything I write is testable and it feels elegant.
-- It's easy to make apps look good. The styling system is well done.
-- It's easy for ux challenged folks to make some decent looking animations and real ux guys can seriously impress. The animation system is awesome and Blend is a great tool for ux. The ux and animation support in Silverlight is something traditional webapps can't do.
Microsoft as a company deserves the bashing that it gets but it's developer division is top notch. Silverlight/WPF and the tooling to support it have a good lead on everyone else. I don't know that Silverlight will become a dominant player but I do think that people are underestimating windows phone. Silverlight/XNA are better than what Apple/Google are offering for mobile development. I also have a feeling that you'll see Silverlight on Android before long. Apple is going to be peering over there walls as Microsoft and Google pull away.
> I like to unit test and it allows me to do model-view-viewmodel. Almost everything I write is testable and it feels elegant.
What are you using for testing? How well does it integrate with Visual Studio, how easy is it to debug a test, and how well does it integrate with your build tools? Silverlight's lack of proper testing environments is one of the biggest strikes I have against it. I'd love to rectify that.
I'm using Visual Studio unit tests (mstest) to test my viewmodels. Nunit would work too. I use model-view-viewmodel so I have very little (or no) code in the codebehind. If you want to take testing further look at the silverlight unit test framework in the silverlight toolkit. I haven't tried that but it seems to get updated with every version of the toolkit.
I like C# but XAML drives me nuts. Getting binding to work is like pulling teeth. I've taken to prototyping stuff in Flex because MXML binding is ridiculously simpler, although there's a bunch of C# stuff I'd love to get back...
I dislike what INotifyPropertyChanged imposes on my code. I also hate that faulty binding can't be found at compile time, but that might be expecting too much. I also dislike how binding is all or nothing, this isn't possible Text="{Binding PercentageOfFailure}%" But that also might be asking too much and even the idea that my view model should be formatting my data is a valid one.
That's why I like binding in Flex -- making something bindable is as simple as plopping [Bindable] in front of it. And binding also isn't all or nothing, you can easily do something like text="{loan.interestRate}%". It also has code completion for anything you put in the binding, although not quite as robust as elsewhere.
Flex 4 is pretty interesting -- they separated layout from the core of container components. So for example in XAML you have Grid, Canvas, Stack, etc. In Flex 4 you just have Group, which then has a layout property -- there's a few basic ones like basic(canvas) vertical, horizontal, and tile, but you can easily code your own... and then switch them on the fly.
Flex is basically a really damn good system for UI coding and design, but the ActionScript that backs it up is pretty weak compared to C#. If I could mix C# with MXML I would be in coding heaven...
Absolutely, C# is far more pleasant than JS and XAML is a nice alternative to HTML+CSS. All in all XAML was well thought out IMO. And since I'm knee deep in Silverlight right now, it's easy to forget how frustrating HTML/CSS/JS can be across all browsers. It's also easy to forget how difficult it is to test JavaScript code.
My problems with Silverlight are:
-- I really don't think it's going to become a dominate player, making my investment in Silverlight skills not nearly as effective as if I had taken this time to continue brushing up on my webapp abilities.
-- It has its own CLR, making a lot of the .NET tool stack incompatible. There is still not an ideal way to test Silverlight components and especially no ideal way to integrate tests into your build tools. Silverlight is waaaaaaay behind here. There is a lot of people out there trying to solve this problem, but so far all the solutions (I've tried most of them) have serious drawbacks. Jeff Wilcox's Silverlight test framework is the best one so far, but it's very slow, cumbersome and buggy.
-- Silverlight is incompatible with mobile devices. I have no hope of ever making this app work on the iPhone, Android or Blackberries. I suppose there is hope it will work on a Windows 7 Phone, but that's not enough. My Boss doesn't think this will ever matter to us, I'm not so sure. If we ever do decide we want a mobile version of our app, then at least the frontend of it will have to be completely rewritten from scratch.
-- Absolutely everything in Silverlight is asynchronous. This isn't a real problem, per se, and is a good boon sometimes, but there are times when it's a pain in the butt.
-- We have found the Mac Silverlight plugin and the PC Silverlight plugins have significant differences. Currently our app has serious flicker issues when ran on a Mac. We're not doing anything hacky, home brew, anything like that. The stuff that looks bad on the Mac is pure Silverlight code the way Silverlight was intended to work. I simply think the Mac plugin has more bugs and is a lower priority. I have no idea where Moonlight stands, but I have a feeling similar issues would occur. If I have to fight to get my app to run across all Silverlight plugins adequately, then IMO a major selling point of Silverlight is gone and I might as well just use HTML and fight to get it to to work across all browsers. At least dealing with browser issues is a common problem with a lot of solutions out there (a framework like Rails will even hide a lot of it). Dealing with Silverlight plugin issues? My only resource is the Silverlight forums and Microsoft Connect. I'm not nearly as hopeful there.
-- We are forced to use the Microsoft stack. Yes you can host a XAP file in Apache on Linux, no problem. But if your Silverlight app needs to work with data, there's a very good chance you are going to choose WCF RIA Services (which we did). Bam, use IIS to host the app now or take the gamble with Mono. Not a gamble I want to take. I much prefer Apache over IIS.
-- And ultimately, my real problem is as I write this app I just don't see any huge compelling features of Silverlight that makes all this worth it. Just about anything Silverlight can do, an equivalent modern webapp can do as well. Yes Silverlight does allow you to do this from the comforts of Visual Studio, C#, Blend and XAML. Much nicer waters to swim in than JS, without a doubt. But I just don't think I care. I think I'd rather deal with the current state of HTML/JS/CSS and end up with an app that potentially could be used on any device (within reason), can be hosted in Apache running on Linux, and can be a far lighter experience for the end user to boot.