Live data from Hacker News

Java 21 makes me like Java again

wscp.dev

641–650 of 777 posts

Re: Java 21 makes me like Java again

#641

Earlier quoted context omitted.

both suggestions here are for books that cover java 8. how is it possible that java 8 is modern relative to java 21?

Modern Java in Action (the 2nd edition of Java 9 in Action) covers Java 11 and contains a final chapter that talks about "future Java" features -- many of which are now implemented. It's a great book for Java programmers who want to make the jump to functional-style programming. If that's the transition one is hoping to make, then I would definitely recommend the book.

And I would recommend "The Well-Grounded Java Developer" (2nd edition) to those who have mastered the functional-style Java of "Modern Java in Action". It covers JDK 17 (and beyond) and also has a a polyglot JVM focus with coverage of Kotlin and Clojure.

https://www.manning.com/books/the-well-grounded-java-develop...

Re: Java 21 makes me like Java again

#642

Earlier quoted context omitted.

Manning's Modern Java in Action is outstanding. It assumes you already know basic Java. https://www.manning.com/books/modern-java-in-action

both suggestions here are for books that cover java 8. how is it possible that java 8 is modern relative to java 21?

... and I agree that there is a need for a Java 21+ book which includes discussion of algebraic data types, pattern matching etc.

Re: Java 21 makes me like Java again

#643

The biggest problem with Java is... the walled garden, the snob society, the elitist, exclusive culture. Go isn't like that, or at least wasn't when G+ was still around. Nowadays I don't get in touch much with people, but when I create issues Go people are usually not as unfriendly as Java/JVM people.

Imo problem with Java is... JVM because it's quite a resource intensive application itself, memory usage is orders of time magnitude worse than most of the language I've used.

Forgot that our computers were so resource constrained these days...

Re: Java 21 makes me like Java again

#644
post #200

Earlier quoted context omitted.

I'm sure you have done great work in Java, as have many of us, and for many of those years, Java really was the best tool for many jobs. But that was then, now is now. I'm not saying Java doesn't work, even for greenfield projects today. It works fine. But me and many others also think it's not enough for something to merely work, especially not when there are other much better and more modern tools. (which Java is d…

> especially not when there are other much better and more modern tools. (which Java is demonstrably playing catch-up with) Which modern tools do you have in mind here? Java does indeed playing catch up with new features. That's inevitable for a language came out 30 years ago. OTOTH many other languages are still behind Java in terms of the runtime environment and the ecosystem. You should pick what works for you, no…

> Which modern tools do you have in mind here?

We're talking about Kotlin here (there are many contexts where neither Kotlin nor Java is the correct tool, but for pretty much any use case where Java is an option, Kotlin is going to be a better one)

> not to go with the trend

I'm so sick of this argument, it presupposes that Java is the default and anything else by definition is just a trend. Kotlin is not a trend, Kotlin is not a fad. Stop begging the question.

> I think you seriously overestimate how talent those devs are if language is the deciding factor of what they choose to work on.

Ok, and I think you seriously overestimate the willingness of people who have given Kotlin a serious try and seen first hand how much it offers over Java to go back to working for a Java-heavy shop if they can help it.

Re: Java 21 makes me like Java again

#645
post #573

Earlier quoted context omitted.

The main pain-points in a large org at least: Lack of a "default" stack for nearly anything. The stdlib is great but the ecosystem isn't. Which web framework? Does it come with a logger? If not which logger? Do the third party libraries I want to use work with my logger/have a mechanism to provide one via an interface or am I shit out of luck? This goes for so many more things though, cache libraries, data structures…

Teasing this apart I see a few things: a) logging, b) modules rollout and c) missing frameworks. I’ve never had a logging issue in large systems. Explicit error return (as you know, on every function) allows you to log in your code, not lean on only libraries that support your interface. Modules rollout was part of growing up. But, you won’t get Go 1->2 upgrade issues as we have 100% backward compatibility on version…

> Too many allocations for Go is going to be too many allocations for JVM too

No, Go’s GC is a toy compared to the JVM’s. It is lowerish in latency by actually stopping the application threads when under high contention.

Java doesn’t slow down the allocation rate, it tries to keep up with the churn.

