Java vs C# - Experts points of view

Started by
28 comments, last by fraka3000 11 years, 9 months ago
The matter of the fact is that you need to learn a language and the best one to pick is the one you are most comfortable with, which in your case is C# as you know a little of it already. Learn the language well enough so that you can tackle any problem in it, this will give you the wanted skills (algorithm design, design principles, oop structure and data structures) to move on to any other language. Sadly enough programming is a skill you have to learn through doing it is not something you can pick up from reading books, books however can provide you with insights in how to solve problems.

I jumped languages quite a bit in the beginning, I started of in Pascal moved to Delphi Pascal, then to C# and Java and eventually to C++. Nowadays I am most comfortable in C++ and C#. I never got how stuff worked until I forced myself to learn C++ and all of a sudden I could program in all these other languages as well. My point is stick with a language until you can actually write a non trivial program then switch to another language if you want to.

Frameworks are handy but you don't need to learn them inside out as long as you get a good grasp of how they work you can get a long with any of them, just turns out to be a question of finding out what they are called in the other framework. This also brings me to the final point once you start working you have to most likely get used to another framework which is the codebase everyone in the job works in, and that is the most important thing in programming be willing to always keep learning and adapting to a new thing.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

Advertisement

This is taken out of context. If you re-read, you'll see that I said that Java's relative popularity will decrease faster than C#'s.

Look, english isn't my native language, i thought this sentence was kind of a sidenote.


This is entirely incorrect. The .NET windowing API is closer to windows, meaning less adaptation overhead (maybe). That's the standard library, not the runtime. Java could've made (essentially) the same windowing API to get the same level of overhead.

