Html5 & Silverlight– an opinionated post–‘what if’
Yes, it wouldn’t be in my character to hold off on yet another opinionated post! ![]()
Let me reference Davy Brion’s post on ‘why were going with html5 instead of silverlight’. To break this down, what I see and continue to see is are the pros – the development environment, use of a single language (although minor I do see two here, we have XAML and C# – in same manner as Html + Javascript). And yet the usability is down, it’s not as accessible, it’s a plug-in, etc…
And while I’m on this topic, I’d venture to say I believe the same solution I’m going to propose would be good for Adobe’s Flash/Flex applications as well.
I think the biggest concern I have isn’t whether ‘Linux’ can run Silverlight (we have Moonlight), it’s more along the lines of ‘any device anywhere’. Let’s take the iPad or Xoom – these new devices, that I predict will continue to infiltrate businesses as they have consumers – will lead us to requests such as ‘why can’t I view this Silverlight webpart in my internal Sharepoint site that was done in Silverlight’.
There have been two tools that I know of, that in my opinion solve a big chunk of the plugin issue: Google Web Toolkit (GWT) – and Script#. Now, Script# was supposedly used on Microsoft’s Office on the web, but it’s currently done by one person and it’s not really supported, and it’s usage has some issues imo because of this. So, for now I’ll just look at the model Google has provided with GWT.
GWT provides a common environment – a plugin in Eclipse – where you write java code. There is an API to handle common dom tasks. Similar to Silverlight, you typically would have asynchronous calls back to the server code through the GWT API. Any client side behaviors are output as javascript – in a best practice format. The javascript is compressed. The output uses compression and is minified. In addition it created compiled javascript through Google javascript’s compiler. That all said, I know there are issues with GWT, and my concern would be the flexibility of it, but I consider it the best conceptual solution to creating html/javascript using a single language.
So – that is my scenario – we have Silverlight that is producing a plugin that can’t run anywhere. It can’t run on iPhone, iPad, Xoom, it can’t run on different systems. It’s a ‘foreign entity’ in that it doesn’t comply with html standards and usability – that all said – the development environment of Silverlight is great – top of the line really – as your writing C# code and using a very flexible XAML.
My solution would be for Microsoft to shift how Silverlight is outputted. I think the environment is good – the Blend, Silverlight, etc… dev experience is good. My proposal would be to provide an option that the underlying Silverlight code OUTPUT generates compliant HTML5 source, compiled, compressed and minified javascript and CSS3. So you would select your output – ‘XAP’, ‘HTML5’, ‘Mobile HTML5’, etc… and then thethe tooling would handle conversion of the events, elements, etc… in the XAML/code behind ie. A XAML ‘storyboard/animation’ would be equated to a series of javascript animations – ie. jQuery animations. XAML controls would output the corresponding html5 controls. Binding would implement the html4 data binding, etc… I know this is no small task – but the benefit is huge. Move forward a few steps, and we would have targeting capability – ‘create a HTML5 mobile equivalent’ for example.
I think Script# was starting to take this path, it has the core fundamentals. But just not the support it needed. I’m not sure why Nikhil didn’t open source is at the very least. Perhaps because Microsoft will eventually take it and use it – not sure. It did provide what I would considering a R&D into the capabilities of taking C# to Javascript.
I want to say I’m not someone that thinks we need to hide away javascript. I’m not necessarily looking at it that way. I’m looking at the developers who are attached to and have been sold on all the benefits of Silverlight. I’ve worked with Silverlight as well. I like the client side architecture of it. I liked working with XAML, etc… and see a ton of flexibility there. Not that this is a big deal, but I see it as a ‘gateway’ for WPF developers to also be able to use those same skills to write to something that outputs html5.
It’s ironic, and I’m going to take note of this – the webforms model was an attempt to abstract away the web. And it’s abstraction in many ways became a hinderance. Doing simple formating requires knowing all these custom controls – how to bind and postback on a GridView for instance. And what I’m proposing is even more of an abstraction.
I truthfully would rather just see better tooling from Microsoft on HTML5/CSS and javascript – and to stop treating javascript like the redheaded stepchild.
That all said, I see potential in Microsoft leveraging the development model of Silverlight to produce what Google has accomplished with the GWT. So I would take that toolset and provide those capabilities. Seemlessly to the point of being able to do things such as ‘creating a silverlight webpart that produces compliant html5’, etc…
I see value in several different directions for Silverlight – the embedded – with wp7, etc…, the out of browser ‘app’ model – where I think it makes the most sense for a future Microsoft AppStore – because these apps are well sandboxed, and then this final option of an HTML5/CSS3/Javascript output.
What do you think?