Page 1 of 2

Java vs. C++, UI-heavy programs

Posted: Mon Apr 16, 2012 2:36 pm
by Moosader
So I know that a lot of people here love using qt for making applications, such as map editors and such, but I'm wondering if there's anyone "for" using Java and Swing to make something like a map editor.

I'm going to have to check the licenses of both, I'm not really sure what kind of restrictions either has going on, but I was thinking that, at least with Java there wouldn't be rebuilding. Java is also higher-level, and while I enjoy making my games with C++, I don't know if I have the patience to work with an application at that low of a level. And perhaps, since the ugly Java UI is basically part of the language, it might be somewhat better suited, or better streamlined, than using C++ with a third-party library.

Arguments to and for either?

Thanks.

Re: Java vs. C++, UI-heavy programs

Posted: Wed Apr 18, 2012 11:18 am
by THe Floating Brain
Well you can have all the advantages Java has in C++ for both toolkit an game development with Google Native Client http://code.google.com/p/nativeclient-sdk/ (no-rebuilding), additionally as I am sure you are aware Java lags, and the language itself in my opinion is badly designed (no non-object pointers and refs, no overloading of methodes, no delegates, only pure interfaces, enums = classes, no multiple inheritance for classes, no delegates, everything has no be in a class, no optional memory management, no opertor overloading, I could go on), some design decisions were even made on purely emotional basis by James Gosling such as not implementing operator overloading (I'm not on my computer so I don't have accesses to the quote at the moment). Additionally Swing kinda "takes over your program" forcing you to design around it while GNC and Qt are non-invasive.

Re: Java vs. C++, UI-heavy programs

Posted: Wed Apr 18, 2012 1:19 pm
by dandymcgee
THe Floating Brain wrote:and the language itself in my opinion is badly designed
no non-object pointers and refs,
no overloading of methodes,
no delegates,
only pure interfaces,
enums = classes,
no multiple inheritance for classes,
no delegates,
everything has no be in a class,
no optional memory management,
no opertor overloading
In summary, even though you have no reasonable basis for your argument you generally despise the language as a whole.

I would consider Java for UI tools and related tasks where performance is not critical but development time and functionality are. As I am already very familiar with C++ though, and prefer Qt's default UI styles and overall stability I would probably start with Qt over Java. I would also probably consider C# before Java assuming portability / web deployment was not a key concern.

Re: Java vs. C++, UI-heavy programs

Posted: Wed Apr 18, 2012 1:32 pm
by THe Floating Brain
dandymcgee wrote:
THe Floating Brain wrote:and the language itself in my opinion is badly designed
no non-object pointers and refs,
no overloading of methodes,
no delegates,
only pure interfaces,
enums = classes,
no multiple inheritance for classes,
no delegates,
everything has no be in a class,
no optional memory management,
no opertor overloading
In summary, even though you have no reasonable basis for your argument you generally despise the language as a whole.

You did not quite get my whole argument. My opinion was only a component if she agrees with it.

I also stated that
THe Floating Brain wrote:Well you can have all the advantages Java has in C++ for both toolkit an game development with Google Native Client http://code.google.com/p/nativeclient-sdk/ (no-rebuilding),
And
THe Floating Brain wrote:additionally as I am sure you are aware Java lags,
then
THe Floating Brain wrote: and the language itself in my opinion is badly designed (no non-object pointers and refs, no overloading of methodes, no delegates, only pure interfaces, enums = classes, no multiple inheritance for classes, no delegates, everything has no be in a class, no optional memory management, no opertor overloading, I could go on), some design decisions were even made on purely emotional basis by James Gosling such as not implementing operator overloading (I'm not on my computer so I don't have accesses to the quote at the moment).
next
THe Floating Brain wrote: Additionally Swing kinda "takes over your program" forcing you to design around it
finally I stated
THe Floating Brain wrote: while GNC and Qt are non-invasive.
.

In summery:
* All the functionality that Java has is available in C++ (the implied preferred language) through GNC.
* Java is laggy.
* If you agree Java is a poorly designed language.
* Swing may not be the best library because it kinda takes over the development process.
* C++ libraries are less invasive than Swing and some can provide all the functionality of
Java and may be over all a better decision.
dandymcgee wrote: I would consider Java for UI tools and related tasks where performance is not critical but development time and functionality are. As I am already very familiar with C++ though, and prefer Qt's default UI styles and overall stability I would probably start with Qt over Java. I would also probably consider C# before Java assuming portability / web deployment was not a key concern.
+1

Re: Java vs. C++, UI-heavy programs

Posted: Wed Apr 18, 2012 4:12 pm
by dandymcgee
I read your post so I'm not sure why you quoted yourself bit by bit, most of which was irrelevant to the part I disagreed with (which I quoted).
In summery:
* All the functionality that Java has is available in C++ (the implied preferred language) through GNC.
* Java is laggy.
* If you agree Java is a poorly designed language.
* Swing may not be the best library because it kinda takes over the development process.
* C++ libraries are less invasive than Swing and some can provide all the functionality of
Java and may be over all a better decision.
"Java is laggy" is pretty vague and completely depends upon your code and intended use of the language. Poorly designed is your opinion, and you are entitled to it.
Aside from that, you make good points.

Re: Java vs. C++, UI-heavy programs

Posted: Wed Apr 18, 2012 4:18 pm
by Moosader
dandymcgee wrote: I would consider Java for UI tools and related tasks where performance is not critical but development time and functionality are. As I am already very familiar with C++ though, and prefer Qt's default UI styles and overall stability I would probably start with Qt over Java. I would also probably consider C# before Java assuming portability / web deployment was not a key concern.
Yeah, this isn't for the game itself, that will be in C++, but for something like an map and text-file editor, it seems like Java would be OK.
Also, it's a 2D map editor, not 3D, so it wouldn't really be anything heavy.


