Java vs. C++, UI-heavy programs

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
Moosader
Game Developer
Game Developer
Posts: 1081
Joined: Wed May 07, 2008 12:29 am
Current Project: Find out at: http://www.youtube.com/coderrach
Favorite Gaming Platforms: PC, NES, SNES, PS2, PS1, DS, PSP, X360, WII
Programming Language of Choice: C++
Location: Kansas City
Contact:

Java vs. C++, UI-heavy programs

Post 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.
User avatar
THe Floating Brain
Chaos Rift Junior
Chaos Rift Junior
Posts: 284
Joined: Tue Dec 28, 2010 7:22 pm
Current Project: RTS possible Third Person shooter engine.
Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
Programming Language of Choice: C/C++, Python 3, C#
Location: U.S

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

Post 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.
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself

ImageImage
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

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

Post 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.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
THe Floating Brain
Chaos Rift Junior
Chaos Rift Junior
Posts: 284
Joined: Tue Dec 28, 2010 7:22 pm
Current Project: RTS possible Third Person shooter engine.
Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
Programming Language of Choice: C/C++, Python 3, C#
Location: U.S

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

Post 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
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself

ImageImage
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

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

Post 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.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
Moosader
Game Developer
Game Developer
Posts: 1081
Joined: Wed May 07, 2008 12:29 am
Current Project: Find out at: http://www.youtube.com/coderrach
Favorite Gaming Platforms: PC, NES, SNES, PS2, PS1, DS, PSP, X360, WII
Programming Language of Choice: C++
Location: Kansas City
Contact:

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

Post 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"?
User avatar
k1net1k
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 563
Joined: Sun Nov 07, 2010 2:58 pm
Contact:

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

Post by k1net1k »

HTML5
User avatar
thejahooli
Chaos Rift Junior
Chaos Rift Junior
Posts: 265
Joined: Fri Feb 20, 2009 7:45 pm
Location: London, England

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

Post 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.
I'll make your software hardware.
User avatar
THe Floating Brain
Chaos Rift Junior
Chaos Rift Junior
Posts: 284
Joined: Tue Dec 28, 2010 7:22 pm
Current Project: RTS possible Third Person shooter engine.
Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
Programming Language of Choice: C/C++, Python 3, C#
Location: U.S

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

Post 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.
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself

ImageImage
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

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

Post 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:
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
Moosader
Game Developer
Game Developer
Posts: 1081
Joined: Wed May 07, 2008 12:29 am
Current Project: Find out at: http://www.youtube.com/coderrach
Favorite Gaming Platforms: PC, NES, SNES, PS2, PS1, DS, PSP, X360, WII
Programming Language of Choice: C++
Location: Kansas City
Contact:

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

Post 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)
User avatar
k1net1k
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 563
Joined: Sun Nov 07, 2010 2:58 pm
Contact:

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

Post 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.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

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

Post 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.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
k1net1k
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 563
Joined: Sun Nov 07, 2010 2:58 pm
Contact:

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

Post 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
User avatar
Nokurn
Chaos Rift Regular
Chaos Rift Regular
Posts: 164
Joined: Mon Jan 31, 2011 12:08 pm
Favorite Gaming Platforms: PC, SNES, Dreamcast, PS2, N64
Programming Language of Choice: Proper C++
Location: Southern California
Contact:

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

Post 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.
Post Reply