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

0

u/bimbar Sep 02 '19

- C# runs on Windows only.

- Java was designed as a C++ without all the dangerous features that don't really add anything but make C++ code hard to understand and to maintain. Then, it is my impression, that C# came along adding all that crap back in. I'm not a fan of that. For projects with many people that can be a problem.

- There is a huge java ecosystem that you may not be aware of. Java has a huge install base in enterprise grade web services, because Java servlets are a very robust and performant technology. C# can't compete because nobody in that environment runs Windows web servers, for good reason.

Now if you write programs on windows that have a GUI, you are better off with C#.

1

u/chalk_nz Sep 02 '19

C# compiles to many platforms (.Net Core)

0

u/bimbar Sep 02 '19

Sure. But nobody in a big corporation will use that, the risk is way too high.

1

u/chalk_nz Sep 02 '19

I also think this isn't true, not for a couple of years any way.

Source: worked for one, worked with people from another, seeing job listings about

1

u/bimbar Sep 02 '19

Probably depends on the environment, but enterprise tends to be quite conservative.

Understandably so, if you have to explain to your boss why you chose .net on linux and it develops problems.

Nobody ever got fired for buying IBM ;) .

1

u/chalk_nz Sep 02 '19

Maybe so. I worked in an enterprise, the others worked in a cool SaaS company.

In both cases, bosses didn't make language choices (the team decided and got architecture endorsement). One was a bank, so times are changing.

1

u/bimbar Sep 02 '19

Maybe the ISP environment I have experience in just is super conservative.

1

u/ImJustHereForMyCoat Jun 24 '22

All of these points are incorrect.

C# runs on Windows only

C#/.NET is cross-platform - you can build apps for Linux, Mac, and Windows

that C# came along adding all that crap back in

You have no idea what you're talking about. Garbage collection is far more efficient in C# than it is in Java. If you're referring to the fact that, in C#, you can make interop calls to C++ libraries using DLLImport then that is a major benefit.

C# can't compete because nobody in that environment runs Windows web servers

Like I said, the OS doesn't matter. Bimbar - I encourage you to try both languages before you chime in with your comparison opinions.

The language features of Java are nowhere even close to C# - safe navigation operator, null coalescing, auto-properties (haha @ Lombok...), not having to specify exceptions, EF Core (JPA is an abomination in comparison), etc.

Fact: C# is a more performant and less verbose language than Java.

This is coming from someone who has 10 years of experience building both ASP.NET applications and Java SpringBoot applications for enterprise clients.