r/Clojure • u/viebel • Dec 29 '21
📖 Data-Oriented Programming book: First draft
After 18 months of development, I am glad to announce that I finally completed the first draft of my book: Data-Oriented Programming.
I wanted to thank all the people from the Clojure community that helped me in the thinking and the writing process.
The book got sold decently (2.8k copies) despite being in MEAP state (Manning Early Access Program).
The book is my attempt to formulate the underlying principles of Clojure approach to data and illustrate how to apply them in another language.
Here are the 4 principles of Data-Oriented Programming:
Separate code (behaviour) from data
Represent data with generic data structures
Data is immutable
Separate data schema from data representation
For those who already bought the book or are interested, I released the book's source code to https://github.com/viebel/data-oriented-programming. The publication is expected for March 2022.
If you guys aren't sure about buying the book, contact me on Twitter @viebel, I'll DM you a preview.

6
u/EvocativeBanjo Dec 29 '21
I bought the MEAP version of this book about a month ago - really enjoyed it! Thanks for distilling these ideas for a JavaScript developer like me 😝
3
u/viebel Dec 29 '21
Thank you!
What ideas were easy to apply in JavaScript and what ideas were more challenging?3
u/EvocativeBanjo Dec 29 '21
I also watched some of your talks on YouTube- I enjoyed your down to earth approach and collaborative spirit! I found the multi method concept really interesting and I developed my own implementation in a toy functional programming library I’ve been working on.
Prior to your book, I was reading Composing Software and Joy of JavaScript, so I’ve been in a functional programming kick! I found the idea of using just plain objects to be a bit of an interesting idea, gonna have to see how I can mesh this with DDD.
3
u/viebel Dec 29 '21
Could you share your implementation of multimethods?
4
u/EvocativeBanjo Dec 29 '21
Sure! Here’s the link to my repo: https://github.com/astridlyre/fp 😊 I’m still figuring this all out! The pertinent file is src/multimethod/multimethod.ts
4
u/viebel Dec 29 '21
Cool!
I have added a link to your repo in https://github.com/viebel/data-oriented-programming/tree/main/community
5
u/Xarlyle0 Dec 29 '21
I've been enjoying the MEAP version for months and it gives me a great way to explain clojure principles to my coworkers and apply them in my everyday work. Congratulations!
1
u/viebel Dec 29 '21
What's the reaction of your coworkers?
6
u/Xarlyle0 Dec 30 '21
Depends on the coworker. Python developers are always impressed and surprised. Java people, both as developers and managers, are highly skeptical, especially if it's all they know. I usually need to do some work on my own for physical demonstrations, (the one in the book is helpful for this though). Javascript people like to talk a lot about it before going along with it but are usually pretty enthused. I can use React.js language to help for them. I usually credit the rise of React for the surge of functional programming in the last 5 years. It's what started my journey that finally arrived at Clojure.
1
u/SimonGray Dec 30 '21
I usually credit the rise of React for the surge of functional programming in the last 5 years.
I think you're right on the money. React is a gateway drug to functional programming.
1
u/TheLastSock Jan 11 '22
It's that because on react you work within the structure of the program (a tree) and that structure is also what your creating?
5
u/fyr3f4wkes Dec 30 '21
I’d love to read a book about this. As an elixir dev there’s barely anything written that talks about programming from this perspective.
1
u/viebel Dec 30 '21
Cool!
Someone wrote a solution for a couple of DOP challenges here. I invite you to add your own.
1
2
u/gdullus Dec 29 '21
Congrats of the achievement! I skimmed through the table of content and i can't find anything regarding modeling of complex domain in Clojure. Have you been able to touch this topic in your book?
5
u/viebel Dec 29 '21
No. Maybe on the second edition.
1
u/Skiamakhos Dec 30 '21
Sounds awesome. I think I may buy the first edition even so, unless the 2nd is likely to be hot on the heels of the first. I'm currently working through "Grokking Simplicity" & trying to implement Normand's ideas in Clojure, as a way to learn the language. Congratulations and thanks for doing this. :-)
3
1
u/kingnuscodus Dec 29 '21
Congrats! I bought the book and look forward to reading it…FWIW I haven’t seen a clojure/script implementation yet, maybe something I can get started on :)
4
u/viebel Dec 29 '21
Please do and share your code by opening a PR here https://github.com/viebel/data-oriented-programming/tree/main/community
13
u/EagleOfMay Dec 29 '21
Congrats on completing the first draft. Writing a book takes a lot of time and dedication. I'll definitely take a look.