1

I know a bit about data oriented design, like rather than having a class for a single object, you have a class which contains multiple objects, like instead of:

struct Circle { int x, y; int radius;  };

You would have:

struct Circles { std::vector<int> xpos; std::vector<int> ypos; std::vector radii };

(I hope that this is a correct interpretation of data oriented design) However, is there like a data driven way of doing this or what?

1mcrazy
  • 13
  • 1
  • 3
  • Why not combine both, so you have a `std::vector Circles;`? – Some programmer dude Apr 06 '21 at 17:19
  • @Someprogrammerdude I think it's probably because it is Data Oriented rather than Object Oriented, the code was inspired by this answer: https://stackoverflow.com/questions/1641580/what-is-data-oriented-design According to the answer, the way you are doing it is the OOP approach rather than the DOD one – 1mcrazy Apr 06 '21 at 19:33

1 Answers1

1

The two are not related. Data-driven programming is about processes that consume and produce streams of info. Think: Unix commands that you link together in pipelines. DDP covers more than single-line pipelines; graph networks of inputs and output; and even output routing conditional on inputs. Within a process, a network of coroutines could be an example of data-driven programming. The wikipedia article covers this well.

Data-oriented design pays attention to how complex data is stored; for cache effectiveness, or for eliminating lock contention by generating copies. Column- vs row- stores of data are a database application of DoD. As a side effect, DoD seems to cross swords with OOD; where the latter tries to hide object base data. DoD exposes data, so the user can choose to process structured collections in a way that best works with actual storage. The wikipedia article is a kind of thin.

Mischa
  • 2,240
  • 20
  • 18
  • So, data driven programming is more like let's say a Discord bot [ IIRC those things use Coroutines ] While data oriented would be something like, a particle system or something? – 1mcrazy Apr 06 '21 at 19:37
  • I plead ignorance about Discord bots. Coroutines at all are a small subset of ddp. ddp gets interesting when a network of banks firehose streams of transactions at one another. Particle systems smell like DDP to me: many independent parts talking. DoD focuses on hard time constraints, and lots of data. Check youtube for "Mike Acton": a (games) expert and good talker. DoD often looks closer-to-the-metal than (say) object-oriented design ... but I find DoD applies to high level design, particularly in DDP situations :-) hth – Mischa Apr 07 '21 at 20:21