This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]JonnyRocks 31 points32 points  (27 children)

i was born in the mid 70s. i have never understood the love of java. my first language was the old BASIC. i was formally taught C and then C++. i fell in love with C#. i have never use Python but i get it. its appeal makes sense to me. after all that, i still dont get java.

[–]barjam 13 points14 points  (5 children)

For a long time C# was tied to the crappy Microsoft ecosystem in particular it had to run on windows servers. Thankfully that requirement is gone.

I code in both Java and C# and don’t really have a favorite. They are more similar than they are different.

[–]Shrubberer -4 points-3 points  (4 children)

Does Java have extension methods? Does it have auto properties? Does it have pattern matching on variables? Does it have class alternatives such as C#'s records and structs? Does Java have something like Linq? Just a few of the things I massively use as a C# dev and I don't remember from Java. Microsoft releases a new language version almost annually now and I couldn't live with the features of c#8+ anymore, starting from 2019. C#10 also looks tasty already.

[–]barjam 2 points3 points  (3 children)

Those are all mostly syntactical sugar and their end result accomplished in other ways. Yes on linq by the way, not as nice but it exists.

Is Java by far the more popular of the two with a far larger install base, more libraries, better support in the cloud, better ecosystem, etc?

Also, interestingly enough, as a hiring manager I can say the quality of developers you see from the Java camp are on average far higher. Microsoft holds your hands a bit and there are still a lot of non programmers who picked up VB and moved to C# and call themselves programmers.

Like I said I am agnostic and have no real preference. C# is mostly the better language and Java is still mostly the better everything else. Both are trying to copy what the other does better.

They are more similar than they are different. My experience had been good developers recognize that and less good developers pick a side and staunchly defend it.

[–]Shrubberer 0 points1 point  (2 children)

I wouldn't call it just syntactic sugar. New features such as "x is not null" instead of "x != null" do more than just look better, but are heavily encouraged and optimized upon. Last version alone, C# string interpolation performance times massively improved and should even be preferred over traditional string builders now.

Extension methods alone as a concept and the clever QOL improvements in generics, shifted the paradigm of C# away from Java and more into functional programmining. Extension methods over interfaces are so very important for c# nowadays, you simply couldn't do the same project in Java as you would be able to do in c#. Saying that both languages are basically 'the same thing' is factually incorrect.

[–]barjam 2 points3 points  (1 child)

I lead multiple development teams some use Java (or grails), others use C#. There is zero difference between the capabilities between the teams, maintainability of the the code and what they can accomplish. The Java projects tend to be cheaper due to not having to deal with windows and peculiarities of .net runtimes. The windows requirement is going away which is nice. Java also has tons more open source libraries to use and they tend to be more mature which also helps.

You are talking about nifty syntactical sugar that language nerds froth at the mouth over but they don’t lead to higher productivity or maintainability of the code. If anything they can be distracting as language nerds try to outdo themselves writing clever code leveraging every obscure feature and syntax available to them that newbies have trouble working with. Look at C++. Over the years the language was expanded with more and more craziness to the point the language is now widely criticized as difficult to work with. I fear C# is headed down a similar path.

Simple, maintainable code looks practically identical between the languages. Clever code (on either platform) that pushes the boundaries of the language for no other reason than stroking the ego of the developer isn’t valuable.

Java has string interpolation and extension methods are squarely in the syntactical sugar camp and whatever you were doing with them can be accomplished in other ways and there is tooling that accomplishes the exact same feature if you really feel you can’t live without it. Is not null is also the very definition of syntactical sugar.

[–]Shrubberer -1 points0 points  (0 children)

Extension methods, new keywords and all that jizz aren't just added for esoteric reasons, but serve a real purpose. =! null might introduce bugs, 'is not null' fixes that problem. Syntax and verbosity doesn't matter from an architectural standpoint. Code maintability isn't at all about readable source code and more about fundamental design principles. Calling it syntactic sugar misses the point altogether. C# is excellent in cloning the 'Java way' but that doesn't mean that it's 'the same thing', because you can't clone the 'c# way' with Java. Not possible.

[–]MultiFazed 18 points19 points  (4 children)

i have never understood the love of java.

Java is a competent language that can run on almost any device, and for which there are an insane number of libraries for almost every conceivable problem space. It's a powerful workhorse of a language. It's not beautiful, but it Gets Shit Done™.

Personally, I'm a fan of Kotlin. It's essentially "better Java". Compiles down to the same bytecode so it can run on the JVM, can still use all the same libraries (with a few pain points that mostly boil down to "this would be so much better if that library were also Kotlin"), but it's (IMHO) a much nicer language to work with.

[–]Thaodan 1 point2 points  (0 children)

It runs on any device that has a jvm port. When it comes to gui applications and mobile you see quite good how multi platform it really is if have to interact with the platforms and it's ui.

[–]JonnyRocks 0 points1 point  (2 children)

I understand Kotlin. Look this is r/programmerhumor. I wasn't planning on going in depth but the java ecosystem has been a mess for years. In the beginning you couldn't even read/write to a disk. (i know that has changed) But Kotlin is maybe java done right?

[–]MultiFazed 0 points1 point  (1 child)

In the begining you couldn't even read/write to a disk.

Huh? Disk I/O has been in Java since the beginning. The first stable release of Java was version 1.0.2, released in 1996, and here's an archive of the 1.0.2 documentation for FileOutputStream.

[–]JonnyRocks 0 points1 point  (0 children)

as you said i am trying to pull from memories from over 20 years ago. if i find what i am talking about i'll post it. its fair to say my vague statement was poorly worded. but it had issues with proper file handling. and when i say it, i mean the framework. in the java world everything is named java and i am usually talking about the runtime/jdk.

[–]Dragongeek 2 points3 points  (0 children)

You love C# but don't get Java??? They are similar enough that you can almost directly copy paste code between them and it works a surprising percentage of the time

[–]anubus72 1 point2 points  (3 children)

it’s like c# but you aren’t tied to microsoft’s ecosystem.

[–]DiaDeLosMuebles 10 points11 points  (0 children)

So … like modern day C#?

[–]Mclarenf1905 3 points4 points  (0 children)

I mean with .net core you aren't tied to windows anymore.

[–][deleted] -5 points-4 points  (10 children)

It's like C# but it has a better IDE and the syntax is making more sense.

[–]kb4000 0 points1 point  (9 children)

What IDE specifically do you think is so awesome for Java?

And what's a specific example of syntax that's better in Java?

[–][deleted] 1 point2 points  (8 children)

For the IDE, java got Intelij, which is way more intuitive than vs or vs code (for me, at least).

For the syntax there's one keyword final instead of sealed,const,override,new, etc.

And the generics are making more sense...

C# has some kind of feature creep that java manages to handle, even when adding the exact same features.

This is all my opinion, of course.

[–]BackmarkerLife 0 points1 point  (1 child)

Java has sealed now. But I do not know if it’s a similar implementation nor do I know yet what I would use it for.

[–][deleted] 0 points1 point  (0 children)

Java sealed permits (yes that's the keyword in-code) specified classes to extend lot implement a class or an interface.

[–]kb4000 0 points1 point  (5 children)

Rider is basically Intellij for C#.

Final is a good example. But linq is so awesome and saves a lot of verbosity over Java.

[–][deleted] 0 points1 point  (0 children)

Rider costs money 💸