Wednesday, May 02, 2007

Silverlight and DLR announcements

The latest buzz in the dev community online is all about Silverlight. From my perspective, there are a number of things to tease apart:

  • Silverlight as a Flash alternative
  • Silverlight as a WPF-lite, with CLR
  • Silverlight as a dynamic language runtime, and the DLR itself (standalone) - one can preview this framework in IronPython

Flash alternative

I know I'm not a typical web user, but my main experiences with Flash have been:

  • Amazingly annoying advertisements

    This is the main reason I disable Flash by default, with FlashBlock in Firefox. If I wasn't able to use Flashblock, I would uninstall Flash instead - I'd rather lose video than suffer distraction.

  • A video solution

    One of Flash's nice advantages is that it keeps the Linux folks onside, as even though it's not open-source, they can still consume.

  • Extremely crummy rich applications

    I have never encountered a Flash application that (a) had good keyboard support and wasn't terminally mouse-dependent or (b) didn't prioritise flashy (ha!) animation over and above actually making use of the richer platform than poor/pure HTML or (c) whose rich vector animations didn't regularly peg a CPU at 100%.

So, hopefully folks will excuse me if I view Flash as effectively a video codec, and that MS will face a somewhat uphill battle trying to supplant it as a preferred codec.

WPF-lite with CLR

There's another thing I find striking about the Silverlight story: how similar it is to Java applets. Things that make Java applets suck are (a) the cold start cost (chuggalug of disk, bloat of memory) and (b) ugly Swing UI controls, and (c) the plain fact of JVM dependency.

Cold starts are always important, and I feel the CLR has a better handle on controlling those costs than most JVMs, and certainly expected browser memory usage is a lot higher these days, regularly climbing above 200MB on my machine for one.

It ought not to be hard for WPF to improve on Java's controls, and there are folks out there already looking to market for this platform.

The dependency is the most troubling issue. Flash has gotten to where it is chiefly (I believe) because of video; MS needs some similar mass-market hook to get adoption, and I'm not sure its video implementation is a differentiator, much less an advantage - mainly because I haven't seen it yet. But really: how much better could it be, that would make a difference?

DLR: Dynamic Language Runtime

As a language guy, this is the most interesting part of the whole enchilada. JavaScript/EcmaScript in the browser is slow, and needs techniques such as JIT compilation, dynamic call optimization based on caching, etc. that DLR makes available in order to be made faster.

The DLR is also an interesting platform play, creating an interoperability platform suited to dynamically typed languages with late-bound types, methods and fields. Most dynamic languages permit things like expando methods, jamming on fields and closures to existing objects and extending them, very rich reflection and metaprogramming, runtime 'eval' support, etc. - but all in quite similar ways. In some respects, DLR is a little like late-bound COM for the .NET generation.

It's interesting that the Java platform never developed this, even though it's the other main target for dynamic languages looking for performance improvements. The open-source movements for e.g. Jython, JRuby etc. never really get together and try to find the commonalities, and implement them in a shared library, and eliminate duplicated effort. It's one of the structural deficiencies of open source - once the code's been implemented in specific layer, it tends not to migrate to a lower layer. It's also an obvious move that it's taken someone like MS to make - I wonder if Sun regrets not doing something like this. Finally, it's notable that Java doesn't have anything like Reflection.Emit, one of the most interesting features of .NET for me ever since it came out, and one that DLR leverages heavily for its performance benefits. Java users have to work a lot harder to get the same effect, dynamically generating .class files.


I think there's a big need for a rethink of JavaScript in the browser, but I'm not sure that Silverlight is the solution. Part of me hopes that it is, but I'm afraid that when people wake up out of their daydreaming, and look at things in the cold light of the dawn, they'll see that Silverlight needs to do so much to prove itself as a simple video platform (or some other hook) and get adoption, over the next (say) 3 years, before it can hope to be considered an application development platform. Proving that it's not just Java Applets Mark II, or limp along as a second-rate competitor like QuickTime, is going to be tough.

On the other hand, the DLR, as a thing in itself, is great stuff. I can see opportunities to add DLR awareness to more traditional statically typed languages and get benefits from both worlds.


Charles Oliver Nutter said...

Actually, since being hired by Sun, I've been working to do exactly what you say isn't being done: bringing the JVM dynamic language implementations together. There's already been a lot of communication and cross-pollination between JRuby and Jython, and also Groovy to a lesser extent. And I'm mediating a dynamic language event at JavaOne with multiple language implementers sitting down with JVM engineers. All parties realize we're trying to solve similar problems.

By my estimation, we're worlds ahead of the CLR in this regard. We have full, working implementations of far more languages on the JVM than exist on CLR. What's more, the implementations we have can actually run the apps people are interested in like Ruby on Rails. So far Microsoft's embrace of alternative languages appears only targeted at expanding the reach of their closed-source proprietary platform.

It would probably be fair to say that dynamic languages have enjoyed considerable success despite Sun's best efforts. But that's the old Sun. Times have changed, and the wheels have been in motion for over a year to finally make the Java platform truly and officially multi-language.

Barry Kelly said...

That's great news, Charles - last thing I ever want to see is a monopoly of platforms on the server, like we've had on the client for too long.

I've subscribed to your blog. Keep us all up to date! :)

Steve Trefethen said...

Indeed, very interesting news from Sun and the first I've heard of it which is perhaps part of the problem. I haven't quite formed an opinion on Silverlight yet though I've been following it closely. WPF is yet another potentially game changing technology from MS and it's unclear, at least to me, if they will be able to transition large numbers of developers quickly. I'd be interested to know how the larger MS community feels with all these (beta) releases pouring out of Redmond.

Hallvard Vassbotn said...

Hi Barry,

Interesting post! We'll be following Silverlight closely - it might be interesting to us as a rich, high-performance web-enabled client.

Good to see you have some time for blogging again <g>!