[java] Moving from C#

Started by
8 comments, last by Darken Mind 16 years, 11 months ago
Hello everyone! Okay. I'm writing a game (duh). I've done like half of the code in C#, however it's been a pain in the you-know-where to install Mono on Linux and Mac. Plus I've heard you have to change a lot of .NET code for it to work on Mono. So I've been thinking of getting into Java. I took a Java class in school last semester, that taught me the very basics of the language. Pretty similar to C#. My primary concern in moving here is speed and performance. I'm somewhat obsessed with old computers, and I'd like my games to run on them. Not very old ones though because I know the limitations of Java (DO NOT mention C++ here please). I've heard C# is a bit faster. Is this true? If so, how much faster? So what do you guys say? Here are a few other questions: * What's the most commonly used graphics lib in Java? (I'm using SDL.NET in C#.) * Is there anything similar to C# 2.0 generics or even ArrayLists? (a.k.a. dynamic arrays) * Does it have some sort of API for asynchronous networking? (Very important) Thanks in advance!
Advertisement
I have yet use C# myself, but I have heard many say that C# and Java are nearly identical in syntax and usage. I doubt you'll have any trouble at all making the switch.
Quote:* What's the most commonly used graphics lib in Java? (I'm using SDL.NET in C#.)

JOGL provides bindings to OpenGL. It doesn't provide sound APIs though. You would need separate libraries for that.
Quote:* Is there anything similar to C# 2.0 generics or even ArrayLists? (a.k.a. dynamic arrays)

Yes, Java has a pretty full-featured set of collections. ArrayList, Vector, HashTable,TreeMap,etc (many others). Generics are available as of 1.5.
Quote:* Does it have some sort of API for asynchronous networking? (Very important)

It has a pretty extensive networking API. Tutorial here.

[Edited by - Ezzaral on May 10, 2007 4:34:10 PM]
You heard C# outperforms Java? Hmm, I am curious to know where you heard that. I might agree that portions of Winforms outperforms swing, but as for "basic" code, number crunching, iterations, etc., I highly doubt this is true. For game development, I have personal experience. I have coded games in both languages, but I am now mainly sticking to java, simply because it became too much of a hassle to create anything decent and fast enough in C#. Try using your unsafe blocks and pixel manipulation in C#. It was a mess. Of course I should point out I am no C# wizard. However, I took some code I had, more specifically a particle shower (part of a larger demo), and handed it to some people that really are good at C#; I wanted it tuned because it performed so poorly. They tuned it all they could, and it performed quite well afterwards. However, it was still a good 30-40 fps slower than my java version.

Of course, this is all a subjective opinion, and this is the java forum, so take it all in with a grain of salt ;)
Development blog, The Omega Sector -- http://www.omegasector.org
Ok, I want to point a few things out before you make the switch...

First off, if your planning on going into programming in the near future (for work), I would HIGHLY recommend C# over java. C# is a MUCH more marketable language, trust me, because it works with ASP.NET (tons of work available), there are loads of new .NET software jobs, amoung other things

In addition, if your building a bigger game, C# would be a great canidate still. Linux is coming a long way fast, as is Mono. By the time your game is done, Mono will (actualy i think it already is) come prepackaged on most prebundled distros. And I think within 2 years mono will no longer be a hassel in the least to install.
Quote:Original post by Leo28C
* Is there anything similar to C# 2.0 generics or even ArrayLists? (a.k.a. dynamic arrays)
* Does it have some sort of API for asynchronous networking? (Very important)


One thing you will quickly learn is Java has EVERYTHING you could ever want in its API. The answer to all these questions is a resounding "yes!" and then some.

Quote:Original post by PaulCesar
First off, if your planning on going into programming in the near future (for work), I would HIGHLY recommend C# over java. C# is a MUCH more marketable language, trust me, because it works with ASP.NET (tons of work available), there are loads of new .NET software jobs, amoung other things


That is the biggest bunch of bull I have ever seen. Java is the choice for over half the enterprise computing environments out there. There is no doubt that C# or VB is preferred for a Windows desktop application, but that is a small world compared to business apps. I would highly recommend to learn both so you are more marketable than someone who is closed minded enough to stick to a single language.
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
I second CaptainJester. We have both a .net and a java department in the company I work for, and I am one out of 3, from a total of 150, that is hired on projects on both platforms.
Development blog, The Omega Sector -- http://www.omegasector.org
Quote:Original post by PaulCesar
First off, if your planning on going into programming in the near future (for work), I would HIGHLY recommend C# over java. C# is a MUCH more marketable language, trust me, because it works with ASP.NET (tons of work available), there are loads of new .NET software jobs, amoung other things

Trust you, why? Do you have any numbers to back up that ridiculous assertion? Search the job postings and you will find Java positions still outnumbering C# jobs. I don't have anything against C#, but saying it's MUCH more marketable than Java is just plain wrong.
From Monster.com search:
State   C#   JavaNY     671   1375CA     904   2354IL     369   936
Hm. Guess I'll practice with both then. Thanks all for your posts! You all get a free homemade cookie! ;-)
First thing java and c# are very similar. c# is Microsoft attempt to make a true oop language, Microsoft took all the thinks they liked from Java and c++ and mixed them together. C# syntactically is more kinda of a middle ground between the two. Some differences are c# has operator overloading where Java does not. C# also has something called delagates which are very similar to a collection class for function pointers. Besides those differences they are pretty much very similar. As far as gaming goes i would have to say c# holds the title because of xna(just becuase i use it), but if your going to use something like sdl or opengl then there are really know performance gains from using one language over the other. The real performance gains are understanding how to write efficient code. Java and C# are both very good languages and it there would definitely be an advantage from learning them both.

This topic is closed to new replies.

Advertisement