Live data from Hacker News

New language features since Java 8 to 17

advancedweb.hu

91–100 of 358 posts

Re: New language features since Java 8 to 17

#91

Earlier quoted context omitted.

I don't think this is going to happen with Brian Goetz as language architect. He refuses to add many features that would address everyday pain points such as: * null safe navigation operator * properties * mutable records * a way to ignore checked exceptions (or at least having the stream API take functional interfaces that can throw exceptions) * adding functional methods like .filter()/.map() directly to collection…

Is that true though? nullability is a area I've heard /u/pron mention may be tackled in the future, mutable records seem like they will be tackled with the 'withers' concept in the future. Checked exceptions + changing the sugar of .stream().map I don't see ever changing. Properties I am unsure of.

Why should it be in the future. The syntax of .stream() has been awfully verbose since Java 8: in the middle of “.stream()….collect(toList())”, you need to squint to find the actual function name being applied between the flood of polluting calls, which loses the appeal of functional programming.

In my company we have f(list).map(…), which is a wrapper for the streams. But newcomers don’t like it because it’s not the standard.

Re: New language features since Java 8 to 17

#93
post #44

Earlier quoted context omitted.

I must be in the minority of thinking java 7 was the last great version of Java. What I see today is a nearly different language.

Honestly, I don't see anyone using any of the new features. Oddly enough I do get asked about them in interviews.

I use the new language features all of the time. Variable type conferencing with the var keyword is incredible. The new Java 11 module system allows me to write code more safely without accidentally crossing levels of abstraction. Java 17's text blocks are a really nice enhancement. Pattern matching with switch statements makes code a little more concise, and reduces the chance of forgetting to update switch statements when a new value to an enum is added. Record classes add immutable-by-default data structures which make packages like Lombok less necessary. Pattern matching with instanceof reduces verbosity and makes code feel a little more modern -- it feels more similar to writing Swift or Rust.

I've used all of these features. They're all great.

Re: New language features since Java 8 to 17

#94
post #26

Most of which unavailable on Android Java flavour, sorry Google's J++.

Is there a reason for that?

I'd really love to get into android development, but I'm loathe to give up some of the nicer language features in Java. What version of Java is android supporting? At least 8, right?

Re: New language features since Java 8 to 17

#96

Java sucks, and should stop being taught as the defacto language in computer science curriculums. It's extremely busy and verbose. There are better OO languages out there, if the point is to teach OO. (I'm ready for this post to get downvoted into oblivion)

Could you please support your statement with reasons?

Re: New language features since Java 8 to 17

#98

Java sucks, and should stop being taught as the defacto language in computer science curriculums. It's extremely busy and verbose. There are better OO languages out there, if the point is to teach OO. (I'm ready for this post to get downvoted into oblivion)

Counterpoint: it's become a fairly multi-paradigm language at this point, and a multi-paradigm language is exactly what should be the defacto language in curriculums

Whether or not Java is the best one for this purpose is up for debate, but I think it's no longer a bad one

Re: New language features since Java 8 to 17

#99
post #44

Earlier quoted context omitted.

I must be in the minority of thinking java 7 was the last great version of Java. What I see today is a nearly different language.

I liked Java 1.4. Generics were a mess. And Java before generics was so wonderfully simple. Yes, you had to cast, but that wasn’t a big issue. My favourite language would be Java 1.4 with carefully redesigned standard library (because old standard library was not very nice).

Isn’t that almost Go? Well, before Go generics land.

Re: New language features since Java 8 to 17

#100
post #2

Unfortunately it looks like Java is going to evolve enough to take the wind out of the sails of Kotlin and Scala for most dev shops. I guess the positive take is that those improvements might not have happened without the efforts to develop better JVM languages.

Scala is fine. People understood it's not really worth it as a "better Java". Companies that choose Scala in 2021 are using either big data frameworks (where Python bindings are the most common alternative to Scala, not Java), or functional ecosystems (Typelevel, Zio). Scala 3 has taken an interesting direction and to me it seems that Odersky wants to win Python developers over rather than Java shops using Spring. Ne…

Interestingly, I have the exact opposite opinion.

Scala has been declining steadily for a decade now, and Scala 3 is going to precipitate this state of affairs by splitting the shrinking community even further.

Kotlin, on the other hand, has done nothing but grow for the past five years, no doubt helped by Google's formidable support for it. I just took a quick look at one of its Slack channels, "getting-started", and it has over 38,000 people on it. And that's just one channel among dozens more.

I don't think Java's latest additions are anywhere near threatening Kotlin's rise to dominance since Java is moving at a very slow pace, by design, while Kotlin supports some features and design directions that will never happen in Java.

Post reply on HN