BTW, in this post, I use a few key words:
CLI: the common language infrastructure (including the virtual machine technology, the IL assembly technology etc), for which the .NET suite of libraries was originally developed. When a C# or VB.NET or F# or J# compiles something, it creates binaries for the CLI.
.NET: A suite of libraries developed for the CLI, that only exists for the Windows platform
Mono: An open-source clone of the .NET libraries supported by Novell
Lunatic said:
While on the topic of Mono...
I've heard some positive things about C#, but are there any particular advantages for someone who generally doesn't program for Windows?
1. Portability (duh). You can write an application for Linux and it will run on Windows, Mac, Solaris, BeOS (more or less) *without recompilation*. In other words: you can deploy one zip file and it will work everywhere.
2. Libraries. The standard CLI platform (based on the .NET core libraries) is pretty extensive. You won't have to deal with e.g. STL and Boost dependencies when you program; you'll have a standardized set of libraries that just work. And any libraries that you reference (stored in .dlls for compatibility, even on Linux) will be cross-platform too, so you can include them in your distribution and won't have to compile them for every platform you target.
3. Security. There's no risk of creating memleaks or segfaults, and you can manage CLI memory in so-called "AppDomains" and can use other such facilities that give you a fine-grained control over how your application works and what can access what.
Compared to Java (and the JVM in general), the CLI is:
1. Faster, since it allows for structs (aka non-referenced classes, that are stored on the call stack) and type parameters (similar to C++ templates) using non-wrapped primitives. This doesn't sound like that much of a deal, but it really is; in Java, you have to "malloc" everything that isn't a boolean, int, float etc, while when using the CLI, you can avoid that, and in Java, you can't say "LinkedList<int>" because "int" is a primitive type (you have to use the wrapper class Integer like so: "LinkedList<Integer>").
2. Easier to develop for, since the CLI has a better dependency architecture, and because you can access native libraries directly, which you can't do in Java (you have to create intermediary helper libraries for that)
3. Not as widely supported, since the JVM is much more portable than the CLI ever was designed to be.
Lunatic said:
I understand that there are some shortcomings in Mono's garbage collection, but I'm not too concerned with stability. I've also heard concerns about patents on .NET technologies. Mainly I'm concerned about learning a platform that will end up being restrictive in the long-term. Please correct me if I'm misinformed.
Garbage collection: I don't know that much about its faults to be honest, but any issues can surely be solved.
Patents: The CLI is an accepted standard NOT owned by Microsoft in any shape or form. The only patent issue that might be problematic concerning Mono is the "System.Windows.Forms" API (and some other APIs only interesting to webapp developers), which is from the .NET library for accessing Windows widgets from managed code. Mono has created a library which is compatible with the original Windows.Forms library (in order to make porting .NET apps to Mono easier), and that library has some potential patent issues. There is therefore a "free" version of Mono (similar to the "free" version of the Linux Kernel; the vanilla Kernel does also have proprietary firmware binaries in it as you might know), from which all potentially dangerous elements have been removed. But even if Microsoft starts to complain, nothing will happen, since there's too many who are using that API already, and Microsoft will be powerless in such situations.
And if you want to avoid patent issues all together, just use the GTK# libraries, which are (you guessed it) the libraries you need to access GTK from the CLI. That'll be your choice anyways, unless you want Windows-looking widgets in Linux, of course...