The case for supporting and using Mono

Novell's open-source .Net clone is alive and well, and it's turning up in surprising, useful places.

You may remember Mono, the open-source implementation of Microsoft's .Net platform spearheaded by Miguel de Icaza of Gnome fame. It's been a controversial project since its inception. Detractors among the open-source community have variously described it as a trap, a kludge, or simply a waste of effort.

Then again, even .Net itself has been controversial among certain factions of developers, who see it as yet another attempt by Microsoft to "embrace and extend" the work of others. The CLR (Common Language Runtime) does nothing that Java hasn't done for years, they say, and the C# language syntax is essentially just Java with a few wrinkles ironed out.

So what's wrong with ironing out wrinkles

In 2006, I predicted that when Java was released under an open-source license, Mono would collapse under the weight of its associations with Microsoft and essentially just blow away.

I was wrong. Mono is still very much alive and well, and far from being "just" a clone of .Net for Linux -- as if that in itself were easy -- it has been gradually expanding its presence into exciting and unexpected new niches.

The De Icaza heresy: Mono's central affront
Miguel de Icaza is himself something of a controversial figure these days. He's a heavyweight among open-source developers, yet he works for Novell, the company that soured the Linux community by signing a patent-licensing agreement with Microsoft. Worst of all, he seems to have all but dedicated himself to projects related to Mono -- in other words, to copying Microsoft technologies.

To some in the open-source community, that makes de Icaza a literal heretic. He's guilty of espousing an almost unutterable belief: that not only is Microsoft an innovative company that continues to produce valuable new technologies, but Linux users would be better off if they could use Microsoft technologies, too.

Why De Icaza, and Mono, deserve a second look
Collaboration, more than competition, is what floats de Icaza's boat. At the end of the day, he just wants everyone to be able to get their work done in the best way possible. For him, that means using open-source software, but he recognizes that Microsoft and Windows are likely to remain permanent fixtures in the computing ecosystem. The Mono Project is his working prototype of a world in which it might actually be possible for us to all just get along.

Case in point: Moonlight, one of the newest additions to the Mono portfolio. When Linux users heard that President Obama's inauguration speech would be simulcast live on the Web, they were outraged to learn that the site would use Microsoft's Silverlight technology. But they didn't need to worry -- Moonlight is an open-source implementation of Silverlight that runs on Mono, and it was mature enough to display the speech. For once, Linux users weren't shut out of media just because it originated on the other side of the fence.

Fun and games with Mono
But Mono isn't just about keeping up with the Ballmers. Over the years it has evolved a number of interesting features that have elevated it above the status of being a mere clone. It's now a unique and valuable tool in its own right.

For starters, unlike Microsoft .Net, Mono is cross-platform. It runs not only on Linux but on other Unix-like operating systems as well -- including Mac OS X. It even runs on Windows. That means software written for Mono can very quickly be ported to a variety of different platforms with few changes to the underlying code, if any.

Recent developments have taken this concept even further. Today, Mono offers full static compilation -- the ability to take C# code written for the .Net platform and output native machine instructions, rather than CLR bytecode. The resulting code needs no just-in-time compiler and no runtime -- it runs on the CPU itself, just like code written in C or C++.

Perhaps the best showcase of what makes this versatility so exciting is Unity, a Danish company that makes tools for game developers. Because the Unity platform uses Mono technology under the hood, developers can code their game once and then target Windows and Mac OS X simultaneously. There's no need to code in C++ for Windows and Objective-C for the Mac -- the same project can be built for either platform from the same C# and JavaScript sources.

But it doesn't stop there. The Unity platform can take advantage of Mono's static compilation to build binaries for iPhone games, too. Because the results are fully native iPhone applications, Unity gets around Apple's notorious prohibition against bytecode-based virtual machines on the platform. A similar method allows developers to use Unity to build games for the Nintendo Wii console.

Should you fear Mono geeks bearing gifts?
Doubtless there are some who will still argue that developing open-source software based on Microsoft technologies is like walking into a lion's den. Microsoft might pretend to be ignoring Mono now -- and in fact, it even actively collaborates with the Mono Project team from time to time, as in the case of the Obama inauguration speech -- but sooner or later it will pounce, using patent claims or some other dirty tricks to bring down the whole house of cards.

But the more I hear about the direction that Mono is heading, the more I doubt that will happen. There are enough interesting tools, technologies, and ideas in Mono that it's maturing into a valuable tool for any developer's toolbox, even forsaking compatibility with Windows and .Net.

True, Java is open source now and that has removed whatever apprehensions strict open-source advocates may have had against that platform. But I was wrong when I said that open-source Java would quickly sweep Mono under the rug, and I'm glad I was. Mono isn't trying to replace Java -- or .Net, for that matter. It's trying to do a lot more, and that makes it a project well worth watching.

Copyright © 2009 IDG Communications, Inc.