will java become the next big language?

Started by
145 comments, last by the_nemesis 22 years, 2 months ago
I''ve shipped 3 commercial PC CD-ROM titles that used Java:

- You Don''t Know Jack 5
- Who Wants To Be A Millionaire
- Who Wants To Be A Millionaire : 2nd Edition

All of the game logic was in Java and the rendering engine is in a .dll that the Java code used via JNI. Calling down to C++ code from Java is very fast (the other way around is another story).

Now I''m doing PS2 stuff, and Java just isn''t realistic on the PS2 hardware. Don''t get me wrong, it could be done. But you wouldn''t want to.
Advertisement
Hmm, let''s look at those features java has again:

1) Garbage collection

Use an external garbage collector, if you really need to. Or better yet just be a responsible programmer and delete your pointers in your destructors. Or if you''re lazy there''s auto_ptr. And the stl. Come to think of it, memory deletion never really took more than a few minutes on even the largest projects.

2) Built in serialization

I''m sure this is nice, but how many people don''t define their own file format for important stuff? On one hand, you have exporters from tools which i''m sure don''t support the special format your serializer looks for. On the other hand, you have extraneous stuff in your classes anyway, which needs to be reset everytime you run your program.

3) Bounds checking
Slow slow slow slow slow.
I consider this a learning tool. Production code should NEVER be referencing a bad boundary. If you''re so uncertain of your programming ability that you need this, make up your own wrapper around vector to do bounds checking. I bet it will take any DECENT c++ programmer about 10 minutes.

4) Reflection

Alright, I gotta admit, this one is kinda cool. But is it cool because it''s actually useful, or is it cool because it''s something c++ doesn''t have?

5) Dynamic class loading

Same comment.

6) Integrated threading support

Ok, quick question. Let''s say there''s an application available for windows, and there''s two identical versions, one in c++, and one in java. The c++ version uses windows specific routines, while the one in java uses the java routines. Which one would you download?

If anyone here said the java one, i have a nice bridge to sell you...

Seriously, java''s components don''t work as well as platform specific components. They never will. So while it''s nice to have "write once, run anywhere" a more truthful statement is "Write once. Realize that it''s slow and inconsistent everywhere, and rewrite for each platform to make it look and feel consistent."

I see java as a tradeoff. You get generality, but at the cost of functionality. How many java programmers use IDEs built with java? I certainly don''t. I tried. But the fact is, they''re slower, uglier, and less consistent with general windows applications than their c++ counterparts.

So what does java bring to the table?
I honestly don''t know. I''ve tried both, and I can''t stand java. Maybe it''s the ridiculous names of their library classes(Try saying JOptionPane with a straight face). Maybe it''s the total lack of C++ constructor-style casts:

float f=0.5;
int i=int(f);
//cannot do in java

Maybe it''s the penalty you pay for unused language features. Even if you still do explicit memory management, you pay in one way or another for garbage collection. In c++, if you don''t use a feature, it doesn''t slow the rest of your program down.

Maybe it''s the beauty of the stl.

Maybe it''s the power of templates.

Maybe it''s the power of multiple inheritence.

Maybe it''s the syntax...somehow it just looks clean, and judicious use of operator overloads supports that notion.

vec3f a(1,0,0),b(2,1,0);
vec3f c=a+b*10;

For some reason, I think c++ code just looks better.


It''s really interesting to see people''s arguments in support of one language over another. I also find it interesting that of my friends who use java, none of them knew c++ well before that. Additionally, those who started with java and went on to c++ stayed with c++.

It''s also interesting to see the sun marketing machine at work here.

Java is quicker to develop in? Not really:
http://www-aig.jpl.nasa.gov/public/home/gat/lisp-study.html

Write once, run anywhere?
Not in my experience. There are still platform differences for java.

Easier to use? Better interfaces?
Nope again. At work, we were using MFC for interfacing. Along came the lure of java''s portability. We spent a whole summer implementing a java interface. Guess what? Now we''re dumping the java & going back to MFC, because the MFC interface worked better, it was faster, and it was more consistent with standard windows controls.

Let marketing machines sit around and proclaim what the next big thing is. Usually they don''t do any real work anyway, otherwise they wouldn''t have so much time to evangelize their pet language. Know the facts before you make a conclusion. So, for all you java people, I''d recommend reading the Design & Evolution of C++.
Also, I really don''t want to hear anymore stories about how fast java is to develop in because "I don''t know c++ but if i did i''m sure it would take me 10x longer than it took me in java because of pointers"

We''re looking at the power & ease of development of the language, not newbie friendliness. I will agree that java is more newbie friendly. But once you''ve done some programming, you stop making newbie mistakes like out of bounds array accesses. But, with java, you still have to pay for that runtime check.

Many people compare asm->c++ with c++ -> java. This is a faulty comparison.

C++ offered many features that asm couldn''t, at the cost of performance. Notably, it was much faster to develop applications in. It is foolish to think that there exists such an enourmous development time difference between java and c++. Now, there have been scientific comparisons of experienced java and c++ programmers:

