Back in 2008, why was .NET for Windows, and in particular C#.NET, chosen as the software platform for Gekko?

That’s a good question. It was not completely by hazard, and using something more cross-platform was thoroughly considered. But first the good points about C#.NET:

  • I got to know .NET and Visual Studio from my former job at the Danish Energy Agency. Here, I used ASP.NET, and VB was the language used. Later on, I started working at the DREAM model, using C#.NET quite a lot. So choosing .NET made sense, and choosing C# over VB was trivial. After all, VB stands for Visual BASIC, where the ‘B’ in BASIC stands for ‘Beginners’. This is a correct description: BASIC as a language is horribly outdated. It was actually my first computer language, when I was a kid in the 1980s….
  • Also, C# was extremely similar to Java, which I had a lot of experience with (since then, the two languages have departed somewhat more).
  • C#.NET has modern stuff like garbage-collection, object orientation etc., together with extensive libraries and a large user base. Gekko was targeting the Windows platform, so using .NET was the obvious choice. And the user interface could be made in C#.NET right out of the box, for instance using the good-looking WPF.
  • Speed was a concern, though. Obviously, languages like Fortran or C are often faster, but note the ‘often’. With the just-in-time compiler provided by C#, bottlenecks in the code get special attention, and sometimes C# may be even faster than Fortran or C, or at least comparable. Mostly, there is some speed loss, because C# is a safer language, checking for instance for stack overflows etc., and not allowing pointers to run wild. So C# is a little less fast than Fortran and C, but the architectural benefits of using garbage-collection, object orientation, etc. are simply enormous.

But C#.NET is not cross-platform. So why didn’t I use Java? I considered it seriously, but the user interface was an issue. I had previously made a whole program for solving Go problems in Java, using Swing for the user interface. The experience was horrible. There were so many little things in the interface that simply did not look right. For instance in Windows, the Swing fonts, dropdowns, scroll buttons, etc. looked just somehow odd, as if the software was not really Windows. Add to that the sluggish responsiveness of the Swing graphical interface, and the conclusion was: use something natively Windows for Gekko, since Gekko targeted the Windows platform in the first place. Swing didn’t look too good on Mac or Linux, either.

Am I completely happy about that choice? More or less, yes. I really like C#, and Visual Studio is great. And in the meantime, Microsoft has open-sourced .NET, and projects like Mono and Xamarin are moving .NET in a cross-platform direction. Still, there is no easy way to run .NET with a graphical user interface (using WPF) on Mac or Linux, and maintaining Gekko for three platforms would just be too much work at the moment.

A kind of crazy thought would be to have the Gekko user interface run in a browser using HTML5. Then, the basic components could run on Mac/Linux using Mono/Xamarin, whereas the graphical interface could be shown in a browser (on all platforms). This would probably mean that I would have to code a bit in JavaScript (ouch), and I would have to deal with all the browser quirks. It is an interesting thought, though, but instead of one nice user interface on Windows, we might end up with three ugly user interfaces on Windows/Mac/Linux.

Fortunately, Parallels and Wmware come to the rescue, allowing Gekko to run on Mac or Linux, even in its own window together with other (native) Mac/Linux windows. Perhaps Parallels/Wmware will become better and cheaper over time, to the point where a port of Gekko to Mac or Linux is not so critical anymore?