Choosing C#

In starting Toves, one of the first decisions was: What language to use? Of course, Logisim uses Java. This has served it well, particularly in providing a platform where development can happen on any platform and it easily ports to Linux, MacOS, and Windows computers. Being cross-platform is a central feature of Logisim: Many universities assign Logisim projects as homework, and students want to complete the projects on their own computers, whatever they are.

At the same time, a lot of people have wanted to run Logisim on a tablet device (iOS and Android in today’s world). Unfortunately, there’s no strong solution for executing Java under iOS; and while Java works well for Android, its Swing GUI API does not, and unfortunately Swing is more deeply embedded throughout Logisim than it should be. (With Toves, I’ve been careful to add a layer so that the core program doesn’t refer to the GUI.)

Beyond tablet compatibility, Java also has some political problems – to me, these are secondary to tablet considerations, but they still can’t be ignored. One problem is the open-source angle: Oracle doesn’t seem committed to a genuinely open system (witness the Google lawsuit). More practically, Java suffers from a bad reputation on the security front. As far as I can tell, this reputation is unfair. Sure, the browser plug-in for running applets has shown persistent problems, but Logisim isn’t an applet. Though the message people should get is “Java is OK, but disable the Java browser plug-in” (as I certainly recommend, since it’s not too useful anyway), but what they hear is “uninstall Java.” That’s unfortunate, since Java is quite useful for applications like Logisim, and I believe Java has a good security record for such applications. Nonetheless, it’s reality that Java’s reputation suffers.

What about a browser-based implementation using JavaScript? Actually, I looked at this fairly carefully. Performance would take a hit, but the no-installation benefits were too great to ignore. Last summer (Summer 2013), I used JavaScript to develop a bare-bones browser-based logic simulator (Electra’s Workshop, – which does roughly everything that Toves currently does. Despite quite a bit of effort, it still doesn’t work as well as I’d like, which is why I haven’t publicized the effort much. In any case, I don’t think browsers are ready for a Logisim-scale program.

Ultimately, I chose C#, since it still allows development that works across Linux/MacOS/Windows, and it should also port to iOS and Android (though I haven’t really toyed with this enough to be sure). I had some reservations, largely because I would have to learn the language from scratch, though admittedly C# is very similar to Java.
So far, I’ve been happy with C#. My biggest surprise is that, despite being so similar to Java, C# is just different enough to require a substantial adjustment. I still haven’t adjusted entirely, and overall I still prefer Java, but I’m finding C# a very workable alternative. I’ll probably write more later about my critiques of C#.

My biggest recent frustration has been in packaging Toves for cross-platform distribution. This wasn’t particularly easy with Java, but over the years I had basically figured out a workable solution. I’m confident I’ll be able to figure it out for C# as well. For right now, I have some fairly ugly instructions written up for each platform at Linux and MacOS are OK – though not as easy as I’d like – but installing and executing Toves on Windows is a major pain. You might think: C# was originally designed for Windows, so shouldn’t it be easy? But Toves depends on Mono being installed, and I haven’t yet found a way for Toves to automatically find Mono upon startup. I’ll be looking for a better technique.