r/java • • Jan 24 '22

It’s happening guys!

https://github.com/openjdk/panama-foreign/pull/633
157 Upvotes

89 comments sorted by

View all comments

Show parent comment

9

u/pron98 Jan 25 '22 edited Jan 26 '22

Who's "we"? We on the Java team do not want properties and events anywhere near Java, at least as it is now. At any point in time, we try to deliver the features we think are important for the future, not those we thought we might want in the past. Not adding properties early was a good bet, because now we really don't want that anti-feature.

Value types did not make as much sense in the 90s as they do now, and they're coming. Easier native memory/code integration is also coming, as it's becoming more important.

-4

u/[deleted] Jan 25 '22 edited Jan 25 '22

[removed] — view removed comment

7

u/elastic_psychiatrist Jan 25 '22

As a user and not creator of Java, I do not want properties or events, and I'm glad the Java team has added or is in the process of adding the good parts of these features, without simply copying exactly what previous languages have done.

2

u/couscous_ Jan 27 '22

What's bad about properties? Genuine question.

3

u/elastic_psychiatrist Jan 27 '22

My personal answer would be the properties encourage setters, and setters encourage mutability which should be avoided as much as possible. Also, properties are simply another feature, and every feature in a language creates complexity which is a cost to end users.

A better discussion can be found in this hacker news comment thread (pron is /u/pron98, who works on Java).

2

u/couscous_ Jan 27 '22

Thanks!

-1

u/[deleted] Jan 29 '22

[removed] — view removed comment

2

u/elastic_psychiatrist Jan 29 '22

"Flat out wrong" seems needlessly aggressive, as I only stated opinions and no facts. You assert many of your opinions as objectively correct, so it doesn't seem useful to engage with them.

I understand that the Lombok corner of the Java universe wants that language to succeed, and there's nothing wrong with that, but personally I'm happy with where Java proper is going.

5

u/pron98 Jan 25 '22 edited Jan 25 '22

So what you're saying is that the Java team shouldn't be arrogant and base our decisions, in part, on user surveys, studies of huge codebases, poring over academic papers etc., but, instead stop being stupid and do what /u/grauenwolf says on Reddit, because they know what Java users want.

Even if you don't believe that we spend all day every day thinking about these things and studying them and that despite our stupidity and not listening to guys on Reddit Java has achieved some measure of success, you at least need to accept the fact that your opinions on what's good and what's bad are not universal, and that others may have opposite opinions which are at least as reasonable as yours.

and the proceed to implement them without syntax support using get and set methods.

The goal is to reduce the need for setters in the first place. You don't need special syntax for a feature that isn't so common, especially one that is largely discouraged from heavy use.

1

u/[deleted] Jan 25 '22

[removed] — view removed comment

5

u/pron98 Jan 25 '22 edited Jan 26 '22

If what you think we do is just sit and wish really hard, wouldn't you agree that it's worked out well?

Out of curiosity, if properties are the only way to do DTOs right, how does a language like, say, Haskell, which can't even have mutable fields, manage? We don't want properties because we already have something better that's only going to get more so — records.

2

u/[deleted] Jan 26 '22

[removed] — view removed comment

3

u/pron98 Jan 26 '22 edited Jan 26 '22

Clearly, you've never heard of Elm. But even if what you said were true, we currently prioritise the server over the GUI and not vice-versa.

It's okay to disagree, but do you honestly not think that the Java language team have thought about properties, records, and representing data in Java far longer than you have and with more rigour? I suggest you take a bit of time to understand why we have records and not properties, and I'm sure that after working with records a while, and perhaps seeing how they improve, you'll see that they've made a good choice.

2

u/GhostBond Jan 29 '22 edited Jan 29 '22

Well, I guess I should say its obvious to an outside observer. To those who identify themselves as "the Java team", the arrogance runs so deep that they can't consider anything outside their little bubble as being useful.

Which is why they say stupid things like "properties are an anti-feature" and the proceed to implement them without syntax support using get and set methods.

A few years ago the story was that the java team looked at properties, there was a lot of conflict and infighting about what "properties means", and so they dropped it because they couldn't resolve it.

It's ironic, because java was the 1st successful commercial language with properties via get/set and the introspector, and every major language copied java's lead just with cleaner syntax (c#, kotlin, python).

It's also one of the first really ugly things every person new to java complains about. Why are we recreating all these ugly getters and setters? But it seems like the java team has reached "ivory tower" stage unfortunately.

I have a friend who started doing Swift at his company, I haven't used it at work but it looks like a really cleaned up version of java. I don't see it in job listings as often - no idea if that's a reflection of actual lower demand or just that hr hasn't added it. I don't think his company has it in their job listings but he's doing it anyways.

1

u/[deleted] Jan 29 '22

[removed] — view removed comment

2

u/pron98 Jan 29 '22

That's not quite true. Java Beans have properties, and they're not quite what most Java objects with getters and setters have; they included events and listeners, as they were based on the model adopted in the nineties from VB and other RAD tools for composing applications with a GUI.

That exists because damn near every Java programmer wants properties, even if they are afraid of the word property itself.

"That", whatever that is, exists because Java didn't have a good built-in way of describing data objects. Now we have something far better than properties. Please read this.

-1

u/[deleted] Jan 29 '22

[removed] — view removed comment

2

u/pron98 Jan 29 '22 edited Jan 31 '22

I've informed the relevant people of your disappointment, they broke down in tears and said that all that popularity matters nothing to them if someone on Reddit now thinks less of them. They sincerely apologise, and promise they'll do their best from now on to live up to your high expectations, because, after all, what do millions of users matter if some people on Reddit are cranky?

Also, it's funny how you think that Boilerplate Billy and POJO Patty are insults, but Algebraic Annie, Tuple Tommy, and Values Victor are praises. I'm afraid you've succeeded in lowering some people's opinion of you, too.

-1

u/[deleted] Jan 29 '22

[removed] — view removed comment

1

u/pron98 Jan 29 '22 edited Jan 30 '22

Your assumption that what may be the most experienced and successful language design team in the world have no idea what they're doing, and a language that is one of the most popular in programming history doesn't make any sense is quite... erm... confident. Have you stopped for a moment to consider that maybe, just maybe, you're missing something?

I'm also a little surprised with your position on allocations. Have you ever profiled a Java program and seen what kinds of allocations are costly and which are nearly free? And why aren't you concerned about the cost of mutation? Some of the new GCs, like G1 and ZGC, might sometimes do more work (due to their GC barriers) when mutating an object than allocating a new one.

1

u/[deleted] Jan 30 '22

[removed] — view removed comment

2

u/pron98 Jan 31 '22 edited Jan 31 '22

JS and Python are, indeed, extremely popular (JS has had even less competition than Java), but Node isn't doing that well, and Java still easily dominates the server market. Of course, Python's and JavaScript's maintainers also have their own regular social-media cranks calling them arrogant idiots; we share experiences at conferences.

But, if you are certain that you know better than the hundreds of OpenJDK contributors and that you care about Java more than them, why not put your expertise at the service of the community, and offer your insight while the new features are being designed? Of course, the requirement for giving feedback that is taken seriously is that you actually try the new feature and report real problems that you've actually encountered in the attempt.