So for a college class I'm doing my first coding in C#. It's a strange language, and I'm not quite sure what I think... there are aspects I both do and don't like. On the whole, I don't think it's as good as Java, but I'm still not 100% decided on my stance.

For all of you who've done some work in C#, what's your opinion? How does it stack up against Java?

It's such a childish thing to claim. C# is packed with features that Java doesn't have, such as LINQ, (proper) unsafe code and asynchronous methods. C# also got WPF, whilst Java is still waiting on a half-decent version of JavaFX. Lets not forget that Java is getting lambdas after C#, and is copying the syntax.

Also windows only. Of course it is possible somehow to program for other OS's, but obviously MS wouldn't want that.

Again, if you just did research you'd know this isn't true.

Mono is pretty stable on Linux, and has never been threatened by MS, ever. Microsoft have even standardized C# and parts of .NET as ECMA standards, released under licenses which make it perfectly legal to implement them, which in turn helps Mono development. They did not have to do these things. MS even helped to implement Moonlight.

Personally, if your building for Windows, then use C#, especially if your building an application because WPF is truly brilliant. If you building for non-Windows, then use Java. With XNA you can also target Silverlight, as well as XBox and PC. This will mean you could also build your game as a Metro app, and release it in the Windows store.

One of the main issues with Java is around the game libraries. Only a couple (LWJGL and JMonkey) are actively developed, the rest either get occasional updates (like JOGL) or are simply old and left to die (Java 3D). On the flip side, game development with C# is far more active, and has far bigger ecosystems. For example there are more books on using XNA, then there are game development books on Java. You'll find more tutorials, frameworks, communities, libraries and games relating to C# then Java.

But ultimately my advice would be to 1) work out what exactly it is you want to build, and 2) try them both out for yourself.

Sorry for the OT, but I keep seeing this lately. It's not true and I wonder why it's been repeated so much. JOGL and the other JogAmp projects are updated much more frequently than LWJGL, on a daily basis even. Sven and Michael have put so much work in it and it's unfair to keep reading things like JOGL's been abandoned and stuff.

Sorry for the OT, but I keep seeing this lately. It's not true and I wonder why it's been repeated so much. JOGL and the other JogAmp projects are updated much more frequently than LWJGL, on a daily basis even. Sven and Michael have put so much work in it and it's unfair to keep reading things like JOGL's been abandoned and stuff.

Ok, then I stand corrected.

But even on that point alone, there are still more DirectX bindings for C#, then there are OpenGL bindings for Java. That doesn't include the OpenGL alternatives for C#, and you can even use DirectX and OpenGL directly, which you cannot do with Java. This shows how C# game development is much more active.

C# has basic coroutine support, which is quite nice (provided you understand the caveats); and I'm a fan of extension methods (although I find that I need to use them more than I should because of some obvious errors in the library design). The using keyword is a nice piece of syntax sugar, and so is event (although it could be done better).

My projects use .Net 3.5, so I'm not familiar with the changes to the type system in 4. In 3.5 the type system is behind Java's when it comes to generics. And the biggest gripe I tend to have is bizarre choices in the library design. I'm not at all convinced by the merging of input and output streams into a single Stream, and the design of System.Security.Cryptography with the same object serving as key and cipher object is baffling. (Mind you, I'm moving towards using BouncyCastle, which has been ported from Java, for preference). And if you look at the collections, why is AddRange declared in List rather than ICollection?

Between Java and C#, I give Java the edge for libraries, and C# gets the point for the language features.

Neither of them hold a candle to Scala though. You want well-designed type system and collections, you just can't do better, and it has enough syntax sugar to give you diabetes. There's a .NET target for scala, but it's always lagging behind.

I've been using C# for a few Unity3d projects so far and the more I use it and learn about it, the more I think it is bloated. It has some nice features here and there, but there's so many and a lot of overlap.Reading through C# libraries seems quite hard as well, as everything is done in unique ways.Also, I find myself writing worse code in C#. My choices seems to be based on how short I can write things, rather than readability.

If Unity3d supported Java, there would be no reason for me to use C#...

That being said, you should probably ask the question in a more neutral forum, if you want fair answers. Or perhaps ask in both camps for fairness :-)

But fair comparison would be Pepsi vs Coke. If another is free and you can drink it every country and other cost money to drink and do not open on some side of worlds. There might be some flavor difference but those who want free drinks don't care flavor that much.

But fair comparison would be Pepsi vs Coke. If another is free and you can drink it every country and other cost money to drink and do not open on some side of worlds. There might be some flavor difference but those who want free drinks don't care flavor that much.

But flavor IS how people decide what to drink. Also if I never go to the other side of the world, then does it really matter if it is/isn't available there?

Either way, C# is free in the sense that you don't pay any money to use it, which is most people's definition of 'free'. It's not free in the sense that you cannot alter it's insides, and hit compile. But how often has anyone wanted to do that with Java? and is that a requirement when building a game?

Mono is pretty stable on Linux, and has never been threatened by MS, ever. Microsoft have even standardized C# and parts of .NET as ECMA standards, released under licenses which make it perfectly legal to implement them, which in turn helps Mono development. They did not have to do these things. MS even helped to implement Moonlight.

Mono is not really stable on Linux. Moonlight is even worse. I don't like to watch TV, my girlfriend wanted to use Moonlight to watch a tennis match and this thing froze my browser several times. I mentioned an excellent diagram which shows the numerous differences between Microsoft .NET and Mono implementation, it cannot be compared to Java, even OpenJDK and Oracle JVM are closer than Mono & Microsoft .NET.

Of course, ClickOnce only works on Microsoft .NET which is less interesting than our (buggy) Java Web Start, IzPack and GetDown.

