What language is better to learn - C# vs. Java
#1 Members - Reputation: 277
Posted 08 October 2012 - 08:49 PM
I'm a rather experienced DarkBASIC user who is currently trying to learn new, more versatile languages. I've dabbled in everything from Python to C++ and everything in-between but haven't officially started learning much of anything from them yet. I can't decide which is better to learn.
I'm quite interested in multi-platform development, so naturally Java seems to be the better route to go, but I'm also aware that the MonoDevelop project allows .Net code to run across all platforms these days, so C# sees a safe bet as well. What's your personal opinion?
Personally, I think C# looks a little friendlier, and in Unity it makes a lot more sense for scripting, but I'm also interested in general applications as well. Should I just learn both?
Thanks for any insight!
-This message brought to you by YodamanJer, aka JeremyG on other forums
My Programming/Game Development Blog
Follow me on Twitter!
#2 Staff - Reputation: 9020
Posted 08 October 2012 - 09:22 PM
If you're already reasonably experienced and want to make a more informed choice you could consider trying both languages to make your own comparison. Pick a few relatively simple tasks (create a window, draw a sprite on screen, read input from a file, etc.) and try to do them with both languages. You'll then have a better idea of your own personal experience and opinion with each.
Personally given the choice of those two languages I would choose C# -- a few design decisions in Java and it's accompanying libraries put me off of it a bit.
I'd say your best bet is to try both!
Hope that helps!
- Jason Astle-Adams.
From my blog: 20 ways to advertise your game | What next? Intermediate to advanced C++
How to make games WITHOUT programming | 4 reasons you aren't a successful indie developer
#3 Members - Reputation: 492
Posted 09 October 2012 - 12:02 AM
openwar - the real-time tactical war-game platform
#4 Members - Reputation: 3822
Posted 09 October 2012 - 12:31 AM
The voices in my head may not be real, but they have some good ideas!
#5 Members - Reputation: 568
Posted 09 October 2012 - 08:17 AM
Personally, I'd go with C# just for the fact it's a heck a lot easier to interop with native code. And you have a finer control over memory, e.g. structs, unsafe code, etc.
FYI, whatever you choose...for Java - jMonkeyEngine, Ardor3D are two of the more well known graphics engines out there, and LWJGL for a good OpenGL binding.
Edited by Starnick, 09 October 2012 - 08:18 AM.
Starnick
Tesla Graphics Engine | AssimpNet | DevILNet |
#6 Members - Reputation: 521
Posted 09 October 2012 - 09:57 AM
However you can use C# with Unity and XNA, they both increase portability, which probably is not possible through language itself.
It depends what kind of portability you're looking for. If you wish to create apps for phones you can use C++ with some library (or w/e it's called), for example Marmalade, or create own one: create small Java (Android) or Objectivec (iOS) program that would run your C++ program and there you go, it's portable (my friend does this at his work).
#7 Members - Reputation: 277
Posted 09 October 2012 - 03:36 PM
It depends what kind of portability you're looking for.
Well, I'm not really looking into mobile options yet (though I do plan to develop for WP8+ and Android, eventually), I was just talking about desktop platforms.
...language-wise they are similar enough that learning one and you will cover 90-95% of the other.
Yeah, I had heard this previously from other places, and sort of experienced it when I tried out coding in Java after studying C# for a day sometime ago. There were still quite a few differences, but it was just syntax - the basic structure seemed to be completely the same.
Thanks for your input, everyone! Sounds like C# is the way to go for now.
-This message brought to you by YodamanJer, aka JeremyG on other forums
My Programming/Game Development Blog
Follow me on Twitter!
#8 Members - Reputation: 128
Posted 09 October 2012 - 08:07 PM
#9 Members - Reputation: 186
Posted 10 October 2012 - 01:20 PM
http://msdn.microsoft.com/en-us/library/s1ax56ch.aspx - Value types vs. reference types
http://msdn.microsoft.com/en-us/library/dd264739.aspx - Named and optional arguments
http://msdn.microsoft.com/en-us/library/8627sbea.aspx - Built-in events
http://msdn.microsoft.com/en-us/library/bb397687.aspx - Lambda expressions
http://msdn.microsoft.com/en-us/library/d5x73970.aspx - Value types allowed as generic parameters; generic constraints
http://msdn.microsoft.com/en-us/library/ee207183.aspx - Co/contravariance
http://msdn.microsoft.com/en-us/library/ms173171.aspx - Delegates
http://msdn.microsoft.com/en-us/library/9fkccyh4.aspx - Methods are not overridable by default
http://msdn.microsoft.com/en-us/library/e59b22c5.aspx - Better interop support with unmanaged code
http://msdn.microsoft.com/en-us/library/y31yhkeb.aspx - Pointers
http://msdn.microsoft.com/en-us/library/x9fsa0sw.aspx - Properties (getters/setters)
http://msdn.microsoft.com/en-us/library/8edha89s.aspx - Operator overloading
http://msdn.microsoft.com/en-us/library/hh156513.aspx - 'async' methods
http://msdn.microsoft.com/en-us/library/ms229005.aspx - More flexible exception throwing*
http://msdn.microsoft.com/en-us/library/5cyb68cy.aspx - Ability to allocate memory not managed by the GC
http://msdn.microsoft.com/en-us/library/system.io.aspx - Standard IO library that is not complicated and overly verbose
================================================================================
* adding 'throws' to a method in Java requires snowballing changes to all methods that make use of that method, which requires changes to those methods, etc...
http://hexus.net/mobile/news/android/38789-google-android-ported-java-c-blazing/
Also, Java being more portable than C# is partially incorrect. Through Mono, you can compile C# code for a huge variety of platforms including Linux, Mac, PS3, and loads more I can't remember.
The only problem with C# is that we'll never know if it ends up being a microsoft patent trap.
#11 Members - Reputation: 3371
Posted 10 October 2012 - 06:20 PM
That's wrong cos Java offers checked and unchecked exceptions.
But its standard library uses checked exceptions, requiring you in turn to check them.
What feature doesn't Java possess??
It doesn't allow co and contravariance in its generic definitions. You cannot make a generic class that supports T (and subtypes) or T (and super types). It's T or nothing.
#12 Members - Reputation: 307
Posted 11 October 2012 - 08:21 AM
It uses both.But its standard library uses checked exceptions, requiring you in turn to check them.
For example:
· collections use unchecked exceptions
· IO classes use checked IOException
I think the criteria used is, in general:
· when the problem arises because of a programming error an unchecked exception is thrown
(for example IndexOutOfBoundsException)
· when the problem is not a consequence of a programming error, but can be reasonably treated, a checked exception is thrown
(for example FileNotFoundException)
· when the problem is not a consequence of a programming error, but can not be reasonably treated, an Error is thrown (unchecked)
(for example OutOfMemoryError)
Java allows code like this:[Java] doesn't allow co and contravariance in its generic definitions. You cannot make a generic class that supports T (and subtypes) or T (and super types). It's T or nothing.
[source lang="java"]class Geometry {}class Shape extends Geometry {}class Circle extends Shape {}...List<? extends Shape> covarList = new ArrayList<Circle>();List<? super Shape> contravarList = new ArrayList<Geometry>();[/source]
and also
[source lang="java"]class X<T extends Base> {}[/source]
however the next is forbidden
[source lang="java"]class X<T super Child> {}[/source]
Edited by ppgamedev, 11 October 2012 - 08:25 AM.
#13 Members - Reputation: 56
Posted 12 October 2012 - 08:18 AM
JAVA is typeless language, thus it lucks a real pile of things. Every time I code in Java I feel like if Java was raping me. I have a big respect to people that compile functional aplications upon Java.
#14 Members - Reputation: 277
Posted 12 October 2012 - 09:00 AM
-This message brought to you by YodamanJer, aka JeremyG on other forums
My Programming/Game Development Blog
Follow me on Twitter!
#15 Members - Reputation: 56
Posted 12 October 2012 - 10:13 PM
#16 Members - Reputation: 148
Posted 14 October 2012 - 11:48 PM
Edited by Runesabre, 15 October 2012 - 12:08 AM.
Runesabre Online
#17 Members - Reputation: 492
Posted 15 October 2012 - 12:59 AM
do not aproach C# witho out managing c++ theory. It may seem an object all things safe, but do not be fooled, the fact that compiler hides management from you may be benefitial also not. especiaily object competence. A C# ot Java progamer must now fundamentals of c++
If you want to be really good, yes, you should learn about c++ and its type oriented meta programming model (and how it is very different from C# generics). You should also learn deep and pure functional programming, to be able to write really sharp C# code.
On the other hand, IMHO, starting out with just plain and simple C# is a much better approach to get you going.
openwar - the real-time tactical war-game platform
#18 Members - Reputation: 1474
Posted 19 October 2012 - 06:47 PM
If you can use the Visual Studio IDE and later cross-platform port the game through Mono, then that would be better long term. I believe that MS knows this and is why they let the Mono community do their thing.
Look at SharpDevelop and SharpDX, which could potentially also be ported cross-platform through Mono if you find Mono to be better for you.
The main Unity 3D/ Mono community and several sprout communities are really rockin' in C# big time, so take a look!
Energy is favoring C#, in my opinion - for learners, but Java has gigantic libraries and active cross-platform gaming communities. The growth of Apple systems could mean a big surge in Java use for games in coming years, added to other companies with tablet and mobile needs for Java games.
Do more research, please, and let us know what framework and other things which you decide to use, okay?
Clinton
#19 Members - Reputation: 551
Posted 19 October 2012 - 08:29 PM
From what I've seen C# is faster, and I think it's a much cleaner and more elegant language. To me, writing C# almost feels like you're painting a picture or playing music -- it's like an art lol, whereas C and C++ are like running a power tool... but I've just never cared for Java.
CEO & Lead Developer at ATCWARE™
"Project X-1"; a 100% managed, platform-agnostic game & simulation engine
Please visit our new forums and help us test them and break the ice!
___________________________________________________________________________________






