/* attempt to deal with prototype, bootstrap, jquery conflicts */ /* for dropdown menus */

$10 ### Image of the Day Submit IOTD | Top Screenshots ### The latest, straight to your Inbox. Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content. Sign up now ## why C# and not Java? Old topic! Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic. 73 replies to this topic ### #1bilsa Members Posted 31 August 2006 - 09:59 PM Hello everyone! Lately I have seen a couple of threads about how c# is going to take over gamedev ? I'm not here to argue about that. What I wonder is why everyone is so "hyped" about c# taking over gamedev but why not Java? As far as I have seen some new benchmarks on the web, most of them actually say that Java currently is the faster one. Ok, so I know that c# has Visual studio, which I must say is my second favorite ide - seconds to eclipse. But other than that, it seems to me that java is more mature and I doubt that the .net framework will cach up to suns j2ee framework anytime soon. (j2ee or whatever it's called). C# has DirectX, but what's wrong with OpenGL with java? Ok, please don't start flaming that the benchmarks were wrong etc... lets just say that c# and java are equal in performance... C ya ### #2Shiny Members Posted 31 August 2006 - 10:10 PM Good questions! If I had more time, I'd respond in more length -- so excuse my brevity! C# is having a -lot- of money put into it as the 'premier' development language for Microsoft platforms in the future -- hence, MS is -very- keen to see it succeed and they're trying to make sure their C# solutions are top notch for Windows. Java itself has historically (and I'd argue still is) been very much business oriented -- that's not to say obviously that you can't use the OpenGL bindings...but that's what they are -- bindings to another language's functionality. The better option for Java -should- be Java3D, but Sun and the Java3D community have a hard time competing with MS and their MDX offerings -- especially when the majority of Windows dev appears to be DirectX based (sure, you get some awesome games in OpenGL too, and it is just as functional...but it just seems to be used less). Either way, form your own opinions -- as far as functionality is concerned, I'd argue that C#/CLR is almost if not as mature as Java is right now -- I really like the Threading and RMI stuff from Java -- but I will admit that I prefer using Visual Studio to eclipse these days. (Not that it was always so -- Eclipse was soooo much better than VC++ 6), but despite it being good -- it can chug a bit unless you have lots of RAM :) Anyway, these are just my opinions and as brief as I can make them. Form your own opinion based on the results people have had using the respective systems. ~Shiny ### #3nsto119 Members Posted 31 August 2006 - 10:17 PM Do you have links to the benchmarks? I don't think I've ever really seen a head-to-head comparison of the two languages. ### #4bilsa Members Posted 31 August 2006 - 10:30 PM Thanks Shiny, thats the kind of discussion I was hoping for :) nsto119 - I don't really remember where I found the benchmarks, but after a quick look at google with "java vs c# performance 2006" I found this amongst others: http://blogs.sun.com/dagastine/entry/sun_java_is_faster_than1 Though my point was not to say Java was faster, I was just saying that c# was not faster than java, and if it is it's just marginaly. ### #5Karadok Members Posted 31 August 2006 - 10:42 PM And i never heard of a faster java program. even when the bigges crack make the java program and the biggest sucker the c++ one for a benchmark. But anyway - it could be that i just never heard about it. My opinion is, that java is only good for internet applications or OS indipendend stuff (and that is slow because the real time comparser). If you want to write games the java choice is the worst because of the missing DirectX and OpenGl. ### #6Captain P Members Posted 31 August 2006 - 10:44 PM Bear in mind I've got no experience with C#, but nevertheless, is execution speed all that matters to you, or are memory usage, development time and other such factors important to you as well? I'm sorry I can't contribute more to the discussion, but at least these things should provide some food for thought. :) Create-ivity - a game development blog Mouseover for more information. ### #7bilsa Members Posted 31 August 2006 - 10:49 PM Karadok, I'm guessing your point is that java is slow becaouse of JIT compiler? But the same applies to C#. And there ara jogl bindings to OpenGL for Java, so you do have OpenGL at least. Though I agree that it would be better to have a built in 3D api with good performance. ### #8snk_kid Members Posted 31 August 2006 - 10:50 PM The main reason has relatively little to do with efficiency/"speed". I know this is going to offend some people but the truth of the matter is that Java (and the platform) has many issues that just make it a pain in the ass and verbose, it's just an unpleasant experience. No I don't mean it's difficult I mean the language (and platform) is borked. Before anyone tells me otherwise I have 3-4 years past experience with Java so I know what I’m talking about. C# (and the .NET platform/environment) does a whole lot of things right and/or much better. Even though this is the case I am not as keen about the C# language itself (not .NET) as others are but this isn't even an issue since you have an array of languages which target .NET (and even the Java platform). ### #9Riviera Kid Members Posted 31 August 2006 - 10:59 PM last i tried, interoping with c++ in java was a pain. i like the java api but the language is too limited. ### #10Shiny Members Posted 31 August 2006 - 11:01 PM Ok, got a bit more time to sit down this time (waiting for the new Apple developer tools to download (~980MB so I'll be waiting a bit). Anyway: I think the OP is interested in just why everyone around here is so keen on .NET and C# in general as an alternative to 'the old favourites' (C++ etc). I'm sure everyone has their own reasons; but I'm betting that a major one is that Microsoft does provide great support for their developers -- their tools are top notch, their feedback systems are good and their documentation is easily as good as the Javadocs (often better in places -- I find it easier to search). They have the advantage of only really having to target one platform and to the user -- once .NET framework is installed, they never have to think about it again (A compiled .NET program is an executable and doesn't require you to fireup the CLR for it) -- No little teacup hanging around that people might feel like playing with. As far as the internet is concerned -- C# can do just about all the things Java can...but Java has far greater acceptance (because it's been around longer...) and it doesn't cost anywhere near as much as a good microsoft solution. It's like the argument for and against using Windows 2003 Server -- it's great, does everything Linux can do -- has a new powershell coming out soon...but it costs many$ -- whereas even enterprise Linux systems like Redhat and SuSE are much cheaper to deploy, hence they get used as often or more often than the former.

