Show HN: I Wrote a Book on Java
586 pointsThis book is a distillation of everything I’ve learned about what effective development looks like in Java (so far!). It's about how to organize programs around data "as plain data" and the surprisingly benefits that emerge when we do. Programs that are built around the data they manage tend to be simpler, smaller, and significantly easier understand.
Java has changed radically over the last several years. It has picked up all kinds of new language features which support data oriented programming (records, pattern matching, `with` expressions, sum and product types). However, this is not a book about tools. No amount of studying a screw-driver will teach you how to build a house. This book focuses on house building. We'll pick out a plot of land, lay a foundation, and build upon it house that can weather any storm.
DoP is based around a very simple idea, and one people have been rediscovering since the dawn of computing, "representation is the essence of programming." When we do a really good job of capturing the data in our domain, the rest of the system tends to fall into place in a way which can feel like it’s writing itself.
That's my elevator pitch! The book is currently in early access. I hope you check it out. I'd love to hear your feedback.
You can get 50% off (thru October 9th) with code `mlkiehl`
https://www.manning.com/books/data-oriented-programming-in-j...
Comments (168) 39 threads
Show all comments
Showing thread 2 of 39
The (likely debatable) list of features in 23 that a.) remain preview/incubator and b.) appear relevant to a work on data oriented Java programming are:
[1] https://mail.openjdk.org/pipermail/amber-spec-experts/2024-A... "So, to be clear: there will be no string template feature, even with --enable-preview, in JDK 23." - Gavin BiermanData oriented programming is about building around the data in your domain. The latest tools are nice, but they're just tools.
I know some drift a bit on their implementations over time, but have not be wholesale yanked out.
Obviously the solution to this is to not rely on these preview functions for production code. The way to do that is to run production in an LTS version of Java. I don't think that's an extreme point of view, frankly.
The new stuff is interesting and cool, and in time, it ends up in the LTS version.
Having lived through Java 5, 6, and 8, these are halcyon times for Java. It's moving VERY fast, and has been for some time.
Are there preview capabilities in the LTS versions? Yes, there are. But they're not under the LTS tent. Don't use them. The demarcation between the development releases and the LTS releases are a smart program to get features out into the world, and set some real lines in the sand for advancement. It helps keep preview items from staying in preview mode for an indeterminate amount of time.
And the two year LTS release cycle for a notoriously conservative eco-system is ample.
String Literals (JEP 326) made it to preview and got pulled.
> I don't think that's an extreme point of view, frankly.
Can't see where I suggested otherwise. I just wondered how the author was handling all the "in-flight" (An OpenJDK term there, not mine) features that Java currently has outstanding.
> It's moving VERY fast, and has been for some time.
They've been fast at creating new preview features. Actually landing finalized features though? In my view they're taking too long. When I compare Java and Python in this respect -- and I do as a working programmer in both on a frequent basis -- Java is still slow.
I feel this as well, but I also think it's desirable. Java is slower to add features because the bar is quite a bit higher (especially with regard to backwards-compatibility).
I'd much rather have long previews and occasional removal of previews than have a language that becomes bloated and kneecapped by past rushed decisions.
There's Kotlin, Scala, Groovy, etc, if you want to run on the JVM with languages that offer more features (and footguns). I find the balance OK, personally.
I'd much rather them pull the `STR.` templates than push it forward knowing its not ergonomic in practice.
Also, Java has gotten an insane number of new, significant features in the last couple of years — loom, algebraic data types, pattern matching, ZGC.. I don’t want to disrespect Python, but I really don’t think they have done anything to this degree.
Continue this thread — 2 replies