Now, what do you guys mean by "Java takes over the development process"?

Re: Java vs. C++, UI-heavy programs

Posted: Wed Apr 18, 2012 5:17 pm
by k1net1k
HTML5

Re: Java vs. C++, UI-heavy programs

Posted: Wed Apr 18, 2012 7:17 pm
by thejahooli
I would just go for the language I'm more familiar with, for you this sounds like C++. Most of the arguments between the two, such as their design philosophies, are opinions. The arguments which aren't opinions, such as Java's relative ease to development with, would be offset by the difference in language knowledge. All you would need to learn for C++ is how to use Qt, which would probably be at the same level of learning as Swing for Java.
Moosader wrote:I don't know if I have the patience to work with an application at that low of a level
If you were using Qt, then a lot of the low-level programming would be handled for you. The level of programming would probably be similar in both C++ and Java.

Re: Java vs. C++, UI-heavy programs

Posted: Wed Apr 18, 2012 7:50 pm
by THe Floating Brain
Moosader wrote: Now, what do you guys mean by "Java takes over the development process"?
I meant Swing, especially its graphics library. It is very invasive, you will practically have to plan your entire program around it.
I believe many programmers will agree too that, I have not used it in a while so I don't remember to many specifics at the moment besides the graphics library,
and gui library, if I remember correctly pretty much all your rendering code is forced to be in one method; the same goes for any ui event.
dandymcgee wrote: Java is laggy" is pretty vague and completely depends upon your code and intended use of the language. Poorly designed is your opinion, and you are entitled to it.
Aside from that, you make good points.
Thank you :mrgreen: , and yes I know that is my opinion but if others agree it probably holds some validity.
What I meant by "Java is laggy" was to state that since Java machine code is interpreted
by the JVM Java code typically runs slower.

Re: Java vs. C++, UI-heavy programs

Posted: Wed Apr 18, 2012 10:56 pm
by Ginto8
I have used a lot of java over the past year or so (even more than C++), and I cannot honestly recommend it (at least on the desktop; android is a different story). Swing is clunky and annoying, and especially with custom graphics (ie. the kind you'd use swing's Graphics class for instead of its pre-defined widgets), its speed can only be described as mediocre. Now, I have no doubt that it is possible to make a good map editor using Java and Swing, but I have not found a way to make Swing perform well enough.

I have not personally used Qt, but I know enough about it to realize that it has good performance, and, almost more importantly than anything else, a way to integrate a GL context. I've also heard good things about C# performance. I don't have enough experience with either to specifically recommend them over Swing, but I can tell you from experience that Swing is generally a pain to work with.

Although my feelings about Swing are entirely subjective too, so they might not actually be worth anything :lol:

Re: Java vs. C++, UI-heavy programs

Posted: Thu Apr 19, 2012 9:03 am
by Moosader
Alright, good advice. I'll reconsider on doing Java stuff.

As for an HTML5-built map editor, not sure about that, either. ;P I've seen some UI libraries out there, but packaging something made with HTML5/JS seems a little odd to me?

Also when JS crashes everything just refuses to do anything, and that's annoying. x)

Re: Java vs. C++, UI-heavy programs

Posted: Thu Apr 19, 2012 11:19 am
by k1net1k
Sorry I was just joking about html5. How the hell do you distribute a html5 app. Maybe they need some sort of bundled 'browser' with the html included (like some sort of self contained app)
To answer your question properly :
It doesn't matter. As long as your map editor works on the platform you want it to work on, and you can easily create/publish/import the map files, then use what you like best. Is performance really a question for a map editor ? Maybe my understanding of map editor is different.

Re: Java vs. C++, UI-heavy programs

Posted: Thu Apr 19, 2012 5:17 pm
by dandymcgee
k1net1k wrote:How the hell do you distribute a html5 app. Maybe they need some sort of bundled 'browser' with the html included (like some sort of self contained app)
Package it with a Chrome installer, because anyone who isn't already using Chrome is doing themselves a disservice to begin with.

Re: Java vs. C++, UI-heavy programs

Posted: Thu Apr 19, 2012 5:38 pm
by k1net1k
dandymcgee wrote:
k1net1k wrote:How the hell do you distribute a html5 app. Maybe they need some sort of bundled 'browser' with the html included (like some sort of self contained app)
Package it with a Chrome installer, because anyone who isn't already using Chrome is doing themselves a disservice to begin with.
Interesting. I love chrome, but I would find it hard convincing people they need it

Re: Java vs. C++, UI-heavy programs

Posted: Thu Apr 19, 2012 6:00 pm
by Nokurn
My personal order of preference would be: C++, C# (if portability is a non-issue), then Java.
Though realistically I wouldn't consider any language other than the language that the game itself is written in, because I'm a firm believer in sharing code between the two--particularly for the serialization and deserialization of assets. Using a common library for this rather than developing language-specific code for it (or even bindings to another language) can drastically reduce inconsistencies/bugs between your game and editor. It also makes everything much more maintainable by virtually eliminating code duplication (or in the case of bindings, avoids the hassle of updating your bindings every time your common interface changes).
k1net1k wrote:How the hell do you distribute a html5 app.
In Qt Creator, you can make HTML5 apps with New Project -> Other Project -> HTML5 Application. You write your code in HTML5/JavaScript, and Qt generates a viewer program that uses WebKit.