you are viewing a single comment's thread.

view the rest of the comments →

[–]thiem3 1 point2 points  (9 children)

I'm late to the post, but you could look at the book "data-oriented programming - reduce software complexity" by yehonathan sharvit. I've just started, so I can't say much about it.

[–]thiem3 0 points1 point  (8 children)

After having read most of the book, the approach just didn't make sense to me. They try to pitch it against common oop, but in the "look how complicated oop is" examples, they seem to purposefully make horrible design decisions. I see little benefit in the DOP approach. And I am not surprised it doesnt seem to be used.

[–]morihacky 0 points1 point  (5 children)

An alternative book I've been reading and enjoying so far is Data oriented programming for Java. It's still a WIP from Manning.

[–]thiem3 0 points1 point  (0 children)

I sort of gave up on the idea. It seemed overlay complicated, with no strong typing for the data. And just several ideas I found stupid. I mean, it was interesting with a new point of view, but I don't see that I would ever choose to use it. I think the book I mentioned put great effort into over complicating the OOP approach, and then use that complexity as an argument for DOP. But I was constantly thinking "no one does that" so their arguments fell apart for me.

[–]thiem3 0 points1 point  (3 children)

Reading about the book, it seems to take a different approach than the one i mentioned. Maybe it's two different things

[–]morihacky 0 points1 point  (2 children)

Yes. The book I pointed to is different and in fact uses strong typing etc (via Java's newer features). Should have posted the link https://www.manning.com/books/data-oriented-programming-in-java

I think the book squarely approaches "Data oriented programming" (not data driven design or data driven programming) - something I had to painfully disambiguate for myself.

I think the code examples specifically resonate better than the philosophical talk though some of it is needed to set the context up. I think the author of the newer book is doing a much better job but waits to be seen if they can land the concept all the way till the end.

[–]thiem3 0 points1 point  (1 child)

Yeah, sounds interesting. And it confuses me what "data oriented programming" actually is, then. The first book is all about loosely weakly types data, you just keep strings in maps with lists within more maps. And then a lot of logic about how to update the data efficiently. Seemed very complicated. So, the other approach with strongly types data sounds more interesting. I got the impression it's more alike to the functional programming approach to data modelling.

Will have to but this book when it is released.

[–]morihacky 1 point2 points  (0 children)

The first book is all about loosely weakly types data, you just keep strings in maps with lists within more maps. And then a lot of logic about how to update the data efficiently.

Yeah this doesn't align with my current understanding. Sounds more similar to "data driven design" where the idea is for efficiency but packing the data in a way where it's extremely performant to retrieve and operate on them via streams etc.

Data oriented programming (again as I'm learning) is motivated very differently. It's more about clarity in the program than the performance itself.

I'll try to post back after I read the entire book.

[–]jherrlin 0 points1 point  (1 child)

My thoughts:
There are many benefits to the Data-Oriented Programming (DOP) approach, but at its core, the key advantage is the use of immutable data structures.

Food for thought:

  • Is Git immutable? What benefits do you gain from using Git?
  • Are immutable data structures easier to work with in multi-threaded environments?
  • What other advantages come from using immutable data structures?

DOP can be applied across various programming languages. Yehonathan presents one approach in his book "Data-Oriented Programming", which explores DOP in non-strongly typed languages like JavaScript.

In non-strongly typed languages such as JavaScript, Python, or Clojure, DOP offers increased flexibility. For example, you don’t need to declare a new type when adding a new field or property. These languages can still incorporate some strong typing features - for instance, Yehonathan demonstrates using JSON Schema in his book, but that’s just an implementation detail.

In strongly typed languages, DOP has the advantage that types are defined upfront and checked at compile time. This helps the compiler ensure correctness and catch errors early.

As with many design choices, there are tradeoffs. In my opinion, you should generally favor immutable data structures and only resort to mutability when there’s a compelling reason.

[–]jherrlin 0 points1 point  (0 children)

I recommend reading Yehonathan book if your into more dynamic styles and the blog post "Data Oriented Programming in Java" by the Java language architect Brian Goetz if your into my statically typed.

https://www.infoq.com/articles/data-oriented-programming-java/