Live data from Hacker News

New language features since Java 8 to 17

advancedweb.hu

111–120 of 358 posts

Re: New language features since Java 8 to 17

#111
post #31

Earlier quoted context omitted.

Scala and Kotlin tried to be a better Java (i.e. Algol-esque syntax). Clojure tries to be a better Lisp, an entirely different family of language. Though a good flamewar can be had on 1) Is Scala closer to Pascal 2) Is Pascal Algol-descendant

Clojure tries to be an immutable-data, copy-on-write, threadsafe by default dialect of Lisp, which none of the other Lisps do.

It’s not really copy-on-write though. That implies greater systemic performance losses than what Clojure provides, because it uses HAMTs (Hash Array Mapped Trie) internally. They enable much faster copies of immutable data than copy-on-write does.

Your other points are good ones, I just don’t want people to be put off by copy-on-write performance assumptions. You take a ~50% performance hit from choosing Clojure over Java, but the gains in dev speed, maintenance, robustness, and flexibility to changing requirements are supposed to outweigh that. Especially when you include simpler parallelization, which you covered with thread safety.

Re: New language features since Java 8 to 17

#112

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)

>if the point is to teach OO.

Is it really the point to teach OO though?

Java is being used everywhere. And you get to learn the basic as well as the huge ecosystem behind it. Apart from possibly Python, are there any language that get you both in terms of market and learning?

And Java have make huge improvement in every part of the ecosystem, from languages, standard library, VMs. While I still dont like the language much, but I have gotten off the so called busy and verbose code view as I age. As they do serve some purpose. We need better balance, right now languages design are binary and polarised options.

Re: New language features since Java 8 to 17

#113
post #70

Earlier quoted context omitted.

Android used to be always Java first. It could change again.

Most likely to Flutter. When Google will be ready to ditch Android API.

Android is based on the JVM, it will never switch to Flutter (and an aggravating factor is that Dart is an inferior version of Kotlin).

Re: New language features since Java 8 to 17

#114
I’m stuck on 8 and 11 in my current projects, so I haven’t seen much of these in the field other than the new record feature. What I am really surprised about is the var construct. Honestly, this leaves me a little conflicted since it seems to be antithetical to the principles of a strongly-typed language. So does this now reclassify Java as a weakly- or dynamically-typed language? I would perhaps argue against it being dynamically-typed since by definition type inference happens at runtime, but it certainly leaves Java in a sort of limbo. I don’t personally care, but I know at some point the topic will come up amongst my dev peers, at which point there will sure to be a (mostly friendly) debate.

Re: New language features since Java 8 to 17

#115

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?

“It’s extremely busy and verbose” were the reasons.

I agree with those reasons and I’ve always felt Java sucks because of them. When Java first came out I was a C/C++ programmer and was excited to learn it. Very quickly became disillusioned because it was incredibly verbose. I hoped the language would evolve quickly but it took FOREVER. Meanwhile Microsoft introduced C#, whose v1 looked like a copy of Java, and very quickly evolved the language to make it much better. They did what I hoped Sun Micro would do. But Sun just sat there and twiddled their thumbs.

Re: New language features since Java 8 to 17

#116

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)

strictly from a pedagogical perspective, sure, there are better choices. but java is at least decent for most of the core cs curriculum, and it's widely used in industry. when you're trying to get your first internship with no work experience, it's nice to be familiar with the language you'll be using at work.

Re: New language features since Java 8 to 17

#117

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)

I agree with everything here except the "should stop being taught as the defacto language in computer science curriculums". Realitically, a CS curriculum needs to at least vaguely prep a student for life in the industry, and Java is not only massively popular, but is also a great way of showing how OO is used in practice i.e. kinda badly. No point teaching everyone about beautifully architected Smalltalk programs jus…

teach javascript, ruby, rust, go, kotlin....scheme.

literally anything else.

Re: New language features since Java 8 to 17

#118
post #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?

Java's supported version on Android is a moot point: all new Android development should be made in Kotlin.

Re: New language features since Java 8 to 17

#119

Earlier quoted context omitted.

public class Main { public static void main(String[] args) { System.out.println("Hello, world!"); } } vs print("Hello, world!") Please comment again if you still cannot see the bloat/unnecessary verbosity.

Global scope is a terrible invention. The less implicitness there is, the better.

then write assembly.

Re: New language features since Java 8 to 17

#120
post #42

Earlier quoted context omitted.

reading and processing bytes mostly. Many people get confused due to the need of bitwise and, yet even if that would be removed I can't quite see the intrinsic benefits, given how difficult would be having another primitive type.

So, when processing bytes, can you name an operation where the existence of an unsigned type would even make a difference? I'm still not seeing it.

java virtually has only 2 integer types int and long, or 4 and 8 bytes one. So all operations are converted to int (or long) 1st, even when they involve byte/short, etc.

Imagine you try to combine a 4bytes (from an array) into a single int. If you just bitwise OR and shift left, e.g. something like

    (b[0] 
it won't work, you need ((b[1] & 0ff) That part is somewhat alleviated by wrapping byte arrays into ByteBuffers that would the right thing, or even better using only ByteBuffers (preferably the direct version of them when reading from input/output)
Post reply on HN