.NET has the same sort of runtime optimizations (except on system types, which are pre-compiled in Microsoft's implementation).

I never wrote runtime, i meant the .NET Framework in general. My statement was inaccurate, i agree. I don't know enough about the integration of the .Net Framework in the OS as I'd like, so I didn't make a more specific statement. I would be supprised if Windows handles .Net just as an other Userlibrary, but like I said, I don't know as much about it as id' like.


.NET has the same sort of runtime optimizations (except on system types, which are pre-compiled in Microsoft's implementation).

I'm currently studying, so you naturally just hear about the java one. I thought Java's implementation was superior. Do Java and C# use similar algorithms?


Quit spreading misinformation.

[color=#ff0000][removed insult], i never claimed to know everything, nor to be infallable. If something i wrote was wrong or inaccurate, tell me. But don't be so butthurt about it.
I know this is the web, but grow up.
Project: Project
Setting fire to these damn cows one entry at a time!

I'm a beginner programmer with very basic knowledge of C# and I see that thousands of others have the same doubt as me when trying to choose between those two languages. We receive answers like "language doesn't matter, learn algorithms, design principles, oop structure, etc", or "after learning java you'll jump to C# easily".

That's absolutely true. I've used them both in a professional capacity now. I don't happen to like either language all that much, but hey :)


It's not that I disagree with the above, but apart from learning the principles, structure, logic, etc, one need to get a repertoire of tools and, in fact, the language chosen may not matter that much, but the framework linked to it can take much time to be mastered.
[/quote]
Indeed it can. The Java SDK(s) and the .NET framework(s) are each rather comprehensive. But you don't need to know all of an SDK to be productive. You aren't going to sit down and read a 2000 page book on the SDK before you start writing code, are you(?). We all learn as we go.


I have read through discussions about whole teams of experienced programmers resisting the change to another framework, indicating that this is a real concern among seasoned programmers. It's not just a question of adapting to syntax.
[/quote]
Right, it matters a heck of a lot if you've got N years of infrastructure and code built up in one language. There had better be a good reason to change. This doesn't have a lot to do with syntax, merely momentum and business needs. I don't think this should be suprising or confusing(?).


Most discussions about both languages see the same repeated statements:
- if you take on C#, you marry Windows.
- No, you don't, you'll always have mono. (nothing is said about personal experience with mone though)
[/quote]
Perhaps you should try Mono. Make some benchmarks, or write a little of the kind of code you're interested in. If it works to your satisfaction, you don't have to worry. Other people's opinions are formed by their respective experiences. When you are deciding on a language/toolchain/whatever, you are ultimately responsible for the decision so if this really is important, you should be doing careful, rational experiments anyway.


- Java is "more" cross-platform.
[/quote]
In theory, no. Currently in practice, yes. The CLR is more mature than Mono at present. Whether Mono is not mature enough is something you will have to judge for yourself by trying it out. At the very least get some relatively large C# projects that claim to run on top of Mono and see how they perform and feel.


- C# is a better structured language. (this is the only point I see which seems to be uncontested in MOST debates, but again, it's not only about the languages, but about what its environment).
[/quote]
C# has the advantage of hindsight. Its generics model is much nicer than Javas, which has made a big difference in the code that I've written, at least. C# has also evolved faster meaning it has more features. We're on the cusp of seeing lambdas in Java, for example, whereas they've been in C# for quite a while. They're another thing I've found very useful.


- C# has better performance.
[/quote]
I have no real comment on this. If there are benchmarks of near-identical code running on tuned VMs, fair enough, but be careful here. Both languages (on Windows anyway) are acceptably fast for many things. Though if you really, really care about squeezing out as much performance as possible, I wouldn't choose Java or C#.


(I don't know if that is true, but the possibility of using development tools like XNA and UNITY seems to have no parallel in Java. At least, from what I was able to find, JMonkey seems to be one of the best graphical engines around for use with Java, and graphics seem rather primitive)
[/quote]
The fact that such frameworks are available in C# may be important, but I don't think this is reflection on performance. But if you're considering XNA then you clearly care less about portability. So you can therefore restrict your investigation to seeing which runs best on Windows. Is this the case?


- Others just talk about very specific details, like GC efficiency, etc.
[/quote]
As far as I know, the JVM GC is more configurable and I suspect somewhat more mature, but that's something your benchmarks and investigations can uncover. Again, they're both acceptably fast for many applications. Probably acceptably fast for yours if you're just starting.


Synthesizing, much of what is said seem like myths, uninformed points of view, fanboy talk or biased propaganda.
[/quote]
Yes, this is why I would encourage you to do your own experiments. Get some numbers you can trust.


I've even read a recent article which presumed itself very scientifically focused stating that C# has already had it best moment, but would soon fall into oblivion.
[/quote]
Some have been saying the same about Java for a long time now. Visual Basic is also still with us. Lisp is being revitalised by Clojure. Nobody can predict these things reliably.


To guide those that are beginning and that, differently from expert programmers, are concerned with what will continue to be available in 3 or 4 years from now, when they finally get productive, what do you consider to be the future of C# and Java?
[/quote]
In 3 years time, you may well know both Java and C# and you'll be one of the people saying "it doesn't really matter, your skills are largely transferrable between the two".


What does Android java code translation, Mono, ISO standardization really mean in terms of tendencies?
[/quote]
Tendencies?


I would like to listen to informed point of views. Analysis by those that really know about what they are talking about, not fanboy talks and propaganda.
[/quote]
That would be nice, but I don't think it can realistically happen to the degree you want. Once a person or company has picked a language/framework/etc, they'll tend to stick with it. You know what you'll be using the language for, and the choice seems to matter to you a heck of a lot given the kinds of questions you're asking. If that really is the case (though in reality I suspect you're worrying a little too much), the final decision has to be based on metrics and evidence from your own tests.

The first thing you need to decide is what platforms you are genuinely targeting. If you don't have a Linux machine, or a Mac (etc) for testing, you aren't realistically going to writing code to run on them. So the whole question of Mono's quality can be completely ignored.

Similarly, the framework(s) you might want to use (Unity, XNA, etc) might limit the platforms available for selection.

If you want to sell what you create, phones will likely be your biggest market these days, meaning Android/Dalvik and/or iOS/Objective-C, again limiting your selection.

Once you've answered these questions, you'll probably be left with a single option anyway...

FWIW, C# is more fun.
A better analogy for programming languages might be toolboxes, not tools.

Pretty much any carpenters' toolbox contains most of the tools a carpenter needs; however, some assortments are better for some jobs and most carpenters have a favorite assortment of tools.
I really must thank everyone here for their points of view. It seems that I have given the impression of being overly concerned about my choice, to the point of staying frozen. I would only want to say that this isn't true. I keep going on with C#, but meanwhile, I want to keep getting informed in a subject that is still not clear enough. It's true that, as time passes, I'll probably approach the point Edd stated: In 3 years time, you may well know both Java and C# and you'll be one of the people saying "it doesn't really matter, your skills are largely transferrable between the two". Yet, I think it's the natural beginners anxiety, when exposed to a huge information flow from a competitive and fluid field of knowledge full of propaganda statements.
I know that completely unbiased opinions are very difficult to get. Even here, we can have the impression of C# being a little favored, but the important thing is that I was able to get some very useful information by people who seem to have enough knowledge to make a good analysis and for that I thank you.
Edd, I think that "tendencies" wasn't a good choice of word (it's more of a literal translation from portuguese); "trend", perhaps, would be better. Or, in the used context, "inclination of C# towards being cross-platform". I hope I'm expressing myself better now.
From a user's point of view, Java pisses me off.

Many IDEs and command line tools I use daily are based on Eclipse (which runs on Java). With large projects, you always run into the default memory limit. You google the error and go change the command line settings or config file to manually specify a larger memory limit. .Net doesn't have that, at least in windows. You run out of memory when the process or operating system limit is hit.

Almost all of the Flash-related tools use Java:
Flash Pro
Flash Builder
MXMLC (compiles actionscript, flex, mxml projects)

Working on any large project involving a Java-based IDE inevitably runs into their artificial memory ceiling. I've never run into a single .Net app that has this kind of annoyance.



Cross-platform toolchain automation is a hassle with Java compared to .Net. Spawn a process and then get its process ID. You can't do this in Java. You can in .Net and Mono.


Mike's post above about Java's windows installer wanting to install toolbars was seriously the last straw for me. What is this, a startup company trying to get quick ad revenue? NO. IT'S ORACLE. Stop being douchebags, Oracle!

Many IDEs and command line tools I use daily are based on Eclipse (which runs on Java). With large projects, you always run into the default memory limit. You google the error and go change the command line settings or config file to manually specify a larger memory limit.


Eclipse is a crappy IDE. I still have no idea why a lot of people are supporting and using it, as if it's the only Java IDE. I open my project, Eclipse complains 100+ errors. Close project. Close Eclipse. Reopen Eclipse. Reopen project. Errors are gone! wtf?

I have been using IntelliJ, personally and professionally, and I couldn't be any more happier. Intuitive shortcuts (i.e. Ctrl + / to toggle comments!), great refactoring tools, syntax highlighter, seamless versioning integration, even more than what Visual Studio comes with. It has the free community edition too.
Netbeans was also nice when I had to do Java. Similar to visual studio in a number of ways (for better or worse).

From a user's point of view, Java pisses me off.


I totally agree, and that is why I've moved on to C# personally.

The main difference between the two in my opinion is the fact that Sun REALLY tries to keep you from shooting yourself in the foot. Notice the lack of unsafe code usage like pointers as well the (in my opinion) crappy reflection and you can probably see what I mean. Due to this very fact, if you want to transition to C++ later I would recommend moving to (or just starting out with) C# at some point to learn the more advanced constructs in a more 'C like' environment (plus C# has more overlapping features with C++ than Java does). I've been doing C# for about 2 years now and the transition to C++ took almost no time at all. Sure I'm no expert, but I could jump in with some tutorials and learn the ropes without feeling intimidated or overwhelmed, and now I'm making applications with little outside help.

My friends and I also think that Java was created by narcissistic programmers... JFrame, JDBC, JPA everything starts with a damn J and it almost seems like they're trying to trademark their APIs.


I've even read a recent article which presumed itself very scientifically focused stating that C# has already had it best moment, but would soon fall into oblivion.


I honestly don't believe that C# is going to die, but .Net probably will. C# is a wonderful, modern language with nice syntax and powerful features, and it would be a shame if another group doesn't pop up to maintain a multi platform version that is similar to Oracle. That's probably the reason why Java has been around so long, really.

[quote name='e?dd' timestamp='1342708314' post='4960949']
I've even read a recent article which presumed itself very scientifically focused stating that C# has already had it best moment, but would soon fall into oblivion.


I honestly don't believe that C# is going to die, [...]
[/quote]
FYI, your quoting seems to have gone funny, there.

This topic is closed to new replies.

Advertisement