data-oriented-programming

Spread the word among the global developer community about Data-Oriented programming https://en.wikipedia.org/wiki/Draft:Data-oriented_programming
2021-02-19T01:23:43.051500Z

Interesting... thanks for this additional context. I wasn't aware of all of these.

2021-02-19T01:30:14.054700Z

This is a bit funny, because I realize I have frequently called the thing I am talking about "data-driven programming", which apparently is already a term for something which I see as related but different (though it does list Clojure in that article).

2021-02-19T01:32:17.056700Z

However, I do think there is a distinct concept from the above descriptions which encapsulates both data oriented programming as I gather you see it, as well as this particular notion of a data-oriented approach to declarative programming, as described above.

2021-02-19T01:33:56.058500Z

And the connection is simple: Data oriented declarative programming (if we need to be distinct about it), is specifically data oriented programming applied to declarative programming. How do you represent the "declarations"? AS DATA!

2021-02-19T01:34:19.059Z

So I see this more specific application as a specific instance or subclass of the other

2021-02-19T01:34:42.059300Z

This is my perspective at least.

2021-02-19T01:34:50.059500Z

I'm curious to hear what others have to say.

2021-02-19T01:36:27.061200Z

And thank you for sharing views different to mine. It's been interesting (re-)evaluating how I describe and refer to these ideas.

Yehonathan Sharvit 2021-02-19T06:20:06.063700Z

Yeah. I have been doing lots of research over the last year to be able to “distill the essence” of data-oriented programming and how it reduces the complexity of the system we build.

Yehonathan Sharvit 2021-02-19T06:20:33.064200Z

In Clojure, it’s so natural that we don’t pay attention to it

Yehonathan Sharvit 2021-02-19T06:21:04.065Z

My vision is to spread the word about DOP among non Clojure developers

Yehonathan Sharvit 2021-02-19T06:21:56.065800Z

For that, we need to make sure we (the Clojure developers) understand clearly what DOP is and how it reduces complexity

Shantanu Kumar 2021-02-19T08:40:28.069400Z

I see there are several levels at which DOP could be applied: (A) In the small, i.e. DOP at the function and fn composition level in terms of program design, (B) In libraries that encompasses a completely orthogonal concern, e.g. a data-oriented rule engine such as O’Doyle etc, web framework such as Ring etc., (C) In the large, i.e. DOP at a distributed systems scale (refer Rich Hickey’s Language of the system talk) where he talks about Storm and Riemann.

Shantanu Kumar 2021-02-19T08:44:03.071500Z

In the “implementation context”, since pure data transformation has to be interleaved with I/O for real life programs, DOP has a dual in “Functional Core, Imperative Shell” approach (as in the “Onion Architecture”).

Yehonathan Sharvit 2021-02-19T08:51:30.072600Z

@kumarshantanu Would you like to add a section about applications of DOP in the Wikipedia article https://en.wikipedia.org/wiki/Draft:Data-oriented_programming ?

Shantanu Kumar 2021-02-19T08:59:05.072800Z

I will think about the content/pitch/structure.

Yehonathan Sharvit 2021-02-19T09:00:31.073Z

Great

Yehonathan Sharvit 2021-02-19T09:00:45.073200Z

Ping me after you add your content to the draft

Yehonathan Sharvit 2021-02-19T12:40:33.074300Z

@metasoarous Take a look at what @didibus wrote about the various data-* paradigms

Yehonathan Sharvit 2021-02-19T12:43:33.075200Z

Does what @didibus call “data-driven programming” resonate with what you had in mind?

2021-02-19T12:51:59.076Z

Does anyone know In the manning book Data Orientated Programming, what language are the code snippets in?

Yehonathan Sharvit 2021-02-19T12:53:04.076100Z

Most of them are in JavaScript.

Yehonathan Sharvit 2021-02-19T12:53:43.076300Z

I am considering to add a version of the snippets for Java

2021-02-19T12:54:10.076500Z

Wouldyou say the book is ok for someone who doesnt have lot of experience in javascript?

2021-02-19T12:54:38.076700Z

As I undestand it, the concepts are language agnostic

Yehonathan Sharvit 2021-02-19T12:56:29.076900Z

Definitely. The concepts are language agnostic and we illustrate them with JavaScript, using only the simple parts of JavaScript (no fancy features of the language). Most snippets read as pseudo code

Yehonathan Sharvit 2021-02-19T13:22:52.078200Z

