It's not monkey business

 Software is all about illusion. Yes, I mean it! Just get rid of the methods, the best practices, the documents, strip everything away and try to focus on the essential.

 Software is all about illusion. Yes, I mean it! Just get rid of the methods, the best practices, the documents, strip everything away and try to focus on the essential.

Don't you remember the feeling? The sensation you get when you finish this piece of code and for a few seconds you feel you're on the top. Mr. Glass makes a much better definition talking about fun, the fun about software development. Yes, forget the business for one second and just remember why you got involved on this first. Most likely at the beginning that good feeling was much easier to achieve, wasn't it? Ok, if you don't get the point you're probably not a programmer, so I bet you've a thousand better things to do than reading this coder's post.

Still here? Then let's talk about a great announcement I read only 4 days ago: Mono 2.0 is out!

(Tune to some monkey music for your reading pleasure! :-P)

Yes, Mono (you're still wondering why I started talking about illusion, right? Be patient), the .NET platform for every non-windows OS out there!

The Mono team has released their better version so far, including a number of huge improvements such us .NET 2.0 compatibility (yes, generics and everything), the initial Moonlight (Silverlight for Linux) and many more.

But the best is yet to come: they already have LINQ and lambda expressions (.NET 3.5) almost there, ParallelFX (the multi-core .NET library) and totally new stuff.

When people talk about Mono, they normally focus on its compatibility with the .NET platform and how good it is for a number of companies tied to the Microsoft stack. But let me look at it from a different perspective.

I started the post talking about illusion, and that's all about Mono. Yes, writing C# code gives you more "good moments" than most of its language counterparts. Strange point of view? Yes, I admit it, but it was so true for me. I grew up as a Pascal programmer who switched to C and later to C++. I've developed Delphi code for a while and turned to Java around 2001. For a long time I was a Windows-only developer but my move to Java came together with the Solaris (7 or 8 if I remember correctly) OS. I enjoyed so much learning about the Solaris internals  (there's a new and improved edition also available, in case you're interested) , that I become a Unix fan. Now, the problem, is I don't feel at home anywhere since I always miss something from Linux or Solaris or the latest Windows box :-(

C++ is still my favorite language but, admittedly, it is more Platonic than it's real. And only after all that I entered C# and .NET. The first thing I ever wrote in C# was the Plastic SCM server loader, which is a piece of code which loads some components from different assemblies, driven by a XML load script, and links these components together at run time pluging the ones implementing the same interfaces in a chain. Basically they're layered components: some implement the core, some security, some transactions, some triggers...

Loading them dynamically at runtime, linking them in a chain to separate different concerns, was extremely easy with C#. It just worked! I mean, now I'm used to it (I'm probably weaker), but I drew the design on a piece of paper, started coding, and it compiled and worked immediately.

Come on! It would have never worked in C++ the first time, not even the second. There's always this pointer you miss, this tricky issue, whatever, it's not that easy. So, yes, let's face it, C# is more productive! And, coming back to my initial thoughts on illusion and good moments: it helps you having more good moments than any other platform I've used.

Then, the problem is that C# (I never really developed in VB.NET and my past experiences with old good (bad) Visual Basic are not worth telling) is only available in Windows, so any serious multi-platform project is simply out of the scope... No C# on my beloved Solaris or on Linux. But, Miguel de Icaza changed everything when he and his band of monkeys started Mono!! Now the best platform was available everywhere! Great!

And here's my whole point: Mono is not always moving Windows code to Linux. Mono is all about a powerful platform for Unix operating systems. Of course, whenever you say something like that, everyone will ask: "What about Java?" In my case the answer is simple, although more emotional than rational: I've worked on both, and I still prefer C# to Java. If I only had to choose one single feature on .NET/Mono which I consider worth the whole decision, I'd take remoting. I used to develop a lot of DCOM (yes, D-COM, not only COM as it was named at the end, DCOM, the one described at the book of the Eddon's which I loved reading and finally understanding almost one decade ago) and remoting is the best thing I've ever found! I love it. I use it on a daily basis, I think it is great and I haven't found a compelling replacement (ok, there can be alternative implementations of the same concept, but remoting is, simply, great!).

Unfortunately Mono is not (yet) perfect, and there're still a lot of things to improve, including portability, or maybe I should say packaging. They've versions for a number of OSs, but the latest versions are not always available from them, which makes Mono weaker than its Java competitor for a huge number of developers.

And there's a lot to evolve too, but IMHO the right direction is not (as most people tend to think) following every Microsoft move and try to make Mono 100% compliant. Mono has to be a platform on its own. There are unique features to Linux or Solaris, MacOS, HP-UX or S-390 systems where Mono runs. Features that could be used from Mono apps making it the best platform to develop code on our beloved Unix boxes. And, obviously, this support won't come from the implementation of the latest .NET x.x feature.

During the first releases Mono tried to catch up with .NET, and it was worth the effort. But now Mono is mature enough to choose which features are worth implementing in the future, and which ones forget to focus on new unique ones.

And there are already nice examples of unique features, some of them I'm really amazed of. Just to mention a few:

  • The new (you've to download the latest 2.2 code and build it to try it) csharp interactive shell, which opens a number of new possibilities ranging from interactive process diagnostics to implementing server side shells based on Mono code.
  • Assembly runtime code injection. Ok, focus only on the nasty things you can do with it and you're lost, but try to be positive and creative: better plugins, better runtime extensions, process diagnostic for complex systems, and so on.
  • The C# evaluator which converts the whole compiler into a powerful expression runner with applications for application scripting and so on
  • MonoFUSE (after remoting and DCOM, filesystems are my second favorite thing :-P) which allows you to create filesystems directly on Mono. Ok, this one is not an unique feature on its own since you can also do it in a number of other languages but, as I pointed out before... it's easier and funnier with Mono!

Wrapping up

This is my first blog post here, and it was a real pleasure for me to be able to talk a little bit about my favorite OSS project ever: Mono. I know there's still a lot to do, a lot to improve, new steps and new projects to finish, but they're on their way. My core is SCM, version control, agile methods and so on, and that's what I'll be normally covering on this column, but I'll try to save some time to make some Mono based experiments.

I like Mono for server side apps but I can only be excited to think what would happen if, at some point in the future, Linux based GUI apps and their underlying frameworks would be Mono-written. :-)