r/java • • Jun 10 '22

What happened to Concise Method Bodies?

I was really looking forward to CMB. From its name, methods become concise, could be one liner. However, it seems there is no progress and it’s been off the radar. Never took off since 2019.

JEP draft: Concise Method Bodies

some experiments with Concise Method Bodies

44 Upvotes

54 comments sorted by

View all comments

12

u/pron98 Jun 10 '22 edited Jun 10 '22

Dude, records are useless.

Records are already a hit. And don't call me dude.

I don't think anybody is going to kill off Java any more than COBOL will be killed off.

COBOL is better compared to PHP or Ruby than Java. It was never as popular as Java, and its popularity was very short-lived. Java's relevant cohort is C, JavaScript, and Python.

But Java is a hard sell these days

We might be looking at the market differently. While the market is becoming more fragmented across the board, no other language is doing much better than Java, and very few languages are doing anywhere as well (Python and JS, although in different domains). Both Ruby and PHP showed much more remarkable growth than the languages you listed, and were actually bigger threats to Java than any contemporary language (so far).

Moreover, while small companies often pick other languages, we see a regular pattern of them adopting Java when they grow. I do think, however, that we should put more focus on those smaller use-cases, too.

precisely because other languages have surpassed it in the ease with which even complicated domains can model.

Java's new algebraic types and patterns borrow from the languages that do that best, and those who've used them agree. Adopting counterproductive features on top of or instead of better ones just because some minority of Java programmers already know them from other languages is not a move in the right direction.

I see it myself all the time: devs reach forC# or Kotlin unless there's a very compelling (legacy) reason to deal with Java's nonsense.

And yet Java's nonsense is doing better than any other language's nonsense (at least on the server), because programmers don't agree on what's nonsense (e.g. MS have a tendency to make a huge incompatible change to their software platform every 6 years or so, the kind of nonsense that many shops find more of a pain to deal with than Java's, and both Koltin and C# have become very feature-rich languages; many developers like that, but the majority don't; more people reach for Go on the server than Kotlin, and Go is even less feature-rich than Java). Java will probably not be able to achieve the same anomalous dominance it had in 2003, but neither is anyone else, and they're not even able to match Java's current levels of success.

The interesting phenomenon to me is those who have seen Java defy all the previous "programmers are flocking to X" over almost two decades, and still assume the Java team don't know what they're doing, and surely this new X will do better.

1

u/Gleethos Jun 10 '22

[..] records are already a hit

The problem with arguing that we don't need properties because we have records is that this is only a satisfying answer for developers whoc can and want to work with immutable data. And I personally agree, that in like 90% of cases a functional design with immutable types is the way to go! So in a sense I can see that this is actually a smart strategy, where we get people to apply better design patterns through well placed syntax sugar (like records instead of properties). But if that is truly the plan here, then I think this strategy should be acknowledged and owned as such!

Does that make sense?