RIA Development Center
WebDesktopMobile
MICROSOFT RESOURCES:
• PHP Showcase • Visual Studio Showcase • MSDN Spotlight • TechNet Spotlight • Azure Showcase
Getting Started with Silverlight
Community Resources
RIA Development Insights
RIA Development Newsletter
Get regular email alerts when we publish new features!
DevX RIA Development Update

More Newsletters
Privacy Statement

RIA Applications For Python and Ruby Developers—Made Possible With Silverlight 2

If you're a Python or Ruby fan, you may feel you're missing out on all the latest developments in Rich Internet Applications. With support for Python and Ruby in Microsoft® Silverlight™ 2, dynamic language developers now have easy access to the latest RIA technologies. 


For most Microsoft Visual C#® and Visual Basic.NET® programmers, the evolution of dynamic language support by Microsoft has probably progressed well below the radar screen. When I polled a number of my colleagues on this topic, I was met mostly with mere puzzlement and no knowledge of any support for dynamic languages by Microsoft. My research, however, has disclosed that a lot has actually been happening that neither I nor my friends have been aware of.

At the same time, dynamic language programmers, most of whom are likely not Microsoft oriented, may not have noticed that Silverlight 2 now allows them to write client-side web programming code in their favorite language—instead of forcing them to switch to JavaScript. This is a significant new development, something not previously possible in any other context, including Flash. When I pointed this out to a friend of mine who is a PHP developer, he was quite impressed.

A recent article entitled "Developers Shift to Dynamic Programming Languages" by Linda Dailey Paulson offers an explanation for the rise in popularity of dynamic languages. She writes: "Software developers are always looking for ways to boost their effectiveness and productivity and perform complex jobs more quickly and easily, particularly as projects have become increasingly large and complex.... With this in mind, many developers are increasingly using dynamic languages such as JavaScript, Perl, Python, and Ruby." Moreover, in my conversations with dynamic language developers, the rapid development cycle and the ability to see changes immediately without the need to recompile are the most commonly stated reasons for their preference for dynamic languages. This article will focus specifically on dynamic language support in the recently released Silverlight 2. This topic should be of potential interest to three categories of developers:

  1. Python or Ruby developers who would like to be able to use Python or Ruby in the browser.
  2. Classic C# and Visual Basic.NET developers who, based on my informal and non-scientific survey, most likely are not aware of the advantages that they might reap from using one of the dynamic languages in the right circumstances to supplement their normal development.
  3. Developers of any stripe who want to offer scripting capabilities to end users via a web application.

Currently, dynamic language support by Microsoft extends to three languages: Python, Ruby and JavaScript. Of these three Microsoft supported dynamic languages, the most advanced at this point is IronPython. Version 2.0, RC1 was released in October 2008. By contrast, IronRuby is still in Alpha for Release 1.0. (I am advised that for open source languages—which are continuously updated and not officially supported by Microsoft—there is not quite the same degree of significance associated with the terms Alpha and Beta.) The third language is Managed JScript, a Microsoft version of JavaScript.

Let's look briefly at each of Microsoft's three existing dynamic languages in turn, with a little bit more emphasis on IronPython, given that it is currently the most advanced.

IronPython
IronPython is a Microsoft-created version of Python. IronPython 2 is equivalent to Python 2.5 and includes all of its core features. Even though it is written in C#, IronPython supports most of the "standard library", a large collection of modules written in a combination of C and Python providing many pre-built tools to boost developer productivity.

One of the key advantages of IronPython over other versions of Python such as CPython or Jython is that IronPython is capable of using almost all of the classes in the .NET Framework. As most .NET programmers know, the .NET Framework contains thousands of classes designed to facilitate almost any programming task. The availability of both the standard library and the .NET Framework represents a major incentive for switching to IronPython from other flavors of the Python language when developing for the Microsoft Windows® platform.

The output of the IronPython engine can be set to be a compiled dll which is capable of running via the .NET Common Language Runtime (CLR). Now that Silverlight 2 has been released, the CLR is present not only on that portion of Windows computers which have the full .NET Framework installed, but also on any computer running the Silverlight 2 browser plug-in. Silverlight 2 works in Microsoft Internet Explorer® and Firefox on Windows, Firefox and Safari on Mac (OS X and higher and on the Intel platform only) and Firefox on Linux / Unix via the Moonlight project (when released). This means that applications written in Python can (eventually) run in a browser on all three of the major platforms.

The .NET CLR also provides IronPython applications with memory management, multi-threading capability and security features. Similarly, in Silverlight the CoreCLR provides comparable capabilities to IronPython applications. In both cases another component, the Dynamic Language Runtime (DLR, discussed below) is required. Michael Foord, author of IronPython in Action, asserts that IronPython running in Silverlight is a couple orders of magnitude faster than traditional JavaScript.

IronRuby
IronRuby, also written in C#, is the Microsoft implementation of the Ruby dynamic programming language. IronRuby was announced at MIX07 and although at about a year and a half in development is just now approaching its first full release.

Ruby also has a standard library. Work is currently underway to provide support in IronRuby for most of the standard library. Microsoft is also working on support for the Rails framework. And, unlike non-Microsoft implementations of Ruby, IronRuby can directly access almost all of the classes contained in the .NET Framework, thereby greatly expanding the number of pre-built tools available for any programming task.

As with all of the Microsoft dynamic languages, IronRuby runs on the DLR which makes it interoperable with each of the other Microsoft dynamic languages and with Silverlight.

  Next Page: Managed JScript/ Microsoft Dynamic Languages
Page 1: IronPython and IronRubyPage 2: Managed JScript/ Microsoft Dynamic Languages
Rate This Content:
Low     High
4 after 2 ratings