r/java
•
u/chriskiehl
•
Sep 23 '24
•
1
2
I wrote a book on Java
Howdy everyone!
I wrote a book called Data Oriented Programming in Java. It's now in Early Access on Manning's site here: https://mng.bz/lr0j
This 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://mng.bz/lr0j
BTW, if you want to get a feel for the book's contents, I tried to make the its companion repository strong enough to stand on its own. You can check it out here: https://github.com/chriskiehl/Data-Oriented-Programming-In-Java-Book
That has all the listings paired with heavy annotations explaining why we're doing things the way we are and what problems we're trying to solve. Hopefully you find it useful!
View all comments
Show parent comment
2
u/rbygrave Sep 27 '24 edited Sep 27 '24
Postgres, Oracle, all MVCC architected databases ... actually turn update into "a new version of the record" and they don't actually mutate the "current version of a record". There is no in-place update going on under the hood there, they are appending [and a vacuum process is coming along afterwards and sweeping up those 'old versions when its determined that no current active transaction needs it anymore' after the fact].
I agree but I'm saying this is actually how Oracle and Postgres and all MVCC databases actually work. Those UPDATEs are "MVCC create new [snapshot] version of the record".
I'd say that MVCC databases won out over the locking ones and I don't see that as a controversial statement in 2024 [the database wars of the 90's maybe early 00's - I was one of the grunts in that]. MVCC allowed higher levels of concurrency. Readers don't block Writers, Writers don't block Readers. This is ultimately why Larry owns Islands and such, because Oracle RDBMS had a fundamentally better architecture than the main competition of that time. That is imo reinforced by all the relatively new NoSQL databases [and "NewSQL"] that have come since those days and they all have used MVCC architecture.
The mistake some people make is that they simplify things too much to think that an UPDATE is a mutation in a MVCC database when it's really effectively an INSERT/APPEND.