Data-Oriented Programming
What is Data-Oriented Programming?
Data-Oriented Programming: Instead of bundling data and behaviour into objects, you keep data as plain, generic structures (maps, arrays, records) and write functions that transform that data. This favours simplicity, serialisability, and — in performance-critical contexts — cache-friendly memory layout. Data-oriented programming keeps data and behaviour apart. Data lives in plain, generic structures such as arrays, maps and records. Separate functions take that data in and return new data out.
Frequently asked questions about Data-Oriented Programming
How is Data-Oriented Programming used in practice?
This contrasts with classic object-oriented design, where each class bundles its data with the methods that work on it. In a data-oriented style, an order is simply data, and functions like calculateTotal($order) work on it.
What should you keep in mind with Data-Oriented Programming?
The approach makes data easy to inspect, serialise and test, and functions easy to reuse. In game development and high-performance code, it also means laying data out in memory so the processor can read it efficiently. In typical web applications, you meet a milder form: immutable data objects, pure helper functions and collections pipelines that transform data step by step.
At a glance
| Category | Programming paradigms |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |