Jump to content

  • Log In with Google      Sign In   
  • Create Account


What language is better to learn - C# vs. 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.

  • You cannot reply to this topic
18 replies to this topic

#1 YodamanJer   Members   -  Reputation: 439

Like
0Likes
Like

Posted 08 October 2012 - 08:49 PM

Hi all!

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!

My website, featuring all kinds of geeky things! yodamanjer.com

Follow me on Twitter! @jwg1991
 


Sponsor:

#2 jbadams   Senior Staff   -  Reputation: 17725

Like
5Likes
Like

Posted 08 October 2012 - 09:22 PM

C# and Java are reasonably similar and are both popular, so either would make a viable choice. If your instinct says C# looks "friendlier" you should probably just go with that, as a large part of the choice is simply personal preference. If you're interested in Unity that's obviously also a point in favour of C#.

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! Posted Image

#3 Felix Ungman   Members   -  Reputation: 950

Like
1Likes
Like

Posted 09 October 2012 - 12:02 AM

My personal choice would be C# too, but language-wise they are similar enough that learning one and you will cover 90-95% of the other. I think that the frameworks and IDEs are more important factors than language syntax in this case.

openwar  - the real-time tactical war-game platform


#4 SimonForsman   Crossbones+   -  Reputation: 5965

Like
0Likes
Like

Posted 09 October 2012 - 12:31 AM

Not much point "learning" both at this point since they're so similar, i use both and like both for various tasks. The main advantage C# has for games is XNA and Unity, there just isn't any real competitors to those frameworks/engines in Java. (There are great libraries for Java aswell but they're not as easy to use imo)
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#5 Starnick   Members   -  Reputation: 1166

Like
0Likes
Like

Posted 09 October 2012 - 08:17 AM

I used to program in Java in school, but professionally I turned out to be a C# developer.

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.


#6 Ripiz   Members   -  Reputation: 529

Like
0Likes
Like

Posted 09 October 2012 - 09:57 AM

Java is more cross-platform than C#.
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 YodamanJer   Members   -  Reputation: 439

Like
0Likes
Like

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. :)

My website, featuring all kinds of geeky things! yodamanjer.com

Follow me on Twitter! @jwg1991
 


#8 phyitbos   Members   -  Reputation: 128

Like
0Likes
Like

Posted 09 October 2012 - 08:07 PM

My first real language that I taught myself (other than web script languages) was C#. It's still my favorite for general purpose applications. C# isn't the best for cross-platform, but if you are mostly going to write Windows applications, C# and the .NET Framework offer you more. Finally, once you know C#, Java comes secondhand, they are *very* similar.

#9 zalzane   Members   -  Reputation: 191

Like
7Likes
Like

Posted 10 October 2012 - 01:20 PM

Here's a short list of features that C# has that java doesn't. To be quite frank, C# was really designed to be a 'better' Java, and has succeded in many aspects.

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.

#10 ppgamedev   Members   -  Reputation: 311

Like
-1Likes
Like

Posted 10 October 2012 - 04:59 PM

http://msdn.microsof...y/ms229005.aspx - More flexible exception throwing

That's wrong cos Java offers checked and unchecked exceptions.

http://msdn.microsof...y/ee207183.aspx - Co/contravariance

What feature doesn't Java possess??

#11 Telastyn   Crossbones+   -  Reputation: 3726

Like
0Likes
Like

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 ppgamedev   Members   -  Reputation: 311

Like
3Likes
Like

Posted 11 October 2012 - 08:21 AM

But its standard library uses checked exceptions, requiring you in turn to check them.

It uses both.
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] 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.

Java allows code like this:
[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 JohnnyCode   Members   -  Reputation: 198

Like
-5Likes
Like

Posted 12 October 2012 - 08:18 AM

What feature doesn't Java possess??

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 YodamanJer   Members   -  Reputation: 439

Like
1Likes
Like

Posted 12 October 2012 - 09:00 AM

Interesting reads there! I have played around with both languages a bit more and have found that C# just feels better for me. I really don't know why, it just does. Java is ok, and I can definitely see using it to develop Android apps. It's not as horrid of a language as people try to make it out to be.

My website, featuring all kinds of geeky things! yodamanjer.com

Follow me on Twitter! @jwg1991
 


#15 JohnnyCode   Members   -  Reputation: 198

Like
-5Likes
Like

Posted 12 October 2012 - 10:13 PM

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++

#16 Runesabre   Members   -  Reputation: 157

Like
0Likes
Like

Posted 14 October 2012 - 11:48 PM

If your interests are focused on doing more client-side development, I would go with C#. If your interests are more focused on doing more back-end server development, I would go with Java. If you go the Java route and really want to learn back-end development, then I suggest also getting dirty with Glassfish or JBoss and start absorbing Enterprise Java concepts.

Edited by Runesabre, 15 October 2012 - 12:08 AM.

Kirk "Runesabre" Black
Enspira Online


#17 Felix Ungman   Members   -  Reputation: 950

Like
0Likes
Like

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 3Ddreamer   Crossbones+   -  Reputation: 3098

Like
0Likes
Like

Posted 19 October 2012 - 06:47 PM

Microsoft is letting the MonoDevelop and Mono development teams do their thing, at least for now, in my opinion. Almost everything you need to compile and run C# games cross-platform is in the MonoDevelop IDE. With it, you get much interface support for things such as sound, GUI, physics, and more.

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? Posted Image


Clinton

Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


#19 ATC   Members   -  Reputation: 551

Like
0Likes
Like

Posted 19 October 2012 - 08:29 PM

I always recommend C#... Now this is just my personal opinion but I say C# > Java lol...

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!
___________________________________________________________________________________




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.



PARTNERS