News for hackers. Stuff that matters.
Re:Java 12 by Justsignedup on Tuesday March 19, 2019 @09:05PM (#19437885)
just had this conversation with a co-worker today.

java is a stable api but it also doesn't evolve. The tradeoff is you get a program guaranteed to work no matter the upgrade vs being able to build better toolage.

React changes every year or 2. It is exhausting. But you get way better patterns and some things that drastically improve productivity.

Re:Java 12 by sixstringtheory on Tuesday March 19, 2019 @09:51PM (#19438139)
Java gives you a flexible object oriented language and an incredible set of libraries. It's got an archiver for artifact and dependency management. It now has lambdas and has FRP style stream programming. I'd say it's kept up pretty well with modern fashion, while it's been doing other things far longer than newer, more popular languages. Take Swift, now my daily driver (which I love so much compared to ObjC, which I moved to after Java)... an example of something Java had way before Swift is "Protocol Oriented Programming". Also, Swing's GridBagLayout predates iOS' AutoLayout and CSS (edit: don't know where I was going with CSS haha...). Everything old is new again, and I'm sure Java reinvented a few wheels of it's own.

Also keep in mind that React is a library, not a language. If you want to compare things, compare Javascript to Java, or the Java stdlibs to React. Maybe that's what you meant when you said Java.

IMO, Java and its libraries are nicer to work with solely due to its static nature and OO design. It is worlds apart from a scripting language when you need to refactor, or even just understand, legacy code. And if you can't even run tests on that legacy code anymore, like a React project over a year or two old?

What are the better patterns and productivity boosts you get from React vs. a Java ecosystem?

Re:Java 12 by humbleMouse on Tuesday March 19, 2019 @11:03PM (#19438532)
In addition to all of these good things, you can also use groovy which has a ton of shorthand syntax and makes writing code super easy. Groovy also makes writing tests short and simple. I love java and all jvm languages honestly.
Re:Java 12 by euyyn on Wednesday March 20, 2019 @02:47AM (#19439633)
Kotlin though. Everything you said, but a joy to write instead of a chore.
Re:Java 12 by pjmlp on Wednesday March 20, 2019 @03:50AM (#19439882)
I am betting Kotlin is the new Groovy.

Lets see where it stands 5 years from now, specially if Fuchsia actually gets released.

Re:Java 12 by ptx on Wednesday March 20, 2019 @05:07AM (#19440262)
Kotlin is different because of the focus on tooling, which is the advantage Java still had over all the dynamically typed JVM languages.

Also, Kotlin/Native is in beta now and could target Fuchsia (compiling AOT to native code using LLVM).

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @06:14AM (#19440594)
What tooling? Being forced to use InteliJ, without any proper support on Eclipse and Netbeans?

Still not able to use several of Android Studio features available to Java, like incremental compilation and slim APKs?

Kotlin advocates seem to forget JVM will never be rewritten in Kotlin, the language is just yet another guest, with the usual syndrome to wrap existing libraries, having to take care about FFI for Java access, not having all features taking advatange of the latest bytecodes, e.g. lambdas implementation.

As for Kotlin/Native, there is nothing to worry about versus what Go, Rust, C++, Dart, D, Nim offer in terms of performance, libraries and in some cases tooling.

Having to buy CLion for a graphical debugger isn't a selling point versus the established alternatives.

Fuchsia is being written in Go, Rust, C++ and Dart, with the team now hiring for node.js support.

https://www.androidpolice.com/2019/03/19/google-working-to-b...

Re:Java 12 by coldtea on Wednesday March 20, 2019 @07:55AM (#19441157)
>What tooling? Being forced to use InteliJ, without any proper support on Eclipse and Netbeans?

Seeing that both Eclipse and Netbeans are now more or less dead (and speaking as a long time Eclipse user, from the very first version to around 4), yes, first class vendor-direct InteliJ support is more than enough. And more than most languages (including Groovy) ever had.

>As for Kotlin/Native, there is nothing to worry about versus what Go, Rust, C++, Dart, D, Nim offer in terms of performance, libraries and in some cases tooling.

IMHO, Rust will always be kind of niche as hard to tackle, Dart we'll see, D never went anywhere, and Nim will remain niche, it's a little too idiosyncratic to catch on.

Kotlin is already more popular than all of the above except perhaps Go.

>Fuchsia is being written in Go, Rust, C++ and Dart, with the team now hiring for node.js support.

Fuchsia is still vaporware or at least irrelevant. It's not even in the market yet. And the fact that it's written in 4 (and looking for 5th) languages doesn't really bring much confidence.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @08:13AM (#19441271)
Groovy had Netbeans and Eclipse support, which was dropped when it started fading away.

We move in different worlds, no InteliJ installations around here.

I remember when Groovy was popular, with every JUG in Germany having weekly talks and Sun talking how the next JEE revision would support Groovy for writing beans.

Popularity doesn't write software.

Re:Java 12 by coldtea on Wednesday March 20, 2019 @09:44AM (#19442043)
>Groovy had Netbeans and Eclipse support, which was dropped when it started fading away.

I know, I've used it. What I said is that it did not have the first class IDE attention of a major vendor, those were mostly third party sub-par plugins compared to the Java focus of those IDEs. For Kotlin, however, it was first class IDE support as a primary concern from the start.

>We move in different worlds, no InteliJ installations around here.

Then we indeed move in different worlds.

>Popularity doesn't write software.

No, its just the only thing that matters when it comes to get paid for it.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @10:26AM (#19442527)
Delivering working software as per customer's RFP is what matters, everything else is fluff.
Re:Java 12 by olavgg on Wednesday March 20, 2019 @08:51AM (#19441499)
I don't understand how Groovy is fading away when it is getting more and more popular. Groovy is also very similar to Java. There is no learning curve, you are immediately creating value.
Re:Java 12 by pjmlp on Wednesday March 20, 2019 @09:19AM (#19441783)
More popular where?

Had it not been for Google's adoption of Gradle for Android and it would have been left for Grails maintenance projects.

And even then, the pressure for perfomance has been so much that it is being superceded by a Kotlin based DSL.

How to improve Gradle has been a common talk at every Android conference since Android Studio has been introduced.

Re:Java 12 by olavgg on Wednesday March 20, 2019 @10:00AM (#19442223)
Everywhere?

Google Trends says Groovy is just as popular as it was 10 years ago. The number of downloads has increased significantly but it is not because of Gradle, as Gradle bundles Groovy. It is also currently placed #16. on TIOBE Index

And last, Groovy with compile static is in most cases, just as fast and memory efficient as Java.

Some people always talk down Groovy, yet the numbers speak for them self. Before Kotlin, Groovy was attacked by Scala developers.

The major thing Groovy has over both Scala and Kotlin is strong similarity to Java syntax which makes the learning curve non-existing. And that is a bigger deal than a random cryptic/confusing programming expression. Code readability is very important.

Re:Java 12 by vorg on Thursday March 21, 2019 @02:04AM (#19449558)
> Some people always talk down Groovy, yet the numbers speak for them self

Many of those numbers are fake. Groovy was #70 on the Tiobe index only 12 months ago, see [1], but is #16 now. How do you explain that? Groovy was last in Tiobe's top 20 about 2 years ago when the search numbers for "Groovy" from Baidu were hugely incorrect. Groovy later quickly dropped back out of the top 50.

[1] https://www.tiobe.com/tiobe-index/groovy/

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @10:29AM (#19442557)
Certainly not in Germany where it vanished from JUGs.

https://trends.google.com/trends/explore?q=%2Fm%2F07sbkfb,%2...

Java worldwide average 86%

Groovy worldwide average 2%

Pretty popular indeed.

Re:Java 12 by pjmlp on Thursday March 21, 2019 @10:41AM (#19452854)
Re:Java 12 by dcow on Wednesday March 20, 2019 @11:52AM (#19443402)
Fuchsia is language agnostic. This is a boon. Writing for Fuchsia isn’t like writing for Unix where C is king. Fuchsia is able to natively host many more ecosystems than Linux cares to bother with. It gives me great confidence.
Re:Java 12 by coldtea on Wednesday March 20, 2019 @05:37PM (#19447217)
Tons of great stuff for Unix is written in C++ and other languages all the way to Python and Java. You can write Unix apps in whatever language you want. Ditto for Windows and MacOS.

Not sure what the special deal is with Fuchsia here.

Perhaps you think you'll be able to write Fucshia device drivers with any language you like? That wont be the case at all.

Also Linux has this going in its favor over Fucshia: it actually exists.

Re:Java 12 by hota_mazi on Wednesday March 20, 2019 @05:21PM (#19447068)
Windows has been language agnostic for decades.

What's so remarkable about that fact?

Re:Java 12 by stewbrew on Thursday March 21, 2019 @12:30AM (#19449304)
"InteliJ support is more than enough"

That won't get kotlin more traction. No proper/official tools for LSP support means no vscode, vim, emacs etc. users. As a happy eclipse user, I wouldn't call it dead either.

Re:Java 12 by coldtea on Wednesday March 20, 2019 @07:49AM (#19441130)
Groovy was a random JVM-based dynamic language with no major company support and no special tooling.

Kotlin has IntelliJ (and thus a great IDE) and Google standing behind it, and Steve Yegge's nod of approval.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @08:10AM (#19441253)
Not every Java shop is going to drop Eclipse and Netbeans just to make JetBrains happy.

As for Android, lets see what happens with Fuchsia.

The overwhelming majority of Java developers don't even know who Steve Yegge is.

Re:Java 12 by coldtea on Wednesday March 20, 2019 @09:46AM (#19442075)
>Not every Java shop is going to drop Eclipse and Netbeans just to make JetBrains happy.

True. They will drop them because Eclipse has been faltering for ages and has been dropped by IBM, and Netbeans has always been a subpar unloved stepchild used by the kind of devs that don't know better and think SlickEdit or Notepad++ are great editors.

>The overwhelming majority of Java developers don't even know who Steve Yegge is.

That's on them.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @10:32AM (#19442598)
I guess Fortune 500's have missed that memo, including IBM own subsidiaries.

Lets talk back in 5 years from now.

I am betting Kotlin would become yet another language that happens to compile to the JVM, after the Android honeymoon goes away.

Re:Java 12 by coldtea on Wednesday March 20, 2019 @11:30AM (#19443169)
>I guess Fortune 500's have missed that memo, including IBM own subsidiaries.

They probably did. They're late for all memos. The Fortune 500 is not were you'll go to gauge adoption. Heck, half of them still have IE6 only apps.

There are hundreds of thousands of companies, and just 500, well, Fortune 500.

Apparently you use the most established and boring development-wise of companies (Fortune 500) to prove Kotlin is not used widely, but you're OK with vaporware like Fucscia that's not even beta yet as an argument that Dart and co are.

>I am betting Kotlin would become yet another language that happens to compile to the JVM

And I bet you're wrong. Let's see in 5 years. We were on HN 10 years ago, we'll probably be here then. I'll set a reminder.

Re:Java 12 by pjmlp on Wednesday March 20, 2019 @12:25PM (#19443762)
Because they prove Google is struggling with internal politics where to go next.
Re:Java 12 by mosdl on Tuesday March 19, 2019 @10:57PM (#19438502)
There are plenty of java projects that change apis. Comparing a framework to a language is stupid.
Re:Java 12 by jaabe on Wednesday March 20, 2019 @02:56AM (#19439673)
If you develop, not if you maintain. This is a major reason we stay away from JS frameworks after burning the hands on implementing an AngularJS that was obsolete a year later.

That and a few page reloads never killed anyone.

Re:Java 12 by freewilly1040 on Tuesday March 19, 2019 @10:40PM (#19438394)
Doesn't evolve _quickly_. Which as you say is say is part of the tradeoff of giving a trustable guarantee that the tooling you do use will continue to work for a long time.
Re:Java 12 by Consultant32452 on Wednesday March 20, 2019 @01:20AM (#19439242)
I've been working professionally in Java for almost 20 years. I can't remember the last time I saw someone use features introduced after 1.6. The time API in 1.8 was nice. I've never seen anyone use lambdas in production code. I'm sure people do use newer stuff, but I think it's the minority. So in practice it's even more stable than it is in the headlines.
Re:Java 12 by Scea91 on Wednesday March 20, 2019 @02:34AM (#19439578)
Strange, our production code is full of streams and lambdas. It probably depends on the type of product.
Re:Java 12 by qw on Wednesday March 20, 2019 @03:07AM (#19439715)
I work for a large company and the code base is full of streams and lambdas. Streams are almost used too much and could be replaced with a simple for-loop.
Re:Java 12 by ionised on Wednesday March 20, 2019 @08:22AM (#19441325)
Yeah, stream overuse is definitely an issue at our company.
Re:Java 12 by jcadam on Wednesday March 20, 2019 @07:32AM (#19441006)
I started using Streams and lambdas immediately, along with functional interfaces. Java is still not nearly as pleasant as Scala or Clojure, however.
Re:Java 12 by euyyn on Wednesday March 20, 2019 @02:49AM (#19439641)
Chromium (and so Chrome too) uses lambdas in its Java parts.
Re:Java 12 by gbersac on Wednesday March 20, 2019 @04:50PM (#19446731)
Last time I used java, I used it extensivelly lambda, collection map and flatmap, optinnals... But old school javaist barely used them though.
Re:Java 12 by ionised on Wednesday March 20, 2019 @08:21AM (#19441320)
We start using new features pretty much as soon as the new JDK version is released to general use.
Re:Java 12 by astura on Wednesday March 20, 2019 @08:22AM (#19441328)
I started using them ASAP.
Re:Java 12 by coldtea on Wednesday March 20, 2019 @07:45AM (#19441104)
>java is a stable api but it also doesn't evolve

You have probably missed the last 5 years. From streams, to closures, to default methods, to functional interfaces, to local type inference, to new Process APIs, to modules, to unsigned arithmetic, to new date/time APIs, http client, 2 new GCs, shell REPL, etc... with more to come, and new releases every 3 months...

Re:Java 12 by ptx on Wednesday March 20, 2019 @05:48PM (#19447324)
> unsigned arithmetic

I thought I had missed something there, but it looks like it's just a bunch of utility methods to reinterpret integers and convert them to longs (etc.)?

Kotlin, on the other hand, recently added actual unsigned types[0] – taking up the same number of bits as the corresponding signed type, supporting the normal mathematical operators, and preventing unintended mixups with signed types.

[0] https://kotlinlang.org/docs/reference/basic-types.html#unsig...

Re:Java 12 by coldtea on Thursday March 21, 2019 @08:34AM (#19451549)
>I thought I had missed something there, but it looks like it's just a bunch of utility methods to reinterpret integers and convert them to longs (etc.)?

Yes, but it's also a new feature (along with dozens of others). The complaint I answered was that Java is stagnant somehow, when it has been evolving fast in the last 5 years, and is accelerating its pace (release cadenze) even more.

>Kotlin, on the other hand, recently added actual unsigned types[0] – taking up the same number of bits as the corresponding signed type, supporting the normal mathematical operators, and preventing unintended mixups with signed types.

Which, given that the JVM doesn't support them at the bytecode level (iirc), they also use some similar trick of working with signed numbers under the hood, just hide it better at the syntax level.