9 min read

Miguel de Icaza And Mono: Platform-Agnostic Programming Power

Few names in open source are at the level of a household name, but Miguel de Icaza, of Novell's Mono, comes close. Last week I had the good fortune to chat with him for a bit about MonoTools, the new Mono development package for Microsoft Visual Studio -- and about why Mono attracts such bitterness from open source purists.

Few names in open source are at the level of a household name, but Miguel de Icaza, of Novell's Mono, comes close. Last week I had the good fortune to chat with him for a bit about MonoTools, the new Mono development package for Microsoft Visual Studio -- and about why Mono attracts such bitterness from open source purists.

The more I hear about Mono, and the way Miguel talks about it, the more it takes shape as a way to allow .NET programmers to become that much more platform-agnostic. Not just Linux and Windows but now the iPhone, too, and with many other possible platforms in the offing that Microsoft themselves would never make a runtime environment for.

The first thing I wanted to clear up: what Novell's relationship to the Mono project is, specifically. "We [Novell] are the primary sponsor of the project," Miguel explained. "A lot of companies do contribute to Mono, in the direction most important to them. Novell, however, does own the copyright to the Mono VM, which is a key piece of it. Today we license it very liberally, but since we're the copyright holders we also offer it in a proprietary way for certain uses. We're able to commercialize some parts of Mono that are not available to contributors - for instance, we license it to to Unity for Wii / XBOX, for developers writing for the iPhone (there's some 300 apps on the iPhone with Mono), and so on. So that gives us some benefits, but we're also the major contributor."

The idea that .NET is used to power iPhone applications probably raises a few eyebrows. How did you pull that off?

"That was one of the most challenging things we did in a long time. Apple has these restrictions about scripting languages on the iPhone, and they enforce it in both the licensing agreement and at the phone level -- they take measures to keep JIT [just-in-time] compilers from working. .NET and Java both use JIT to work, but we couldn't use JIT on iPhone, and that's the DNA of .NET. So we created a full static compilation system for .NET last year, in partnership with Unity (back in October of 2008), and that's how many things started to get built with Unity. Zombieville was one such game.

"At the time the static compiler only ran what we referred to as .NET 1.0 -- no generics. But Unity wasn't in a rush, so they were OK with using just static compilation at the 1.0 level. We continued working on it, and have since added full generics and .NET 3.5 support. This was a large effort that make sure all Mono apps could be compiled to static binaries.

"Game platforms in particular pose a real problem vis-a-vis security. They're not like PCs; they're very homogenous. If you can attack one XBOX, you can attack all of them, so the potential for damage is enormous. The creators of these devices work as hard as they can to minimize the surface area of attack." That, in turn, implies that a platform like Mono also has to be scrutinized carefully.

I mentioned that I was a .NET programmer myself, albeit only a fledgling one, getting my feet wet in both .NET for the web and the desktop. But I'd also been getting what experience I could with the more conventional web languages -- PHP, Perl, MySQL -- and wanted to branch out in both directions at once.

"There are a lot of programmers in your situation," Miguel said. "They're comfortable with Windows and Visual Studio, but they'd like to use Linux or develop on Linux. We're talking to one of our customers, and they're migrating from Windows to Linux, and the first thing they had to migrate was the database. So they're building this app that is fully self-contained - it includes Linux and the DB and the software they wrote. One of the questions my engineers asked, about why they migrated to Linux: "Was it price?" The answer: "Yep." They didn't want to pay licensing for SQL Server. I think there's a lot of economic reasons for Linux - including deploying to Amazon EC2 , where Mono hosting is popular. So what we're doing is allowing people to be .NET experts, instead of Linux or Windows experts solely."

Another major span-the-gap issue that Miguel and his team wanted to address: how to develop for the iPhone when you're not a Mac user. Or, how to make things better if you are one already, and you just can't stand Objective-C.

