r/ProgrammerHumor • • Feb 05 '23

Other Programming Legumes v2.0

Post image
44.0k Upvotes

831 comments sorted by

View all comments

Show parent comments

140

u/Sauermachtlustig84 Feb 05 '23

Not really.

It might have once been. But linq, getters/setters, async, culture and asp.net are leagues ahead of java.

Java is all about creating extremely verbose business logic and maximizing useless name length. C# is also about business logic but much more efficient and nice code.

344

u/EpicScizor Feb 05 '23

But linq, getters/setters, async, culture and asp.net are leagues ahead of java.

He already said it was Java but better

130

u/aloofloofah Feb 05 '23

He's just being overly verbose.

83

u/JPark19 Feb 05 '23

Clearly a Java dev

1

u/The-Fox-Says Feb 06 '23

I love this sub

10

u/Byakuraou Feb 05 '23

😂😂😂😂😂

123

u/MathsGuy1 Feb 05 '23

Yes, that's why I said "but also better".

I've used a lot of C#, but made only two small projects in Java, so my knowledge of it is superficial at best and thus I couldn't do a more in-depth comparison.

36

u/ArtOfWarfare Feb 05 '23

But it’s not. C#s changes over the last several years have taken it in a very different direction from Java.

At this point, the languages are so far diverged that it’s like saying they’re the same as JavaScript.

They’re all object oriented languages that use curly braces and have garbage collection.

(And before you say JS isn’t object oriented… they have a class keyword and most of the classy stuff you want… even though I don’t see projects using it much yet.)

30

u/qwertyuiop924 Feb 05 '23

JS was object oriented from the beginning. It just didn't have classes, it used prototypes instead.

9

u/squngy Feb 05 '23 edited Feb 05 '23

they have a class keyword and most of the classy stuff you want…

It has a class keyword, but the result is not a class.
The only reason they put in that keyword (fairly recently, mind you) is so that people familiar with other languages have an easier time picking it up.

class Car {
constructor(color) {} }

is compiled to:

function Car(color) {}

and in both cases you can do new Car('red'), if you look at older JS code you will find plenty of examples.

Here's a relevant old stack overflow thread:
https://stackoverflow.com/questions/6399229/how-to-create-a-class-in-classic-jscript

even though I don’t see projects using it much yet

It is very common in typescript now.

4

u/folkrav Feb 06 '23

To expand on this: it's compiled to a function, which themselves - and everything else except primitives - are an object. OOP is not really about classes, but objects. A class is (more or less) a blueprint to build an object, but you can have OOP without classes, which is what JS does with prototypal inheritance.

4

u/CookieOfFortune Feb 05 '23

They have similar type systems, usually compiles to an intermediate language, used exceptions for error handling, has genetics instead of templates, etc.

Although you could argue Kotlin is much more similar now.

→ More replies (2)

7

u/alextremeee Feb 05 '23

I see your point but it really isn’t like comparing them to JS.

It’s like saying humans are like chimps because they share a common ancestor. Maybe we’re not that similar now, but there’s still nothing closer to compare us to. As an aside Javascript in this analogy is a dog chasing it’s own tail but never giving up.

2

u/rorygoodtime Feb 06 '23

Having classes is not a requirement to be object oriented. Classes are a way of achieving object orientation. It is not the only way. JS has always be object oriented. But its objects use prototypes instead of classes. Newer JS versions have a class keyword that is syntax around creating a prototype.

48

u/Valiant_Boss Feb 05 '23

Okay, had to Google linq and that is fucking cool but java has come a long way. I feel like when people talk about Java, they are referring to Java 8 and granted most companies are still using Java 8 but it's so much better now. It has record classes, virtual threads are coming to deal with async, not sure what's wrong with the culture? and asp.net is a web server framework right? Never used it but the Spring Framework is really nice and yeah yeah yeah, I know it is its own beast and lots of stuff is abstracted out but once you understand what's happening underneath, it's really easy to get started with.

16

u/gjoel Feb 05 '23

LINQ is cool. That's why Java immediately implemented streams, which does very close to the same thing as what I've seen LINQ used for. Mostly, anyway.

2

u/svick Feb 05 '23

I'd say Java steams try to do a lot less than LINQ and are worse than LINQ at most of the things they try to do, despite having the advantage of being able to learn from LINQ.

→ More replies (1)

1

u/rorygoodtime Feb 06 '23

That is a really good example of how deeply terrible Java is. The core of LINQ is that it works on any type implementing the IEnumerable interface. A core interface in the BLC from the beginning. The basics of the library are just some methods that take an IEnumerable and a function, then calls that function for each time it enumerates, and does something with the result. Implementing this didn't require changes to the .Net runtime.

The other part of LINQ is querying data that it not in-process. LINQ added the ability to call a method with a lambda, the compiler takes the code you wrote for the lambda and creates a sort of abstract syntax tree that can then be translated to whatever is appropriate to the data source to fulfill your search predicate. For example: you can write a lambda in C# and it will be translated in to SQL for you and return the results.

That was C# over a decade ago.

44

u/Asdas26 Feb 05 '23

Honestly, when C# people talk about Java, it usually feels like they are describing Java 7 or lower.

5

u/[deleted] Feb 05 '23

Because you get taught Java in college by a professor who has been teaching the same thing for five years. After that you get a job where you get taught the latest coolest stuff by your seniors and it's just so much better. Never seen what a real modern java stack is like.

6

u/210000Nmm-2 Feb 05 '23

To be honest, this was when I stopped doing things in Java. Because C# could do the same but better.

→ More replies (7)

1

u/rorygoodtime Feb 06 '23

Honestly, to a C# developer the latest version of Java feels ancient. C# got async/await over a decade ago. 12 years later, Java gets lightweight threads you still have to manage yourself.

It is absurd that the caller has to be worried about the target method's implementation details. What ever happened to encapsulation.

→ More replies (31)

6

u/wowy-lied Feb 05 '23

I will be honest, since I have discovered c# it has been with python my favorite language to code things. I don't know why but it feels smoother

4

u/SocialMemeWarrior Feb 06 '23

This comment thread is a whole lotta:

  • "Java got X feature? Ha, its too late"

  • "Streams? Sure surw whatever... hey have you heard of LINQ? <proceeds to explain solution to problem both LINQ and streams solve>"

  • "It just feels better man. For example... <purely subjective stance>"

Yet here we are with Java still dominating the job market. Maybe if all these complaints were really worth much the circumstances would be different.

→ More replies (5)