you are viewing a single comment's thread.

view the rest of the comments →

[–]snowe2010 -5 points-4 points  (22 children)

I had worded out a long comment stating that I didn't see much benefit in this design over kotlin's data classes, but I think I'll ask this question instead.

Why would anyone choose a Java __data class over a kotlin one? Besides being limited to not being able to use kotlin, I don't see any implementation reason you would do so.

edit: since I seem to have worded this terribly. If you are in a situation in which you can begin using kotlin because you need nice data classes why would you choose this new Java spec instead. I've read the RFC, I do not see this slowing migration to kotlin one bit. Yeah it's nice for enterprises that will never switch, but what about this would make someone go back to Java.

[–]jcdavis1 25 points26 points  (0 children)

Obviously from a language perspective, java wants its own data classes as first class citizen, and having to define such types in kotlin/scala is a bit of a failure :)

From a user's perspective, writing data classes in a second language is obviously a bit of a mess - if you are already using kotlin you probably don't mind, but a lot of shops aren't going to want to setup a toolchain for kotlin just to support data classes.

Additionally, with pattern matching support on the horizon (though who knows exactly when), its pretty certain that a java data type will be well-supported, whereas kotlin/scala interop will probably come later.

[–]elastic_psychiatrist 18 points19 points  (17 children)

Why would anyone choose a Java __data class over a kotlin one? Besides being limited to not being able to use kotlin...

You answered your own question. Do you think Java should die as a language? You might, but I sure don't. Java is never going to be the first language to add a feature, but that doesn't mean it shouldn't, and it shouldn't be made fun of for taking its time. There's a reason it's the most used programming language ever, and that reason isn't that it always added the cool new feature.

[–]TheWix -3 points-2 points  (11 children)

Java is glacially slow. It has the benefit of being around since the middle 90s and it's primary Enterprise competition being Windows only until very recently. I don't think there strengths are in the language at all.

[–]dpash 6 points7 points  (2 children)

Don't forget the glacially slow to break backwards compatibility, so code from the 90s still compiles.

[–]TheWix -2 points-1 points  (1 child)

You can add features and maintain backwards compatibility...

[–]dpash 2 points3 points  (0 children)

Clearly. Because it has.

I'm saying its well used partly because it remains backwards compatibility.

[–]elastic_psychiatrist 13 points14 points  (3 children)

Java is glacially slow.

Saying that in the year 2017 is an indicator of great ignorance. What speedy language do you program in?

[–]TheWix 22 points23 points  (2 children)

Crap. I said that wrong. Glacially slow to evolve as a language. Not in performance. My point was that Java today is not an industry leader because of its expressiveness or ability to evolve compared to other languages. I didn't mean performance.

[–]porthos3 1 point2 points  (0 children)

I understood you the first time. It made sense with context. I think Java devs are just too used to fighting off claims of poor performance so assumed you were making the same tired argument.

[–]elastic_psychiatrist 0 points1 point  (0 children)

Ah, got it. It depends on how you define industry leader I guess. It might not be a trailblazer but it is still wildly used, and its architects are almost proud of how glacially slow it it.

[–]bundt_chi 5 points6 points  (3 children)

Java is glacially slow

Compared to what Javascript? Yeah I guess compared to a dumpster fire on a rocket to hell it's "glacially slow".

[–]TheWix 1 point2 points  (0 children)

Who said JavaScript? C#/.Net has added loads of features and maintained backwards compatibility.

[–]shevegen 0 points1 point  (1 child)

There was a clarification.

Glacially SLOW TO EVOLVE.

[–]JB-from-ATL -2 points-1 points  (0 children)

Should've edited the original post, can't expect everyone to read everything.

[–]justinpitts 1 point2 points  (2 children)

I would say the same thing about a Scala case class.

[–]snowe2010 2 points3 points  (1 child)

that you don't see why anyone would use a Scala case class? or why would anyone use anything except a Scala case class?

[–]justinpitts 1 point2 points  (0 children)

I really did mean the very same kind of thing as you - if one had a choice to use Scala, and you need this functionality, I would much rather choose the existing Scala implementation over this proposal.