Re: Java 21 makes me like Java again

#646
post #386

Earlier quoted context omitted.

> To build a good product you don’t need a kid with Hollywood star complex Agree 100%. > for whom the choice of programming language or tools matters that much Programming languages do matter. Serious, mature professionals critically evaluate and compare tools and pick the best one for the job. Kotlin is a) not some fad b) objectively better than Java for pretty much every imaginable use case. Kotlin avoids entire ca…

As a mature professional who stopped counting learned programming languages and frameworks long ago (I’m familiar with Kotlin too), I can tell you that Java is a modern tool by all measures. It may lack some features of other languages and platforms, but it is not features what defines relevance for modern applications. Your advocacy is important, we of course need progress and testing new concepts. Yet what ultimate…

> it is not features what defines relevance for modern applications

what? zero-effort null safety out of the box alone is immeasurably valuable

> leaving new stuff to pet projects at home... risks associated with less mature platform

I'm so sick of this argument, it presupposes that Java is the default and anything else by definition is just new, a trend, a fad. Kotlin is none of those things and you know it. Stop begging the question.

> For me it is not obvious that Kotlin is better.

I mean, if you can familiarize yourself with things like https://proandroiddev.com/kotlin-avoids-entire-categories-of... and still conclude there are no obvious benefits then I don't know what to tell you, it's clear nothing is going to convince you

Re: Java 21 makes me like Java again

#647

Earlier quoted context omitted.

As someone writing code on Java since v1.0 and making tech strategy decisions on the C-level, I consider myself sane and experienced enough to say that Java is something that will do the job well and can be the primary choice for startups and new projects. Kotlin as a platform is not mature enough to deserve the same qualification.

> Kotlin as a platform is not mature enough to deserve the same qualification. With (1) a lot of Java backend projects migrating to Kotlin (let's be negative and assume 20%); (2) all of Android running Kotlin, which is around 80% of the world's mobile phones; (3) the world's best IDE authors building features and improving Kotlin; (4) the language being almost 13 years old at this point; and (5) Kotlin being 100% com…

Hard agree on the maturity, it's clear this person has literally just decided that Kotlin is immature despite it flying in the face of all facts

Re: Java 21 makes me like Java again

#648
post #347

Earlier quoted context omitted.

If you want to distribute app to non tech people you do it via browser ;)

there are many apps that are not suited for a browser :(, on some embedded devices with a touch screen, it does not even have a browser and no internet connection either.

From my POV that is bad example, for those embedded apps you have technical personnel installing and configuring those. Non-technical users don't have any means to install/modify whatever is there.

Re: Java 21 makes me like Java again

#649

> Why do we call them product types anyway? Answer in the piece is not wrong, but put more intuitively and succinctly: the total number of possible value (inhabitants) in a product type is the product of the quantity of inhabitants of the constituent types. Replace the “product”s with “sum”s and it works too. Interestingly, the total number of unique functions (judged only in terms of input and output) from a -> b ca…

Maps (and lists) are other examples of exponential types. Intuitively this should make sense that these are the same as functions because any pure function could be (theoretically) replaced with a map lookup of pre-computed values. In this context, list is a special map where the keys are integers.

Writing it out mathematically, given a List of Bool, the left-hand side is the number of elements and the right-hand side is the total possibilities.

- 0 : 1

- 1 : 2

- 2 : 4

- 3 : 8

- 4 : 16

- 5 : 32

and so on

Re: Java 21 makes me like Java again

#650
post #195

Earlier quoted context omitted.

> This is mostly because applications and libraries are so hard to reason about and understand due to inheritance, packaging, OOP, build tools ect compared to Go. You are just at the early phase of the project. > Go is simple. It's easy to understand, read, and maintain My opinion is that Go is too simple, to the point that it hinders understanding and readability. 4 nested loops with random mutability is much worse…

It would be good for my job if learned go, but I've been having a hard time because it's just so boring.

Honestly, just find yourself a project and just Go for it (sorry for the pun).

The syntax is easy enough you can start coding just after having looked at basic examples.

Personally I actually like Go because it's so boring.

I tend to see languages more like tools rather than valuable knowledge I must learn, so a simple yet powerful enough language is a perfect fit for me.

Post reply on HN