Monday, May 01, 2006

Java and C# for cross-platform development

Well, I haven't posted in a long, long time, so let me jot down a few quick thoughts to liven up this blog.

In my work, I have to deal with three platforms: Linux (I run Ubuntu Breezy on my office PC), Mac OSX (on my laptop) and Windows XP (my coauthors are all running standard-issue Dell PC's with standard-issue OS's).

Collaborative writing has long been a non-issue: LaTeX is wonderfully cross-platform, and even though one of my past co-authors insisted on using Scientific Word (which produces appalling LaTeX code), I have had no problems making things work smoothly enough.

However, one of my current projects involves running numerical simulations. I am the one doing most of the coding, but I'd like my coauthor to be able to run the simulations, experiment with different parameters, etc. So, it is essential for me to write code in a cross-platform environment. Since execution speed is important, too (although not crucial at this stage), Java and C#/.NET seem to be reasonable alternatives.

I must admit I have a fair bit of bias against Microsoft "solutions". However, I am willing to consider C#, partly because it does have a few nice features that Java still lacks, and partly because it is straightforward for my Windows-based coauthor to install and use the .NET framework. Also, the Mono projects supposedly provides a cross-platform implementation of .NET (there is also another effort, Portable.NET, which also aims at porting the "dotnet" stuff to non-Windows platforms).

However, it turns out that the Mono OSX port is quite a bit behind its Linux counterpart. In particular, Windows Forms is basically non-functional on the Mac, and Gtk# requires installing a bunch of extra stuff from Fink, and requires X11. Now, the Gtk# issues are not too serious per se; however, as an added complication, if I do decide to go the Gtk# route, I would have to ask my coauthor to install the required DLL's and assemblies, whereas Windows Forms is part of the .NET Framework and so works "out of the box".

On the other hand, Java is truly, 100% cross-platform (for my purposes at least). I am not enough of an expert to comment on the finer points of language design, but I must say that I like languages that adopt one particular "metaphor" and stick to it --- it makes things predictable and consistent. In Java, everything is a class, including events and event handlers. There is a certain elegance to it. On the other hand, C# introduces "ad-hoc" constructs (events and delegates) that may save some typing but, at least in this writer's opinion, remain... well, adhockeries. There, I've said it!

Bottom line: for the time being, I'm sticking with Java. But I'm keeping my eyes open.

0 Comments:

Post a Comment

<< Home