September 23rd, 2024

Show HN: I Wrote a Book on Java

The book "Data-Oriented Programming in Java" emphasizes organizing programs around data for simplicity, highlights recent Java features, and offers a 50% discount for early access readers until October 9th.

CongratulationsInterestSupport
Show HN: I Wrote a Book on Java

The book "Data-Oriented Programming in Java" aims to provide insights into effective development practices in Java, focusing on organizing programs around data. It emphasizes the benefits of treating data as plain data, leading to simpler and more understandable programs. The author notes that Java has evolved significantly, incorporating new features that support data-oriented programming, such as records and pattern matching. However, the book is not centered on tools but rather on foundational principles of programming. It advocates for the idea that "representation is the essence of programming," suggesting that accurately capturing domain data can streamline system development. The book is currently in early access, and readers can receive a 50% discount until October 9th using a promotional code.

- The book focuses on organizing Java programs around data for simplicity and clarity.

- It highlights recent Java features that support data-oriented programming.

- The author emphasizes foundational programming principles over tool usage.

- The concept of "representation is the essence of programming" is central to the book's philosophy.

- A promotional discount is available for early access readers until October 9th.

Related

AI: What people are saying
The comments on the article about "Data-Oriented Programming in Java" reflect a mix of support, curiosity, and concerns regarding the book and its content.
  • Many commenters congratulate the author on their achievement and express excitement about the book.
  • There are discussions about the relevance and implementation of recent Java features in the context of data-oriented programming.
  • Some readers share their experiences with similar programming concepts from other languages, like Clojure and F#.
  • Questions arise regarding the book's completeness and the implications of early access for readers.
  • Several users express interest in how this book compares to other existing literature on data-oriented programming.
Link Icon 39 comments
By @raju - 2 months
Let me start by saying (as someone who has written a few technical books of his own)—Congratulations!

I am sure you (assuming this is your first book) are learning that this is a labor of love, and I wish you the very best in this endeavor. You should be proud!

I was exposed to "data oriented programming" thanks to Clojure—wherein maps/sets are the constructs used to pass data (as plain data) around, with simple functions that work with the data, as opposed to the traditional OO (hello ORM) that mangles data to fit some weird hierarchy.

Java's recent innovations certainly make this a lot easier, and I am glad someone is looking at propagating a much needed message.

I will take a look at the book, but I wish you the very best.

By @topspin - 2 months
How have you dealt with the current situation in Java where several new and important language features are still "preview" and are subject to being withdrawn? The possibility that these features might ultimately disappear is not theoretical: String Templates has been removed[1] from 23 as what would have been the "third preview," for example.

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:

    Primitive Types in Patterns, instanceof, and switch (Preview) – JEP 455
    Implicitly Declared Classes and Instance Main Methods (Third Preview) – JEP 477
    Flexible Constructor Bodies (Second Preview) – JEP 482
    Vector API (Eighth Incubator) - JEP 469
    Scoped Values (Third Preview) – JEP 481
[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 Bierman
By @mands - 2 months
Technical Editor: Brian Goetz - you have my attention...
By @burningChrome - 2 months
Congrats on your accomplishments!

I had two friends who both wrote separate books on JS. One early book on Angular and the other was about jQuery. Both had a hard time with the critical reviews they received on Amazon and it really dissuaded them from doing any more technical writing.

I love your approach and hope you keep writing and don't let the trolls get to you! Our industry needs more people who have this "soup to nuts" approach and take into account how nearly every language has changed dramatically over time.

Again, congrats and keep writing.

By @olpquest22 - 2 months
Congratulations! consider posting about in https://www.reddit.com/r/java/ it is a very active java community.
By @jroseattle - 2 months
Congrats on writing and completing a book! I was involved in a few myself long ago, when I had the time available to contribute to those endeavors. In a world that often measures "the juice being worth the squeeze", I'm not sure authoring technical manuals would ever meet the criteria.

One of my personal photos I keep around was taken long ago in what was the biggest bricks/mortar bookseller. I was looking at the selection of books on Java available at the time. O'Reilly was the dominant publisher, and thus had several offerings on the wall. Most of the books were at least 2 inches thick. (If you were ever involved with writing a technical book in the early 2000s, you'll understand the publisher metrics at the time were based on the width of the spine on the shelf.)

Among the many Java manuals of significant girth was a small, THIN book with the title "Java -- the Good Parts". :-{}

By @TeaVMFan - 2 months
Congratulations! In case people are looking for other modern Java books, here's one I'm working for building modern web apps in Java:

https://frequal.com/Flavour/book.html

It describes how to make single-page apps in Java, using the Flavour framework. No plugins, no extensions, and 99.9% pure Java. Plenty of sample code and links to relevant podcast episodes and demos.

By @necovek - 2 months
First up, congrats on getting over the hump — I struggle to complete a blog post, so I very much appreciate the effort it takes to do this!

A confusing sentence I noticed in the first chapter:

> ...then the only thing cost was some time, if they do it wrong, the cost is usually a bug.

I am guessing you mean "only cost was some time" (without the "thing")?

As for the topic, my hypothesis is slightly different — adopting functional approach to programming — even in imperative languages — leads you to the best patterns (or as you put it, "makes it inevitable") when combined with "evolutionary" architecture, and DoP is certainly one of them.

