Sunday, December 5, 2010

Silverlight 5!

With great fanfare yesterday, a PR/Developer event called Silverlight Firestarter was unleashed upon the world.

Silverlight 5!

Silverlight 5 was announced, and is very good news for those that want to develop enhanced media experiences.  It's also good news for those developing line of business applications.  Boasting over 40 new features. John Papa has detailed many of them on his blog.  I'll touch on just a few of them here...  So grab a soda, ease into your comfortable chair, and lets have a look, shall we?

Media Experiences
So.. let's get the "media experiences" out of the way:

  • Hardware Decode and presentation of H.264 improve performance for lower-power devices to render high-definition video using GPU support.
  • TrickPlay allows video to be played at different speeds and supports fast-forward and rewind. At up to twice the speed, audio pitch correction allows users to watch videos while preserving a normal audio pitch.
  • Improved power awareness prevents the screen saver from being shown while watching video and allows the computer to sleep when video is not active.
  • Remote-control support allows users to control media playback.
  • Digital rights management advancements allow seamless switching between DRM media sources.

In short, it's the obligatory "this is what Netflix wanted us to put in or risk a move to Flash" portion of the release.  I know that might sound a little harsh, as I'm sure there are other media rich sites out there that are using the playback capabilities of Silverlight.  Outside of Microsoft dog-fooding and Netflix, I can't think of any others off the top of my head.  A bit of a shame though, as these are some pretty powerful video features.  Just a very hard sell against similar components of the cross-platform focussed Flash players.

Personally, I'd like to see someone make a pretty HD cloud-based Dragon's Lair clone that will work on a Netbook without draining your battery after one play-through.  Are you listening Digital Leisure? I think Azure is the one platform you don't have a version of Dragon's Lair for yet. What are you waiting for?

Improved Text Presentation...

  • Multicolumn text and linked text container allow text to flow around other elements.
  • Tracking/leading set precisely how far apart each character is for full creative control.
  • Text clarity is improved with Pixel Snapping.
  • Text layout performance is significantly improved.
  • OpenType support has been enhanced.
  • Support for Postscript vector printing.
So what does this feature set mean?  Maybe PDF support (Or PDF enabling technology. That last bullet point provides a means for doing a sort of WYSIWYG ability)?  Or perhaps it's a precursor to a Silverlight version of the SQL Server Reporting Services report viewer component (which would be no less than awesome).   Or maybe it's a way to allow Silverlight as a deployment platform option for e-book reader developers.  And especially if these features find their way to Windows Phone 7, it would be an easy sell to encourage Barnes and Noble to target Silverlight as their deployment platform for Windows, Mac and WP7 for their Nook e-reader.

Business Applications...

  • Model View ViewModel (popularly known as MVVM) pattern improvements.

Personally, I've had a bit of a love-hate relationship with the MVVM pattern in the XAML/WPF world.  Specifically, I've not been a fan of the lack of type-safe compile time warnings when utilizing it.  The XAML approach to MVVM still relies heavily on "reflective" behavior, which means a typo in my field binding is going to more than likely yield a "successful failure".  (i.e. a non-crashing bug that just renders ugly/incorrect  results).  Unless you're a stickler for detail, and an avid tester, you're not always going to catch all of those bugs, especially if changes to a ViewModel are not carefully propagated to it's dependencies.

Well it appears that this is a pain point was a noticeable one at Microsoft.  Silverlight 5 now allows setting break points in the XAML data-binding structures to at least see why binding failures are occurring.  It's not a perfect solution, but it's a good compromise without neutering the power given to the reflective way that MVVM operates on today.
  • Support for 64-bit operating systems.
Why is 64-bit important?  Some other bloggers have their opinions as to why.  I believe the key reason for this is related to the final bullet point in the aforementioned link.  "Ability for Silverlight to work together with other 64-bit applications together"

