Why Every Developer Should Learn Data Oriented Programming
Data Oriented Programming is an exciting new paradigm that eliminates the usual complexity caused by combining data and code into objects and classes. DOP cleanly separates code and data, which simplifies state management and eases concurrency.
We've asked Yehonathan Sharvit, the author of the book Data Oriented Programming to introduce us to the DOP principles and tell us why every developer should learn this programming paradigm.
Over the last couple of years, I have asked myself: what makes it so fun and productive for me in Clojure? At first, I thought it was the power of expression that Functional programming provides and the short feedback loop of the Clojure REPL. But I was wrong. In fact, what makes Clojure stand out is the fact that it puts data at the centre. By embracing Data-Oriented programming, Clojure reduces the complexity of the system.
In the book, I illustrate the principles of DOP and how each of them reduces the complexity of a software system, whether in the front end or in the back end, no matter what language the system is written in.
Data Oriented Programming (DOP) is a programming paradigm that makes the systems we build less complex. The cool thing is that DOP is language-agnostic: it is applicable to any programming language.
One could adhere to DOP principles (or break them) in:
- Object Oriented (OO) languages: Java, C#, C++…
- Functional Programming (FP) languages: Clojure, Ocaml, Haskell…
The idea behind Data Oriented programming is to simplify the design and implementation of software systems by putting data at the centre. Instead of designing information systems around entities that combine data and code (e.g. objects instantiated from classes), DOP encourages us to separate code from data. Moreover, DOP provides guidelines about how to represent and manipulate data.
The essence of DOP is that it treats data as a first-class citizen. As a consequence, in Data Oriented programs, we manipulate data with the same simplicity as we manipulate numbers or strings in any other programs.
Treating data as a first-class citizen is made possible by adhering to three core principles.
The principles of Data Oriented Programming are:
- Separate code from data
- Represent data entities with generic data structures
- Data is immutable
When these 3 principles are combined together, they form a cohesive whole that allows us to treat data as a first-class citizen. As a consequence, we improve our developing experience and make the systems we build easier to understand.
In a Data-oriented system, code is separated from data and the data is represented with generic data structures that are immutable.
It should be noted that for OO developers, the transition to DOP might require more of a mind shift than for FP developers, as DOP guides us from the beginning to get rid of the habit of encapsulating data in stateful classes.
Throughout the book, we will explore in-depth how to apply DOP principles in the context of production information systems.
Written in a conversation style that hopefully makes it fun to read and easy to digest, the purpose of the book is to spread the word about DOP among the global community of developers so that they build systems that are less complex.
If you’re curious to learn more about Data Oriented Programming you can buy the book here. Use our promo code aff46421 for 30% off.
Sign up now and apply for roles at companies that interest you.
Engineers who find a new job through WorksHub average a 15% increase in salary.Start with GitHubStart with TwitterStart with Stack OverflowStart with Email