However, for a majority of software, in my experience, data "attributes" are really "leaf nodes", only to be consumed for display, and types do not really matter much there (eg. I don't mind `firstName` being a simple string). What we want to get right is types we do operations on, and most critically, relations between different data models. Accepting "evolutionary" principles in architecture also means that you welcome change and build for it, so getting any definition of data right from start is not an imperative.

But the topic certainly seems intriguing, so I look forward to learning more from your book and seeing how you apply it in a more imperative/OO way and what language features you found critical to success there.

Congrats again and good luck!

By @greyskull - 2 months
Congratulations!

I see that the book is incomplete. I didn't know that early access for books was a thing, very neat. It might be pertinent to note in your post that it's still being written, with an estimated release window of Spring 2025.

I'm very much a "consume it when it's ready" person, so I'll keep this on my watch list.

By @xtreme - 2 months
As someone who loves Typescript, the first chapter of your book deeply resonated with me. Good data representations and data types that encode meaning can eliminate entire classes of bugs by making invalid states unrepresentable, and I wish more languages emphasized and supported these principles.
By @jhck - 2 months
Congrats on launching the early access! I'm familiar with data-oriented programming from Clojure and F#, and I'm interested in seeing how you approach it in Java, so I just picked up a copy (ebook). Wish you all the best on completing the book!
By @victor106 - 2 months
Can't wait to read this.

There's another book by a similar title

https://www.manning.com/books/data-oriented-programming

Care to elaborate how yours is different?

By @neeleshs - 2 months
Congratulations! I bought it and looking forward to the completed book.

The first chapter is pretty nice. Record types, switch statements and other new features will hopefully push Java programmers to think in terms of types more often.

By @WuxiFingerHold - 2 months
I've read the first chapter and I like it a lot. I find myself way to often hiding business logic as in your first example. Also, showing how to use Java for DoP and combining it with other concepts like OOP encapsulation is very helpful IMO.

Now I'm waiting for two things:

1. Manning allowing me to grab it (forgot password email notifications seems to hang)

2. More chapters :-) ... no, really, just let it roll. Don't rush.

By @blorenz - 2 months
Congrats and keep going! I ultimately failed at mine because I didn't keep disciplined focus on it when life got in the way. It was many lessons learnt.

https://www.amazon.com/Hands-Django-Beyond-Brandon-2016-03-2...

By @muhehe - 2 months
Is java still popular? Though I'm not a big fan of it I wouldn't mind using, but I'm after somewhat recent changes in licensing I'm not even sure I can. I don't fully understand the changes and I'm afraid of oracle coming after me :).

Can anyone explain current caveats and/or limitations with current licensing?

By @blackqueeriroh - 2 months
Purchased! I know very little about programming still, but Java is a language I have dealt with and will likely continue to have to deal with for the rest of my career, so here we go!
By @tpoacher - 2 months
Congratulations! I bought a copy. If I like it I might recommend it as further reading for the university java course I teach. :)

PS. All the best with the yacht! xD

By @RandyRanderson - 2 months
I now see these threads with a language in the title as kind of a digital (literally) version of a voluntary committal. Those herein are, of their own volition, taking their thoughts and feelings about technology X out of the Internet at large and into a safe place where they can do no harm. No one in threads such as these are going to change their mind. It's a beautiful thing.
By @mattgreenrocks - 2 months
Lots of people are sleeping on modern Java, and it has had a lot of really nice changes, that, when put together, make it wholly different from what came before.

One question: a lot of the Java enterprise ecosystem is based around entities (Hibernate and the like). Do you give guidance for how to work within that context? Can I use data oriented programming there?

By @catzapd - 2 months
Happy to see a post on Java and a book as well.

Will checkout the book.

By @sidcool - 2 months
Manning is a good quality publication (unlike Packt). Congrats. Looking forward. Will this be available on Safari books O'Reilly portal?
By @globular-toast - 2 months
How does DoP compare to Domain Driven Design (DDD)?
By @dzonga - 2 months
congrats. Data Oriented Programming is cool, but you can easily get lost in the complexity of certain things.

there's another related book from one person active in the Clojure ecosystem. Though the book examples are in JS.

also, thank you for taking the step forward on doing your own small part in changing the 'AbstractFactory' thinking that's pervasive in the Java world.

By @pratikshelar871 - 2 months
Unable to checkout. Keep getting an. error
By @elric - 2 months
Does it include any content related to algebraic data types?
By @orsenthil - 2 months
Congratulations on writing your book.
By @oveja - 2 months
Very nice! I gave you my money just for the consideration of people stuck in old Java versions like myself. Looking forward to getting the new chapters as they come!
By @javaunsafe2019 - 2 months
Bought and read 32% of the available content and I’m disappointed. Yet another book that full of lingo bingo, a lot of text around a concept of what use more functional coding style with Java 17 features. Pretty sure there is some good information in there but it could be brought down to 3 or 4 slides instead of this extrapolation…
By @smusamashah - 2 months
The link is returning 404 for me.
By @sowerssix - 2 months
Not gonna lie, came here to see if "wrote a book on Java" was Java the language or Java the island. Congrats on your book, and I'll see myself out.
By @tithos81 - 2 months
Msww

I Lost T

By @das_keyboard - 2 months
As someone coming from gaming, somehow early-access for books seems weird
By @ephaeton - 2 months
Congratulations! It's so interesting to witness how "techniques of the past" make a grand return in "new" programming languages that "gained" features from 4 to 7 decades ago to support this programming style. "records, pattern matching, `with` expressions, sum and product types" - in my upbringing, this stuff is decidedly "old-school FP". People going through their learning curve 30 years later than I have will see what I had learned as "dead, possibly failed-forever FP ideas" as the "we tried a lot of stuff but this seemed to be the best way to do it after all" of their time.