"One of the ways we did this: we added a full API binding to the iPhone API in Mono. Developers can now build native iPhone apps through Mono -- you can't tell them from the real thing. And I think in some cases using Mono's bindings resulted in a nicer, cleaner API than the iPhone itself, so a low of low-level stuff has been abstracted into more comfortable APIs. Now .NET devs can use the iPhone, and iPhone devs themselves can be more productive by using Mono. You get things like garbage collection (which is a pain to deal with in Objective-C) and strong typing (same thing), which means a lot of the problems associated with those issues vanish immediately. And you also get access to XML/ LINQ libraries, and so on."

I asked for some background on MonoTools. For those not in the know, this is their new add-on for Visual Studio that allows a programmer to write for Mono deployments (targeting non-Microsoft environments).

"The basic idea is that it's a plugin for Visual Studio which adds a Mono menu. From there, you can run the software, written for .NET, in Mono. It scans the network for Linux machines and lets you deploy the app from there if you want, or you can specify an EC2 cloud node or a Rackspace host, whatever you like. Once deployed, you can run it there, debug it there, make changes there, and integrate it with other Linux services like MySQL or Python. It makes Linux transparent, like it's any other server you'd deploy to.

"The way I see it, we can't have this divide between the two .NET dev communities, Windows and Linux, each in separate silos. If we can get 90% of the learning curve out of the way for allowing one to develop on the other's platform, and then let them learn on their own the 10% left over that they need to use Linux or Windows, then that's good."

Another clever wrinkle in MonoTools is integration with Novell's remarkable distro-building tool SUSE Studio. "You can now integrate with Studio as well, and tell it things like 'build an appliance with my software', and that can be a desktop app or a server app or anything at all."

I then donned my hip boots for a wade into potentially shaky territory: the ongoing clash between the Mono team and its open source purist detractors. There's a schism, I pointed out, between the idealists and the realists, and it just seems to be getting deeper over time.

"I do think the schism is real. I don't think the animosity comes from our side, but my position has been simple: if you like what we have, use it; if not, don't. I have no problem if my wife eats something I don't; if people don't have a use for what we provide they are not obliged to use it. (I don't use PHP, for instance). In Mexico we have a saying, 'That man got a stomach-ache from something he didn't even eat,' so I think there's an element of that.

"Programmers are people with strong opinions. Some people would like more Python or Java; more power to you. Use what you want! But people like [the anti-Mono advocacy group] Boycott Novell do not write a single line of code, so I think there's advocacy coming from people who do not contribute in any real way. They don't even come to the conferences; they're not part of the community in a substantive fashion.

"I'm open to fixing any issues that Mono has. I don't say that Mono is bug-free. They seem to have a more philosophical issue; that Mono is a Microsoft-derived technology, and anything from Microsoft is the devil. I don't think it's a very intellectually honest debate if you start off on that position. And the problem I have is that once you take an extreme position, there's no room for working to a solution."

Miguel's idea seems to be that rapprochement with entities like Microsoft is a process, and not a one-time, one-size-fits-all-or-nobody approach. "When we did Moonlight with Microsoft, for instance, there was an agreement about patents. People said it wasn't good enough, so we went back to Microsoft and said, 'Look, we need to change this.' Turns out that Microsoft had their hands tied due to the licensing they had with others over the MPEG-LA patents, so we had to license things in a new way to make the FOSS people happier. Microsoft doesn't own MPEG-LA -- they just license them for use in their own products -- so we can't get them in a free fashion. That said, I think we can get that much closer over time.

"If you take the position that anything patented is evil, then we might as well stop writing software for seventeen years, wait for all the patents to expire, and then come back. We have to roll with the punches as they are right now, and keep dialogue open with everyone -- Microsoft, Adobe, everyone - instead of getting into fights. It's like playing jazz; you always improvise."

My parting shot: Given that Mono has been ported for use as an iPhone development platform, I wondered if Mono might also show up on Android in the same way. His answer was a wink and a nod. "We're exploring that, although I can't announce anything."

It would only make sense: why leave out what's shaping up to be one of the most important platforms for the mobile market? Or, for that matter, any platform with a healthy programming community?

InformationWeek has published an in-depth report on smartphone security. Download the report here (registration required).

Twitter: Me | InformationWeek
Facebook: InformationWeek