Still, I suppose you could tie it all down to Microsoft themselves actually -wanting- people to use C# and .NET to make games -- check out this Wiki entry on Microsoft's XNA (Clicky) -- a streamlined system for game development on PC and XBox 360. Note that the Express version (free beta download right now, BTW) is based on the .NET framework and designed to work with Visual C# Express Edition! Sure, the pros will get a professional version with a real devkit to debug on, but this is a massive offering to anyone interested into getting into game dev.

This contrasts sharply with Sun: They know they have heaps of businesses invested in their enterprise solutions -- hence they get the community behind Java to look after things like Java3D. Note that Java3D stuff can be run right out of a browser! Pretty cool stuff that I've yet to see anyone do in C# ;). Check out their page (Sun's Java3D developer page...) right here.

Either way, use what you feel comfortable with -- or even better, the best tool for the job.

~Shiny

### #11Anonymous Poster_Anonymous Poster_*  Guests

Posted 31 August 2006 - 11:16 PM

ok, this is it:
java does not interpret at runtime, neither does C#.
most of the program is compiled before execution.
i wrote "most of" since some dependencies cannot be compiled before execution.

java does not compile some static dependencies, while c# does that.
so thats why c# should be faster than java, it doesnt interpret so much.
but on modern hardware, this is nothing to really worry about since you dont make "ultra-graphics" which run at 10fps even on modern graphics cards.

in my opinion, the garbage collection of C# is better than that of java.
this is why i prefer c#.

when i worked with eclipse (written in java), we had to restart our pcs because of memory issues (memory leaks)... but how could that be, if java had auto-garbage collection ?!? it just sucked.

### #12Zymph  Members

Posted 01 September 2006 - 12:18 AM