I am going to write a blog post that clarifies the distinction between 3 concepts that contain data in their name. • Data-oriented programming • Data-oriented design • Data-driven programming

Yehonathan Sharvit 2021-02-19T13:23:01.078500Z

Here is what I have for now:

Yehonathan Sharvit 2021-02-19T13:23:02.078700Z

Data-oriented programming is not really a new concept. It is a paradigm that is applied by developers from different programming languages. What’s new is the fact that this paradigm has an official name. The purpose of this article is to distinguish between Data-oriented programming and two other programming paradigms: Data-oriented design and Data-driven programming. > There are only two hard things in Computer Science: cache invalidation and naming things. — Phil Karlton ## Data-oriented design Data-oriented design is a program optimization approach motivated by efficient usage of the CPU cache, used mostly in video game development. The approach is to focus on the data layout, separating and sorting fields according to when they are needed, and to think about transformations of data. In this context, what’s important is how the data resides in memory. The objective of this paradigm is to improve the performance of the system. ## Data-driven programming Data-driven programming is the idea that you create domain specific languages (DSLs) which are made out of descriptive data. It is a branch of declarative programming. In this context, what’s important is to describe the behaviour of a program in terms of data. The objective of this paradigm is to increase code clarity and to reduce the risk of bugs related to mistakes in the implementation of the expected behaviour of the program. ## Data-oriented programming Data-oriented programming is a paradigm that treats the data of the system as a first-class citizen. The data is represented by generic immutable data structures (like maps and vectors) that are manipulated by general purpose functions (like map, filter, select, group-by ...). In this context, what’s important is how the representation of data by the program. The objective of this paradigm is to reduce the complexity of the system.

Yehonathan Sharvit 2021-02-19T13:23:11.078900Z

Feedback welcome

Yehonathan Sharvit 2021-02-19T14:11:36.080Z

Welcome @merklefabian to our community

Yehonathan Sharvit 2021-02-19T14:12:08.080500Z

Could you tell us a bit about yourself and your interest in DOP?

Fabim 2021-02-19T14:14:11.080700Z

Hey I just saw your talk on YouTube. I’m developing a game in Clojure and want to use DOP to accelerate my development.

Yehonathan Sharvit 2021-02-19T14:14:39.080900Z

DOP or DOD?

Yehonathan Sharvit 2021-02-19T14:15:13.081100Z

Are you interested to accelerate the time it takes to develop the game or accelerate the time it takes the CPU to render the game?

Fabim 2021-02-19T14:15:52.081400Z

the time it takes to develop. CPU is not an issue currently

Yehonathan Sharvit 2021-02-19T14:21:40.081600Z

DOP will definitely help you!

Fabim 2021-02-19T14:23:13.081800Z

Do you know of any example game projects where it was applied?

Yehonathan Sharvit 2021-02-19T14:23:35.082Z

No

Yehonathan Sharvit 2021-02-19T14:23:42.082200Z

Ask on the channel

👍 1
Fabim 2021-02-19T14:25:45.083300Z

Do you know of any example project where DOP is applied in game development?

pithyless 2021-02-19T16:05:32.089200Z

I'll admit I've also been using the term "data oriented programming" to describe the hybrid approach of using DDP and DOP together (as defined by @viebel above). For example, I consider the approach of such libraries like reitit and malli to be declarative descriptions of computation and behavior, that are taking advantage of the fact that by reusing existing generic immutable data structures can lean on all the benefits of existing Clojure tooling. So does that make them a hybrid of DDP and DOP? OTOH, something like meander is clearly a declarative description of computation that is a more custom DSL that I would not consider transforming as easily via regular clojure data functions (so DDP, but not DOP).

pithyless 2021-02-19T16:06:35.090400Z

Is that a fair assessment? And is there a term for something that is both DDP and DOP? (Since I find lots of Clojure code is moving in that direction - and it does have certain interesting benefits over just DDP)

pithyless 2021-02-19T16:13:36.092800Z

Also, are computation graph libraries (e.g. plumatic/graph, onyx, pathom) that use normal Clojure data structures to define computations declaratively via an EDN dependency graph (+ opaque resolving function) considered DDP/DOP/both/neither?

Shantanu Kumar 2021-02-19T20:54:32.093100Z

@merklefabian You may want to check out O’Doyle rules engine, which was originally created to develop games quite productively. O’Doyle is heavily data oriented.

Shantanu Kumar 2021-02-19T20:56:40.093300Z

And this video for a demo: https://www.youtube.com/watch?v=XONRaJJAhpA&ab_channel=sekao