Advertisement

Learn Java or C#

Started by October 20, 2015 10:04 PM
18 comments, last by Serapth 9 years, 1 month ago

Hello everyone,

I would first like to introduce myself in order for you to be able to answer my question.

Some time ago I started learning C++ programming. I went through most of the basics

(to be clear: variables, conditional statements, loops, functions, arrays, vectors, pointers, classes,

inheritance, dynamic memory and template programming). I learned C++ to start making games, but

yet I think it is more wise to start with something else, while I'm very interested in some other development topics as well.

I want to learn a new language for that, but I just can't decide.

I am interested in making two types of things:

-Desktop applications (GUI's; I will call them that from now on to prevent confusion)

-Mobile Applications

I did some research and found out that making GUI's for Windows (my target platform) is the easiest with

C# and .net. So in that sight, I would start learning that, but, on the other side is Java good for programming mobile applications.

In the end I want to learn both languages, but first I would like to make some things with the first of the two that I learn.

1. My first interest is making desktop applications, so my first question is: is Java good for making desktop applications as well? (then I don't need to make a very hard choice between mobile and desktop).

2. Is one easier to learn than the other for someone with programming experience (in C++)

3. Are the average mobile Andoird apps more profitable (financial) than GUI's for desktop (my main interest is just to make something nice and usefull and learn from that, but if one is maybe a little more profitable (due to advertisement for example) than the other then the choice is a bit more easy)

4. What is a good resource (I prefer books) to learn the language you advise? (A resource meant for someone who has former programming knowledge: for example, not a book that spends a huge amount of pages on the theory behind variables.)

I hope everything is clear, otherwise I would like to hear it.

Many thanks in advance

is Java good for making desktop applications as well?

Long story short: Yes. Java is incredibly widespread! If you're after those really really niché advantages, then the nature of the JVM and garbage collection may hold you back a tiny bit (If you're learning, you almost certainly won't notice it).

Is one easier to learn than the other for someone with programming experience (in C++)

You have covered alot of the basics of C++, so both C# and Java will be relatively easy to jump into. Syntax-wise, all three languages are similar. Although if I had to make a decision, I would say that you'd be a little bit more comfortable with Java, as C#'s .NET is a bit different to standard C++. I highly doubt you'll find either language far harder than the other.

Are the average mobile Andoird apps more profitable (financial) than GUI's for desktop (my main interest is just to make something nice and usefull and learn from that, but if one is maybe a little more profitable (due to advertisement for example) than the other then the choice is a bit more easy)

Unfortunately I'm not really in a place to answer this question with much degree of certainty. The difference wouldn't be massive, although I would say that Android apps would be easier for making a quick-buck, and could be less-risky in terms of wasted time if an app doesn't turn out well (Compared to a large desktop GUI project)

You must remember that Java is incredibly portable due to the nature of the JVM. C# is far more Windows-oriented. You must ask yourself: Are you interested in being very cross-platform? Or are you happy to stick to Windows for the majority of the time. If you want your work to be more portable, you'd probably benefit more from learning Java. C# if you're happy with Windows.

What is a good resource (I prefer books) to learn the language you advise? (A resource meant for someone who has former programming knowledge: for example, not a book that spends a huge amount of pages on the theory behind variables.)

Java has a great advantage of having a massive following. As a result, you can look at PLENTY of previous-projects and see how other people are formatting their projects. Although if you want to begin at the start (Which I recommend), I would say just to look at the documentation, experiment and find code-samples over the web.

I think I've been fairly non-biased (I'm a C++ fanboy and I love to hate Java). You won't struggle learning either languages though, if you made decent progress with the basics of C++. Good luck!

Advertisement

You must remember that Java is incredibly portable due to the nature of the JVM. C# is far more Windows-oriented. You must ask yourself: Are you interested in being very cross-platform? Or are you happy to stick to Windows for the majority of the time. If you want your work to be more portable, you'd probably benefit more from learning Java. C# if you're happy with Windows.


Your information is out of date; C# is extremely easy to use on non-Windows platforms as well. I develop games for Android and iOS using C#. I use Windows for my development OS, but most of my coworkers use OSX. We all work on the same project pretty much seamlessly.


As far as the two languages are concerned, they both have roughly the same core concepts and ideology. In most of the core language constructs there is a 1:1 mapping. I haven't used Java enough recently to know if it's adding the same kinds of things that the more recent versions of C# have added. Personally I like C# a little bit more, but I'm comfortable with both.


I develop games for Android and iOS using C#

Are you using Xamarin? I played around a bit with it earlier this year -there was some thought of building a mobile client for a product we make at work - but the licensing structure was pretty steep. It definitely looked like a slick tool, though, and I was pretty amazed at what I could get going, on both iOS and Android, in just a weekend of messing around.

I'm a C# guy, so I am a little biased, but Java and C# are pretty much equivalent. C# has some very nice bits that Java doesn't (or at least didn't, they do seem to be coming out of the Oracle acquisition hangover and making progress again). LINQ is a pretty awesome language/framework feature that I don't believe Java has a real equivalent for. I find C# properties to be nicer than Java getter/setters. And I enjoy not having to necessarily deal with the Java "one-class-one-file" thing. Java might have advantages that I'm not familiar with - I haven't done a great deal with it since the 1.6 days.

As far as third-party libraries, I think the two are about on par - both have very strong, well-established ecosystems. I'm a huge fan of NuGet on the .NET side, as it makes discovering and managing third-party dependencies. I'm not totally sure there is an equivalent for Java, but it seems like there must be.

Tooling is roughly equivalent, if you are using Visual Studio or IntelliJ. Both have free versions that are pretty capable. I wouldn't bother with Eclipse at this point, unless you are already comfortable with it.

C# is king on Windows. Building GUIs with either the old WinForms or the newer WPF designers is pretty slick. Microsoft is making efforts to expand onto other platforms, but my read on that is that it is more directed towards server applications at the moment - WinForms and WPF are pretty wrapped around Windows-specific stuff. Java does work pretty much the same on Linux and Mac, as well as Windows.

It's really a toss-up. There are really more similarities than differences, and you won't really go wrong either way.

Eric Richards

SlimDX tutorials - http://www.richardssoftware.net/

Twitter - @EricRichards22

I develop games for Android and iOS using C#


Are you using Xamarin?


We use Unity. Currently we're using IL2CPP for iOS instead of Xamarin, but have used Xamarin in the past.

For hobby projects, I make WinForms apps and class libraries (I am not up to date with WPF/XAML quite yet since I haven't felt the need yet). WinForms makes it *extremely* easy to set up Desktop GUI apps with compared to everything else I've used so far (but like stated above, WinForms itself is not supported cross-platform since Mono gave up on it due to too much under-the-hood Win32 coupling).

For cross-platform desktop tools on OSX and Windows, the only thing I've used so far are GTK# and in-editor tools in Unity. Neither are as convenient as WinForms, but they both work cross-platform. I used GTK# 4 or 5 years ago, so there are probably better options available lately.

(but like stated above, WinForms itself is not supported cross-platform since Mono gave up on it due to too much under-the-hood Win32 coupling).


When did this happen? I have enough WinForms on my out-of-the-box Ubuntu 12 Mono install to get a window and P/Invoke up an OpenGL context. mono --version says "Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.3)" I will be appalled if an upgrade in my system means I have to rewrite my cross platform code with something more complex.

(Edit: Fixed quote)

Advertisement
Honestly now days any language you choose from those two will be just fine.

I myself use C# and is what we use at work mostly. We are actually right now working on a OSX application in C# with Xamarin for a client.

But java will be just fine also. We also create java applications. I myself am a bigger fan of the C# language, but my point is really don't spend too much time over what language to use. Each has their own pros and cons.

(but like stated above, WinForms itself is not supported cross-platform since Mono gave up on it due to too much under-the-hood Win32 coupling).


When did this happen? I have enough WinForms on my out-of-the-box Ubuntu 12 Mono install to get a window and P/Invoke up an OpenGL context. mono --version says "Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.3)" I will be appalled if an upgrade in my system means I have to rewrite my cross platform code with something more complex.

(Edit: Fixed quote)


I can't remember an exact date; last I used WinForms on OSX was 4 or 5 years ago. The problem we had then was that the program would not register clicks on checkboxes while the app was on an external second monitor of an OSX laptop. Bizarre stuff like that.

A recent search for "mono WinForms" says they're working on a version 2.0, so my info was out of date. They must have reconsidered how important running WinForms apps could be.

Thanks for the help everyone.

I decided to go with C# (to use .NET) and

after that to go with Java anyway if I need to use the Android

SDK to make apps.

What is a good book for someone who knows the basics of programming

(in c++) to learn C# (and .NET if possible). With this I mean a book that doesn't

spend for example a huge amount of pages on the theory behind variables, etc,

(I saw the book Microsoft Visual C# 2013 Step by Step by John Sharp, might this be good)

Thanks.

I can't remember an exact date; last I used WinForms on OSX was 4 or 5 years ago. The problem we had then was that the program would not register clicks on checkboxes while the app was on an external second monitor of an OSX laptop. Bizarre stuff like that.

A recent search for "mono WinForms" says they're working on a version 2.0, so my info was out of date. They must have reconsidered how important running WinForms apps could be.


Thanks for following up on this. As long as what is there keeps working in the basic cases I am happy with it.

This topic is closed to new replies.

Advertisement