(you need an acm membership for this one)
http://portal.acm.org/citation.cfm?id=317683&coll=portal&dl=ACM&CFID=1682438&CFTOKEN=94681105

http://www-aig.jpl.nasa.gov/public/home/gat/lisp-study.html

In the case of the second study, the c/c++ programmers were MORE time efficient than the java programmers, but they were also, on the average, more experienced.

" First, development time for the Lisp programs was significantly lower than the development time for the C, C+ and Java programs. It was also significantly less variable. Development time for Lisp ranged from a low of 2 hours to a high of 8.5, compared to a range of 3-25 hours for C/C++ and 4-63 hours for Java"

(talking about experience)
"an average of 6.2 years for Lisp versus 9.6 for C/C++ and 7.7 for Java"
The first study didn''t explicitly mention development times.
JAVA = WORK OF THE DEVIL!!!!!

#define BLOODY_WORK_THIS_TIME;
#define BLOODY_WORK_THIS_TIME;
to Sjelkjd:
You arguments just doesnt hold.
Regarding garbage collection, WHY would i want to bring in an external garbage collector when i can just use Java?(Especially if you already know Java, as will be the case for many new programmers very soon).

As for serilization, sure people are making their own fileformats NOW, because they feel they have to reinvent the wheel, but Java can make that all go away Just because people arent using this feature right now, doesnt make it bad.

Bounds checking: Bounds checking is a GOOD THING. Sure, "I never ever happen to reference an array out of bounds", but it just isnt true, even skilled programmers do this sometimes, and i can assure you its nice to know when it happens. BUT i would like a way to disable it in when building the release version.

""Write once. Realize that it''s slow and inconsistent everywhere, and rewrite for each platform to make it look and feel consistent."
Thats just crap, the only thing that fits what you say here is Swing(GUI API), which doesnt use native GUI components. It is, or at least used to(JDK 1.4 introduced some hardware accel. 2d drawing stuff) be VERY slow. But does C++ have a GUI system in its standard libraries, so just dont use it, you might say

To your second post:
The faster development in Java has very little to do with pointers. It has alot more to with the fact that Java is alot easier to debug(for example because you get out-of-bounds exceptions and null pointer exceptions etc), and because its simply much harder to mess up. Another nice feature is Java''s HUGE standard libraries, with built-in data structures like HashMaps/tables(this is also included in some C++ STL implementation, but i dont believe its part of the standard).

One could also argue that it seems the people like Microsoft seem to disagree, just look at .Net and C#. Add that to the fact that nobody actually teaches C++ to students anymore, and you would have to agree that at some point C++ will have to yield even in gaming(it already has for alot of other applications).

Personally i like C++, its been some time since ive made anything in Java, but i can understand why people wouldnt want to bother with C++ unless they want to program games.
quote:I've shipped 3 commercial PC CD-ROM titles that used Java: ...
Now I'm doing PS2 stuff, and Java just isn't realistic on the PS2 hardware. Don't get me wrong, it could be done. But you wouldn't want to.

Sure you have, and sure it won't

Gotto love unsubstantiated claims by APs.

quote:Use an external garbage collector, if you really need to.

Yeah, and then you just make all 3rd party libs use it too. You can possibly write clean code in C++, and you could possibly limit the features you use in a way that prevents bugs, but the minute you start using other people's code you are also at the mercy of their ugliness.

Also, there are lots of things that you say you can do in C++, such as be careful about causing memory leakes and checking bounds, but as Arild wrote earlier, experience shows that people just are not that careful and that bugs add significantly to the development time.

quote:Maybe it's the ridiculous names of their library classes(Try saying JOptionPane with a straight face).

Yeah, you probably think MS's HWND, HDC, lp_str_sdfsdf etc. are so much better lol. The cleartext naming of library classes, methods and variables in Java is a huge step forward, one that I hear Microsoft is about to emulate with new namings in their .NET API (at least in the C# version).

quote:In the case of the second study, the c/c++ programmers were MORE time efficient than the java programmers

Well, even Microsoft will refer you to a study by IDC research that shows a developer productivity increase by a factor of two in 9 corporations that switched from C++ to Java (the second paragraph where they refer you to "Java Pays - Positively: bulletin"). The study itself has to be ordered from IDC but Sun has of course put up an article about the results.

Edited by - HenryApe on February 26, 2002 4:37:57 AM
quote:Original post by Blacksmith_Tony
I HOPE Java doesn''t invade the games industry. There is nothing it can do that C++ can''t (well except that applet thing). Plus it is a lot slower. I suppose the fact that is platform independant is a good thing, but this does mean that the JVM has to be installed on the machine to be able to run the program.

So my answer is, Java is (and will be) used for web browser based games, but I doubt it will be used for much else in the games industry.

I find most teachers/lecturers like to talk about new things that will be great. Usually they are wrong .