Specifically, the primary motivation for this is the continued Active-X-like features (I have blogged about this direction previously).  Native/unmanaged code interoperability is a tricky thing in mixed environments.  When you are running an x64 version of Windows Vista or 7, you're essentially running two operating systems at the same time.  A 64-bit one, and a 32-bit one.  These two worlds are normally invisible to the end-user for homogeneous applications living on one-side or the other (such as running 32-bit Word alongside 64-bit Internet explorer -- which is a good thing).  And the ability to do this is a fundamental reason why AMD won the 64-bit processor war over the Itanium chipset from Intel (which more or less killed 32-bit compatibility at the binary level)

But when developers have to mix components from both worlds into a single application, things get a little trickier.  Especially if you're a 32-bit application trying to get 64-bit components to execute.  As most Windows installations today are leaning toward x64 installs, having a 64-bit version of Silverlight leaves fewer opportunities for things to go wrong when the COM interoperability aspects are utilized.

And speaking of COM interoperability, it looks like the out-of-browser context gained the ability to P/Invoke unmanaged code.  This means code can be accessed now that doesn't have a COM binding.  This presents opportunity for the creation of Silverlight wrappers for certain binaries.  For instance, future versions of DirectX could theoretically ship with Silverlight SDKs to get to XBox Controllers or Kinect or whatever if you wanted to provide that functionality to Windows specific applications.

It also looks like a mash-up class of applications that sit half way between out of browser and in browser (in terms of security and application permissions) has been put into play here as well.

3D Support! 
Quite possibly the most exciting feature about this release of Silverlight is it's introduction of 3D graphics support.

If you watch Scott Guthrie's keynote (around the 51:00 mark), there's a very impressive "medical" demo detailing a very scary-accurate 3D model of Scott Guthrie himself.  

There was an interesting "layering" feature demonstrated that allowed the presenter to control the opacity of various groups of polygons on Virtual Gu.  The effect was enough to make a TSA body scanning agent envious.

Neat stuff on the surface and it's easy to get excited about features like this.  However, given that Silverlight today now touches 3 specific platforms (not counting Symbian, which is WAY behind), what do the APIs look like between Windows, Mac and Windows Phone 7?

It's probably safe to say that the Windows and Mac APIs look alike.  But Windows Phone 7 already has a 3D API in it's Silverlight interoperability with the XNA framework.

WPF (which seems to be getting phased out more and more as Silverlight gains better display features), has it's version of a 3D API in WPF-3D.  It seems natural that the new 3D capabilities would look similar to either XNA or WPF-3D.

From a portability standpoint, it would be best if it were a convergence of XNA and Silverlight.  This would allow applications (in a slight twist of fate) to port from Windows Phone 7 back to the desktop version of Silverlight.  This would allow developers a path for 3D games to the Mac without splitting their efforts too much.  And as Apple now has an app store, this could be a way of monetizing Silverlight on the Mac platform (provided Apple doesn't have certain regulations in place similar to their iOS line that prevent it).  It would also present opportunities for Silverlight applications to communicate with XBox Live.  How cool would it be to get achievements on a game you're playing on your XBox, Windows Phone, Windows AND Mac? 

I tweeted a question related to this to Pete Brown, Microsoft community program manager for Silverlight, and author of the excellent book "Silverlight In Action":

To which he replied:

Now to be fair, Silverlight 5 is in it's early stages (or at least early enough to not give us a preview binary).  And Pete's answer seems speculative more than definitive, so what he's said here may not be correct or subject to change.  But I think it's a missed opportunity if the API set for 3D is inconsistent across the 3 Silverlight platforms that matter most.  Given the disappointing lack of interest  Microsoft has shown recently to attempt to get Silverlight on more platforms, an effort toward the "code once, run all" originally promised by the framework would be greatly appreciated for the few platforms they DO support.

Silverlight 5 seems to be on track to be a minor leap in some areas and major exciting (and maybe disruptive)  leaps in others.  What was shown was impressive, but (as I mentioned here and others have mentioned here and here), Silverlight's biggest sought after feature by developers continues to be the one they seem the least interested in pursuing: