Review: What is Data Oriented Programming?

Naming is the hardest problem in computer science, so I doubt we will be able to solve it.

That said, whatever their name, these are some of the ideas I see:

Tentatively known as the Data Driven style

It’s the idea that you create DSLs which are made out of descriptive data. And then there is an interpreter/compiler which performs the necessary computations/actions as described by the data DSL. Examples of this are: hiccup, garden, regal, tools.deps, lein, datomic, datascript, meander, etc.

When applied to a more normal program, this might manifest by modeling actions as a data-structure of commands to be executed by a component that consumes them.

Tentatively known as Data Oriented style

If object oriented is the style where you model your domain using objects. Data oriented is the style where you model your domain using data. Examples of this is most things in Clojure, where your domain information will be mapped to Clojure data-structures such as persistent maps, vectors, lists, sets, etc. And in doing so, it means that you can now use functions which are generic over the type of information, in that they work for any data, no matter what the data represent.

Tentatively known as Data

We’ve been talking a lot about data, but what is it? The idea of “data” is that of having structured values. Values can be either dimensions (aka labels) or metrics (aka quantities). And data is a particular arrangements (aka structuring) of one or more values. Thus when I say data in the above two styles, I mean data structures of values.

One last thing to note is that two values are equal if they have equal dimensions and measures. And two pieces of data are equal if they have equal structural partitions and values.

Tentatively known as Data Oriented in gaming (but it’s a different idea)

While it shares name, this is a very different idea, and “data” here means something different as well, and Data Oriented means something different.

In this style, data refers to computer memory, all form of memory. I wish they’d called it Memory Oriented to be honest. Memory can be RAM, CPU caches, SSDs, HDDs, DVDs, etc.

It is the idea that you model your domain in a way that is most appropriate for the type of computer memory you will store it in. It contrasts itself to both Object Oriented, where we model the domain with objects, no matter where we are going to be storing the domain information in. As well as the prior Data Oriented, where we would model the domain as close to how the domain itself structures the information. In this Data Oriented style, we would not structure the data how the domain structures it, but how the computer memory itself is structured. And we wouldn’t use values that are same as the ones in the domain either, we would again use values that the computer memory itself supports, even at the price of losing precision (because the goal of this style is performance).

At least these are some of the ideas I see floating around. There’s more ideas out there, and there’s also many variants of the above ideas as well. Naming each one is a hard problem :yum: If only we all named things using namespaced names :smirk:

org.clojure/data-oriented

No more confusion hehe

2 Likes