Well you are quite wrong there. Java is NOT a lot slower, actually it is not slower at all. Java is a lot more sophisticated and when coding Java you do not have to take care of the annoying routines and boring stuff like reserving and freeing memory. Java development is much faster because programmer can concentrate on the important things like class design. Java is a real object oriented language and C++ is not.

People always resist change... Java will replace C++ in all areas. Gaming industry already makes research on the subject. When designing Java 1.4 gaming industry has been noted.

- neongoon -
- neongoon -
First of all a little bit of history about me:
I have been in and around the games industry for 18 years so far, which means I have a lot of experience. I remember my first piece of C64 ASM I wrote, and remember the stupid arguments I had with C coders very much like the above. So I say the following with more experience than most and having spent a great deal of time developing BASIC, ASM, C, C++, and Java. And knowing a lot about the industry, market and business feel that thouse of you techies who go on about power and speed miss out the business argument, this is due to lack of industry experience.

So let me reiterate:

C/C++ became the industry standard over ASM for the following reasons:
 Most part of game code doesn’t need optimisation (only rendering needs optimisation which can be done in ASM).
 Development costs will be reduced due to the tools, type checking and increased number of C programmers on the market.
 C++ code is more portable than ASM (can be recompiled on other platforms)
 C/C++ will increase profit margins for games developers due to the larger market share (portability of code) and reduced development costs.

Java will become the industry standard within 10 years for the following reasons:
 Most part of game code doesn’t need optimisation (only rendering needs optimisation which is done using hardware acceleration and Java now uses Direct Draw in Windows for 2D rendering and can now interface with OpenGL for 3D).
 Overhead will be minimal so speed comparison between C and Java will be negligible (Games graphics are not done by optimised code but thanks to accelerated hardware)
 Development costs will be cheaper due to the number of Java developers and the fact the language is just a clean implementation of C++ and has many advantages.
 Java games are portable as long as you have a JVM which is now appearing in mobile phones, PDA’s and comes with most internet browsers.
 Java is more geared to internet access which goes hand in hand with multi-player games which suffer from internet latency.
 Java will increase profit margins for games developers due to the larger market share and reduced development cost.

Can anyone see a pattern here.

I agreee that Java is and always will be slower than C the same as C++ will always be slower than a well written piece of ASM.

The point I made was that C++ became a defacto standard in the games arena because the time to develop was reduced and as well as its portability to other platforms. I mean C/C++ came into its own way before the PC was even a player in the games market. C++ was great for writing Amiga games and porting to console or Atari.

Now C++ is slower than ASM, and even with the most optimised compiler in the world ASM will always win (I know this as I write video codecs for Windows and have to use ASM embedded in C++ code for). And yes Java has a overhead due to the fact the compiled optimised byte code is interpreted but as I said before, in five years the top of the range PC will be 16Ghz and GeForce will be on version 14, and this also goes for the Consoles, Mac, Unix, Linux, Acorn, hardware equivalent.

Now a company could write a game comparable to C++ (due to the minimal overhead) but instead of selling to a single market (the PC for example), they could generate far more profit from selling to the whole market which would include Windows, Linux, Unix, Mac, Acorn, and Console.

A single development cost to release in multiple markets, now that makes good business sense.
And sorry to say this to all you guys but the world is ran by business which is ran by profit, we saw this when ASM was overtaken by C++ and this is why looking at ASM and C++ is a good comparison.

And I know C++ code can be ported if you don’t use DirectX but use OpenGL but there are still inconsistencies and require specialists which still cost companies money.

In closing those who believe the most powerful language will always prevail, then I am sorry but you will end up like the ASM developers before you. You need to understand business, which is all about making money and this is achieved by increasing you profit margins and this can be done by increasing your market and reducing your costs.


Edited by - stiby on February 26, 2002 5:02:10 AM
StibyI program therefore cant spell!
My Humble $0.02:

Java is a great language and I''ve loved working with it but if it has a flaw it is that it tries to do too many things. Some its does incredibly well, others so so. Swing, is one of the so so. It uses incredible amounts of memory, is buggy as hell, leaks memory, and does not offer all the functionality of something native like MFC. Swing has has some good things, first of course being much better thought out and object orientated.

Java''s big challenge though is going to be the client side. As C# is out and getting positive feedback it I think stands more of the chance become the client side language of choice. The more I look at it the more I like it. It solves many of the issues of MFC/WinAPI yet also resolves many of the failures of Swing. Don''t think Sun is going to win this particular battle...
It is interesting that you would state that Java is "buggy as hell" and "leaks memory", especially since the language has been most successful among developers of mission critical enterprise applications.

Edit: Rephrasal to something less confrontational

Edited by - HenryApe on February 26, 2002 10:51:19 AM

Edited by - HenryApe on February 26, 2002 10:51:58 AM

Edited by - HenryApe on February 26, 2002 10:52:25 AM

This topic is closed to new replies.

Advertisement