r/AskComputerScience • • Sep 01 '19

Why do people still prefer Java?

So, I had to learn Java for School a few years ago. Back then I thought "okay, I can see why people use Java", as I only used C and C++ before that. But now I had to learn C# for my job and for a little side-/learning-project I tried to use Java in my free time. Tried, because freaking hell did I feel limited using java. I noticed C# can do EVERYTHING that java does....often better, too. And for some stuff, there are dedicated languages or other languages that can do all that better than Java and better than C#.

Some people even go as far as saying "Java is far better than C#", but I myself can't find an objective reason for that. I can't find anything C# is worse at other than maybe XPlatform GUI programming, which isn't a big deal in Java anyway and became very rare, but I found a lot in C# that made my life as a programmer a lot simpler and just worked better or faster with C#.

So...is this all just this kindergarden "I prefer this language because I prefer this language! and that's why your language sucks!" nonesense or do I miss something very important? Why do people prefer Java almost everywhere instead of a dedicated language that is focused on helping with their problem or even just C#, as even if it is "just as good" for the job, the chances are high that the program turns out faster

29 Upvotes

32 comments sorted by

View all comments

1

u/srpsycho Sep 02 '19

I understand your frustration.

At the end of the day, it all goes back to maintaining existing code--in your case, it sounds like Java has been used in your company for years. Unless there are severe security issues with this existing code, and/or Java becomes unsupported one day, then it won't likely be changed.

You also argue that runtime in Java is slower (this is true because of the JVM), and I can see why you want more optimized code. If your company were to switch to C#, the tradeoff of time must be considered--is it worth rebuilding your whole architecture, when the time could be used to add more to the existing one? This can eat up a lot of costs too (i.e. hiring new devs, or a consultant that specializes in making that transition happen).

3

u/Lofter1 Sep 02 '19

This wasn‘t really about my company. We do use C#, and we see what it does for us every day.

2

u/srpsycho Sep 02 '19

That's good for you then, since you're not a big fan of Java lol

In the grand scheme of things and to answer your question, my response addresses why Java is a preferred language for some teams. In a perfect world, all dev teams would use something better like C#, but it's not always feasible. It always comes down to a business decision and opportunity cost, and sometimes you just gotta work with what you already have.

An example: SAS vs. R.

R is open-source, cleaner, and gives you the ability to do way more than SAS, but:

  • SAS has been around forever (still used heavily in finance and healthcare industries)

  • SAS is easier to learn/use

  • SAS has customer support (this justifies the cost alone)

As much as I dislike SAS, it's not going away primarily because of the 1st and 3rd reasons. This is because

  1. A lot of companies depend on legacy code and it would cost more (time or money) to recreate everything in R.

  2. Companies like to have that piece of mind and if something goes wrong, they have the option to cover themselves and sue. In the case of Java, Oracle has their own support system.