Quote:
 I know this is going to offend some people but the truth of the matter is that Java (and the platform) has many issues that just make it a pain in the ass and verbose, it's just an unpleasant experience. No I don't mean it's difficult I mean the language (and platform) is borked. Before anyone tells me otherwise I have 3-4 years past experience with Java so I know what I’m talking about.

Seconded!

### #13Kensha  Members

Posted 01 September 2006 - 12:48 AM

Some facts about Java:

1. Java programs are precompiled as the above post mentioned so there is no noticeable performance difference between C# and Java.
2. Eclipse gets a new version every 5-6 months. I currently working with eclipse and it is very stable. Eclipse also has more options which helps to eliminate extra code writing (auto generating code from interfaces, refactoring etc.) I have experience with Visual studio(s) (98 – 2005) and I prefer eclipse over it.
3. Java is not cheap. Bear in mind that along with the open source application servers (e.g. Jboss) there are quite a few vendors that also build application servers (ORACLE, BEA , IBM etc), which costs about 15K per CPU, and most of the J2EE (or JEE) development happens in those kind of servers. An estimation would be that a company to say hello to j2ee needs much more money than to .NET of course there are reason for it, better scalability, the out of the box “enterprise” nature of the J2EE and the fact that the target sector are large companies, banks etc.
4. There are OPENGL binding for java (JOGL, LWGL) specially lwgl supports input much like direct input. Which performs quite well an example the JMonkey engine (http://www.jmonkeyengine.com/) a free engine written in java with many special effects (HDR, Bloom, … )

Finally the only reason I see for not using java instead of c# for game development is that Microsoft has better marketing than Sun and made the .Net framework more appealing in the eyes of developers and most important that java is nightmare in configuration issues. It’s very hard for someone used on Microsoft’s development products to jump to Suns.

Sorry for my bad english.

### #14ernow  Members

Posted 01 September 2006 - 12:50 AM

I think most developers don't care about C# versus Java.

Developers should compare the platforms instead of the languages (.NET vs. J2EE)

Decision-makers should compare vendors (Microsoft vs. the Guys in Blue)

Enterprise organisations will use both (emotion vs. practical necessity)

(Don't get me wrong: I am not trying to kill a discussion but statements like "C# vs. Java" or "C# is faster" will get you nowhere when you do not define faster. Faster execution, faster development, faster running out of money, faster...)

### #15aidan_walsh  Members

Posted 01 September 2006 - 01:25 AM

Quote:
 Original post by Anonymous Posterwe had to restart our pcs because of memory issues (memory leaks)... but how could that be, if java had auto-garbage collection ?!? it just sucked.

Quite easily. And it can happen just as easily with .NET. It all depends on how the application is programmed. If you are still holding references to objects that you no longer need, they will not be GC'd. This happens on both platforms.

www.aidanwalsh(.net)(.info)

### #16Anonymous Poster_Anonymous Poster_*  Guests

Posted 01 September 2006 - 01:40 AM

When I was first learning Java I couldn't figure out why it was missing some data types (unsigned) and why no enumerations. C# has these. I am jumping on the C# bandwagon so as to develop on the Xbox 360. Being managed doesn't really bother me either, just something different. The biggest change is moving from the fixed function pipeling to programmable for the 3D stuff - but that is a good thing.

### #17ApochPiQ  Moderators

Posted 01 September 2006 - 01:51 AM

Just to throw my spare change in...

The .Net libraries are far better than those available for Java for doing single-user applications and games. I haven't kept up with the "enterprise" world much in the last few years, but from what I hear Java is still dominant in that sector over .Net. However, out of the box, the tools available for .Net languages are infinitely better than those available for Java.

.Net offers fully native widgets (widget libraries for Java are pretty much crap IME), a cohesive library where Java's libraries are typically disjoint and much less internally self-consistent, and so on. Java is older, but this is not necessarily an advantage. Programming languages aren't like wine; if you just ignore them, they get worse, not better.

Java's problem is that it has grown unevenly over the years, and is extremely inconsistent between versions and even in individual libraries within single versions. .Net has its quirks, of course, but they are much less severe since the framework is more or less a single effort rather than an organic growth over time. And, of course, there's Managed DirectX - no 3D API bindings for Java come remotely close to MDX.

The real kicker, though, is that the .Net languages (since 2.0) are far more powerful than Java. Anonymous delegates, higher-order functions, robust reflection support... these things make a huge difference when it comes to creating concise and elegant code. In general, the .Net languages offer vastly better options for solving problems than Java, and that will make another huge leap forward once 3.0 arrives. Of the .Net languages, C# has (subjectively speaking) the most comfortable syntax, since it eliminates a lot of the verbosity of VB.Net, even though the languages are functionally almost identical.

Java was a good idea, with a patchy-at-best implementation. .Net has now leap-frogged it, and is promising to go much further in a short amount of time. Looking towards the future, the stuff coming in 3.0 (and what that hints at for the future) is going to make .Net very powerfully appealing to more skilled programmers who can really take advantage of those language features. Java has a lot to catch up to, or it risks becoming irrelevant outside the enterprise niche.
Wielder of the Sacred Wands

### #18LizardCPP  Members

Posted 01 September 2006 - 02:05 AM

Note to self: Don't try to reason with religious fanatics.

[Edited by - LizardCPP on September 1, 2006 2:05:39 PM]

### #19Plasmana  Members

Posted 01 September 2006 - 02:18 AM

My opinion is that it is a question of momentum and endurance.

Look at how quickly .NET has developed; especially XNA... support for XBox360 on PowerPC chips!!! Look at the 3rd party support that's hitting the market simutaneously:

- TorqueX -- http://www.garagegames.com/products/torque/x/
- Visual3D Architect .NET -- http://www.visual3d.net/Home/tabid/36/Default.aspx
- SUVA 3D Engine -- http://www.suva3d.com/index.html

In addition, development firms trust Microsoft's committment to .NET as a gaming platform. Check at the quotes from this article 2 years ago:

- http://www.secretlevel.com/main.php?page_type=item_pages&page=press_release&release=219&button_id=2

There's just no equivalent in the Java world to what's going on here.

### #20ApochPiQ  Moderators

Posted 01 September 2006 - 02:54 AM

Quote:
 Original post by LizardCPP[snip quote]What do you base this on?[snip quote]Swinglabs, check out SwingX.Also when you have used a IDE like IntelliJ you relaise how bad Visual Studio is, and how much easier you're life can be. Lizard

I base it on subjective experience. All of this is primarily subjective; if you're really committed to some language, you're going to love it no matter how bad the language actually sucks, and how much proof there is of that fact. (I usually cite Java as my canonical example of this phenomenon, but I realize that'd be a bit unfair. Let's pick on, say, Fortran or COBOL here.)

There is some objectivity though. As for games... please show me an existing, market-ready set of Java libraries I can use to create a simple 3D app over DirectX. It'd better take less than an hour, or C# will win. Actually, I'll be gracious and permit OGL too. Either way, if it takes more than an hour to get to a point where I've got 3D geometry moving on the screen and controlled by keyboard input, Java's libraries have lost. It's just one person's experience, but I'd lay down good money that MDX just plain creams anything Java's got.

As for fat-client apps... I've sat down with .Net and written entire applications in minutes; one of them I did for a friend and old coworker, and it was so successful that we're having lunch today to discuss selling it to other clients. I did a complete angle visualization tool in about 30 minutes in C# - and I barely know any C#.

By contrast, I spent two years trying (off and on) to pick up Java. Now, to be fair, I haven't done any UI work for a while now in Java, so I may be behind the times - but I do know that as of last time I checked (would have been 2004) there was no Java UI library that wasn't a steaming pile of feces. There certainly wasn't anything that could touch WinForms for rapid development. I learned WinForms in a matter of minutes, just tinkering around; I once spent three days trying to get a Java program's UI to do what I wanted, and ended up quitting due to the overwhelming urge to shoot myself in the head.

As for IntelliJ ... more subjectivity [smile] I'd rather be castrated with a rusty spoon. Twice.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.