Gareth Lennox

On Mono

So, I’ve been playing around with Mono on a virtual machine for a while now, and want to just put down some thoughts. Note that this won’t be an in-depth review of Mono, but just my initial experiences coming from a MS .net background.

(for those of you that don’t know, Mono is an open-source implementation of the .net CLR. Go here for more details. It is actually quite a bit more than that, but coming from using .net, that is the part the interests me – at least at the moment.)

Firstly, one of the interesting things about Mono, is that you can take an assembly compiled using Microsoft’s tools, and run it under Mono, without any changes. Obviously, if you’re talking to the windows registry or using MS specific p-invoke calls, it wont work, but if your code is 100% managed, the chance that it will just work is pretty high.

Tooling

In terms of actually developing directly on Linux and using the Mono tools (rather than the Microsoft ones), there is an IDE called MonoDevelop that comes very close to the functionality of Visual Studio – in places its better (it can even open and save Visual Studio solutions and projects).

All the other usual command line tools are there, most importantly, there is a MSBuild clone called x-build, which lets you use your existing build scripts.

And something that is important for me, NUnit runs fine on mono.

For porting existing projects to Mono, there is a tool, called MoMA, which scans your source code, flagging any areas it identifies as being a potential problem.

Benefits

The most obvious one is that of licensing. Since Mono is open-source, and runs on an open-source operating system, there are zero licensing costs. This is attractive if you’re wanting to have multiple servers running your application. Windows licenses for 20 servers is a non-trivial cost.

Mono is also cross-platform. It runs in environments and on devices where you won’t find the Microsoft .net framework. Taken from the mono site:

Mono is built to be cross platform. Mono runs on Linux, Microsoft Windows, Mac OS X, BSD, and Sun Solaris, Nintendo Wii, Sony PlayStation 3, Apple iPhone. It also runs on x86, x86-64, IA64, PowerPC, SPARC (32), ARM, Alpha, s390, s390x (32 and 64 bits) and more. Developing your application with Mono allows you to run on nearly any computer in existence.

Distribution

I’m not sure about older versions, but the latest version of Ubuntu has Mono installed already. A couple of the pre-installed applications are written in C#.

To be honest, I’ve only used Mono under Ubuntu, so cannot comment on its availability in other distributions, but the Mono website recommends openSUSE.

Conclusion

So, in conclusion, I’m very impressed, well done guys. I’ve not yet had time to take one of our larger projects and get it running on Mono, but that’s the next step.

This is more a note to myself, but below is a list of things I want to investigate further around Mono:

  • Ease of porting a largish existing application to Mono
  • Do common frameworks run on Mono? (things like ASP.NET MVC, NHibernate, Castle Windsor etc)
  • Windows Forms support (this was spotty when I looked at it a couple of years ago – its meant to be better)
  • Performance vs the Microsoft stack

Comments are closed.