3 ms·
It’s gotten better over the years. Java originally did not have generics, then there was the factory/uml everything crowd. Recently modern Java has been evolv
by lumost 4y ago
It’s gotten better over the years. Java originally did not have generics, then there was the factory/uml everything crowd. Recently modern Java has been evolving towards ergonomics with streams/loom/guice/Lombok etc.
However we still don’t have something like auto/let from cpp/rust.
- chrisseaton 4y ago> However we still don’t have something like auto/let from cpp/rust. But things like auto are more verbose semantics, not less! And isn’t var in Java like auto in C++?
- kaba0 4y agoThere is type inference for local variables indeed with var in java for a few versions now (from the top of my head it is available since 14?)
- mypalmike 4y agoYes. And you could use Lombok to do the same before that. (Though I'm one of the weirdos who likes Java in it's explicitness, which is related directly to its verbosity. I like reading code where I can see what the local variable types are.)
- kaba0 4y ago(I believe it depends on the exact scenario. In cases where the return type is not obvious I also much prefer explicit types (eg. ConcrType a = someObj.someMethod() ), but I don’t find A a = new A() any more readable than the var version)
- mypalmike 4y agoAgreed. I'm not sure that the shortcut existing in the language is worth the fact that other devs on my team will use it in the former case.
- brabel 4y agoTypical criticism of Java: outdated by several years... Java has had "var" since at least Java 11 (current version is 18, with version increasing every 6 months, so you're talking about Java from 4 years ago). With new features every 6 months, yes, 4 years ago is an eternity in Java world these days... 4 years in the future, almost certainly Java will already have virtual threads (like Go coroutines), full support for pattern matching on records (ADTs like OCaml), true value types (Project Vallhalla) and some other stuff that is making other languages stay behind Java in many aspects.
- lumost 4y agoFair, my Java experience recently has been on a code base with jdk8/10 semantics. Super pumped for loom though.