Open Source with Java or C#

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
OliverUwira
Posts: 170
Joined: Mon Sep 13, 2010 9:57 am
Location: Frankfurt am Main

Open Source with Java or C#

Post by OliverUwira »

With regard the kind of issues discussed in http://www.talkchess.com/forum/viewtopic.php?t=36522, I have a related question.

I was planning on developing a GUI during the next year, and I definitely want it to be usable on other operating systems than Windows as well. So I thought my choice would be to do it in either Java, or in C# which should be portable with the help of Mono.

I want it to be open source as well and this is where I'm having bad feelings towards both languages. Now, I know MS promised they would not sabotage Mono through software patent waving, but I've read this promise does not cover Windows.Forms. Also nobody knows what Oracle is going to do with Java.

So would it be wise to use those languages? The pain is I don't really see another alternative. Ok, using Qt could do it, but it's not exactly GPL, is it? Besides I detest C++ :(
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Open Source with Java or C#

Post by ilari »

OliverUwira wrote:With regard the kind of issues discussed in http://www.talkchess.com/forum/viewtopic.php?t=36522, I have a related question.

I was planning on developing a GUI during the next year, and I definitely want it to be usable on other operating systems than Windows as well. So I thought my choice would be to do it in either Java, or in C# which should be portable with the help of Mono.

I want it to be open source as well and this is where I'm having bad feelings towards both languages. Now, I know MS promised they would not sabotage Mono through software patent waving, but I've read this promise does not cover Windows.Forms. Also nobody knows what Oracle is going to do with Java.
I think every distro and most developers in the Linux world are moving away from Mono, so I wouldn't choose that.
Ok, using Qt could do it, but it's not exactly GPL, is it? Besides I detest C++ :(
Good news, Qt is licensed under LGPL now, so you can do pretty much anything you want with it. And you don't have to use C++, Qt has bindings for many languages: http://en.wikipedia.org/wiki/Qt_%28fram ... 9#Bindings
alpha123
Posts: 660
Joined: Sat Dec 05, 2009 5:13 am
Location: Colorado, USA

Re: Open Source with Java or C#

Post by alpha123 »

OliverUwira wrote:With regard the kind of issues discussed in http://www.talkchess.com/forum/viewtopic.php?t=36522, I have a related question.

I was planning on developing a GUI during the next year, and I definitely want it to be usable on other operating systems than Windows as well. So I thought my choice would be to do it in either Java, or in C# which should be portable with the help of Mono.

I want it to be open source as well and this is where I'm having bad feelings towards both languages. Now, I know MS promised they would not sabotage Mono through software patent waving, but I've read this promise does not cover Windows.Forms. Also nobody knows what Oracle is going to do with Java.

So would it be wise to use those languages? The pain is I don't really see another alternative. Ok, using Qt could do it, but it's not exactly GPL, is it? Besides I detest C++ :(
I wouldn't recommend C#, Mono is not recommended by the FSF and Microsoft could sue you anytime for using it....

Java now being controlled by Oracle is.... interesting to say the least, but I'd still recommend it. I'd also recommend you check out Scala, which is an awesome language that runs on the JVM and is a hybrid OO/functional language with type inference.

Peter
jdart
Posts: 4367
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: Open Source with Java or C#

Post by jdart »

The current Oracle/Google dispute about Java does not really affect end users of the language, but primarily is an issue for vendors who are porting or distributing in some way the Java Development Kit. If you're writing a program that runs in the Java environment (vs. writing a Java environment), you aren't really imperiled by it, and your users are not in trouble either (IMO).

--Jon
User avatar
OliverUwira
Posts: 170
Joined: Mon Sep 13, 2010 9:57 am
Location: Frankfurt am Main

Re: Open Source with Java or C#

Post by OliverUwira »

So am I right, that those who answered don't see a problem with using Java?

Choosing the right language for the GUI project is a tricky task. Java might cause trouble in the performance area, as when it comes to running tournaments with fast time controls.

Has anybody ever tried to compile Java into a binary with GCJ?
alpha123
Posts: 660
Joined: Sat Dec 05, 2009 5:13 am
Location: Colorado, USA

Re: Open Source with Java or C#

Post by alpha123 »

OliverUwira wrote:So am I right, that those who answered don't see a problem with using Java?

Choosing the right language for the GUI project is a tricky task. Java might cause trouble in the performance area, as when it comes to running tournaments with fast time controls.

Has anybody ever tried to compile Java into a binary with GCJ?
You almost certainly won't run into Java performance problems.

Java is faster than C#, at least on the HotSpot JVM. Compiling it to a binary would likely only increase start up time, since with JIT compilation the JVM (HotSpot anyway) is nearly as fast as C++ binaries.

Peter
User avatar
OliverUwira
Posts: 170
Joined: Mon Sep 13, 2010 9:57 am
Location: Frankfurt am Main

Re: Open Source with Java or C#

Post by OliverUwira »

ilari wrote: Good news, Qt is licensed under LGPL now, so you can do pretty much anything you want with it. And you don't have to use C++, Qt has bindings for many languages: http://en.wikipedia.org/wiki/Qt_%28fram ... 9#Bindings
I've just made up my mind. I'm going to use Qt and C++.

At least one can't really screw up the memory with QObject as the base class. Besides Qt is cute :D
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Open Source with Java or C#

Post by Don »

OliverUwira wrote:So am I right, that those who answered don't see a problem with using Java?

Choosing the right language for the GUI project is a tricky task. Java might cause trouble in the performance area, as when it comes to running tournaments with fast time controls.

Has anybody ever tried to compile Java into a binary with GCJ?
Yes, and it works great.

If you make a quality GUI for chess it will be a nice alternative to Arena as they do not really seem interesting in any platform other than Windows.

Java causes no performance issues. I designed a command line autotester in Java and I can play 20 or 30 games per second (using a 6 core processor.)

Each game played in a separate Java thread and full game scores produced using SAN notation. We also sometimes play fast fischer time control games such as 3 seconds + 0.05 second increment and it works great. I had an equivalent tester written in tcl and it was a dog in comparison, but tcl is not a high performance language. I would expect any high level language to be slow as it takes time to create PGN files correctly - it is like doing a shallow search and not quickly done in high level languages. In tcl I could only do 2 or 3 games scores per second.

I'm not sure why this is, but Windows seems to be a bit heavier in the sense that I cannot run as many games per second. I think Windows probably has more overhead for starting and killing processes as the tester always starts the program from scratch for each game. But this is not a serious issue for a GUI unless you intend to have time controls faster than game in 1 second.

I have had no problem creating binaries using GCJ either. It works great and is a great way to distribute binaries without requiring a java deployment. I have never tried to create binaries that make use of the graphical and user interface libraries so I cannot speak to that.
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Open Source with Java or C#

Post by Dann Corbit »

How about a web interface?

TCL/TK is another possibility.
That's what SCID uses.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Open Source with Java or C#

Post by Don »

Dann Corbit wrote:How about a web interface?

TCL/TK is another possibility.
That's what SCID uses.
tcl/tk is great and I'm an expert in it. However, the chess package I wrote for it tends to be slow at producing PGN files. I made no effort to produce fast code but perhaps I should have. There is a small but noticeable delay make a PV output in SAN notation in a chess gui I did in tcl/tk. Even though some UI's including Arena do not do that, I think a good one should, anything less just seems cheesy to me.

One thing I value in a User Interface is snappy responsiveness. It's one of the reasons I like xboard.