One of the main issues with Java is around the game libraries. Only a couple (LWJGL and JMonkey) are actively developed, the rest either get occasional updates (like JOGL) or are simply old and left to die (Java 3D). On the flip side, game development with C# is far more active, and has far bigger ecosystems. For example there are more books on using XNA, then there are game development books on Java. You'll find more tutorials, frameworks, communities, libraries and games relating to C# then Java.

This is simply disgusting. Ardor3D is actively developed like JGame, Slick, Libgdx, etc... Java3D has had only a few maintenance loads and is dying but JogAmp is actively maintained (LWJGL too). Maybe there are more books but I disagree with you about tutorials, there are far more resources in Java than in C# and not only about gaming. The real lack is in WYSIWYG editors, only MMF2 partially supports applets, JMonkeyEngine 3 has a GDE (integrated Game Development Environment).

C# cannot be compared with Java in terms of licenses. OpenJDK works better than a few years ago, I use it daily whereas I didn't dare to do it in 2009. I like free open source softwares

I would prefer C# to give some of its features, I still don't like lambdas, closures and their friends. Yes, both languages have diverged but C# was mainly a clone of Java created after the death of Visual J++. Don't forget that Java itself has its bytecode inspired of Microsoft P code... Microsoft and Sun Microsystems copy

Edit.: The main C# binding of OpenGL (contained in OpenTk) is 70% slower than JOGL

But fair comparison would be Pepsi vs Coke. If another is free and you can drink it every country and other cost money to drink and do not open on some side of worlds. There might be some flavor difference but those who want free drinks don't care flavor that much.

A cola analogy is not bad. A small number of people prefer one over the other based on taste and the rest have an irrational preference.

Like it or not, the last time I looked windows had around 91% of the market. So for 91% of users, C#/.NET is effectively free. So the whole "free" argument is pretty weak. From a technical standpoint C# and .NET are superior to Java/JVM. Note that I'm not talking about any specific implementation but the design.

For most beginning to intermediate programmers the choice really doesn't matter. Once you learn one picking up the other will be pretty easy.

Reading through C# libraries seems quite hard as well, as everything is done in unique ways.Also, I find myself writing worse code in C#. My choices seems to be based on how short I can write things, rather than readability.

This is essentially my experience so far, as well.

Quote

I don't like Java that much but I do like Eclipse. Good IDE can raise my productivity by big margin and that is all what matters.

I've been using C# for a few Unity3d projects so far and the more I use it and learn about it, the more I think it is bloated. It has some nice features here and there, but there's so many and a lot of overlap.Reading through C# libraries seems quite hard as well, as everything is done in unique ways.Also, I find myself writing worse code in C#. My choices seems to be based on how short I can write things, rather than readability.

This is exactly the thing wrong with C#, they took Java and tried to throw in all kinds of features.Now that C# is going down, they want to do the same with features for Java because, wait for it ... C# has them as well. /facepalm

Now besides that, people should take the tool best suited for their needs. If you need gui stuff, take what works best.It makes no sense to take Java for a GUI just because your server code is based on Java! Same vice versa.

Mostly the same. You can jump in and out of each with a minimum of fuss. It really all depends on where you're trying to deploy. But C# being developed by a company that has its own console and actively pushes games is a big thing for us game devs. XNA and the like only get more mature, whereas Oracle/Sun have been shying away from games for years and years. It is only through the heroic efforts of individual people developing open source libraries (LWJGL, JOGL, jME) that Java can even compete.

But they're pretty much the same at this point, for all purposes 99% of the people on this forum will care about.

XNA and the like only get more mature, whereas Oracle/Sun have been shying away from games for years and years.

Have you seen XNA recently? MS screwed it over because they decided that XNA would be the preferred platform for writing Windows Mobile apps. That means it suddenly lost a bunch of functionality because of it's lowest-common-denominator approach.

Combine that with it's ridiculous straight-jacketed resource pipeline that couples with Visual Studio in all the wrong ways, so you end up having to use the regular file io operations to write something sane to use instead. Which then means you can't run on 360 or Windows Mobile, and you've forfeited one of the main reasons for using it in the first place.

Not to say it's still not usable, but it's not shiny happy wonderful gamedev land over there either.

XNA and the like only get more mature, whereas Oracle/Sun have been shying away from games for years and years.

Have you seen XNA recently? MS screwed it over because they decided that XNA would be the preferred platform for writing Windows Mobile apps. That means it suddenly lost a bunch of functionality because of it's lowest-common-denominator approach.

Combine that with it's ridiculous straight-jacketed resource pipeline that couples with Visual Studio in all the wrong ways, so you end up having to use the regular file io operations to write something sane to use instead. Which then means you can't run on 360 or Windows Mobile, and you've forfeited one of the main reasons for using it in the first place.

Not to say it's still not usable, but it's not shiny happy wonderful gamedev land over there either.

I haven't seen it lately, no. That's lame to hear. I knew it was basically just a bunch of frameworks for making games, not some magic happy place, but still...

Oh, and I forgot the final kick in the teeth - MS don't support old versions of XNA and don't want you using them, so the SDK installs auto-destruct after certain dates to force you into using the latest and greatest. So you can't even install the pre-windows-mobile version of XNA because it doesn't work any more.

From a technical standpoint C# and .NET are superior to Java/JVM. Note that I'm not talking about any specific implementation but the design.

Why? C# is slower, .NET is less cross-platform, why would we consider it is technically superior? The languages which have the most features are not necessarily the best languages in my humble opinion. Look at C++, it has become too complicated, who really knows how to use all kind of pointers? How is able to read any C++ code?

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org