4

Principles of Data-Oriented Programming

 1 year ago
source link: https://blog.klipse.tech/dop/2022/06/22/principles-of-dop.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Principles of Data-Oriented Programming

June 22, 2022 dop

This article is an excerpt from my book about Data-Oriented Programming.

More excerpts are available on my blog.

Now that my book is completed, I have a better understanding of the core principles of Data-Oriented Programming. This article is a rewrite of my previous article about DOP Principles from September 2020.

Data-oriented programming (DOP) is a programming paradigm aimed at simplifying the design and implementation of software systems, where information is at the center in systems such as frontend or backend web applications and web services, for example. Instead of designing information systems around software constructs that combine code and data (e.g., objects instantiated from classes), DOP encourages the separation of code from data. Moreover, DOP provides guidelines about how to represent and manipulate data.

In DOP, data is treated as a first-class citizen.

The essence of DOP is that it treats data as a first-class citizen. It gives developers the ability to manipulate data inside a program with the same simplicity as they manipulate numbers or strings. Treating data as a first-class citizen is made possible by adhering to four core principles:

When these four principles are combined, they form a cohesive whole. Systems built using DOP are simpler and easier to understand, so the developer experience is significantly improved.

do principles mind map
In a data-oriented system, code is separated from data. Data is represented with generic data structures that are immutable and have a separate schema.

Notice that DOP principles are language-agnostic. They can be adhered to (or broken) in

  • Object-oriented programming (OOP) languages such as Java, C#, C++, etc.

  • Functional programming (FP) languages such as Clojure, OCaml, Haskell, etc.

  • Languages that support both OOP and FP such as JavaScript, Python, Ruby, Scala, etc.

This series of articles succinctly illustrates how those principles could be applied or broken in JavaScript. Mentioned briefly are the benefits of adherence to each principle, and the costs paid to enjoy those benefits. This article also illustrates the principles of DOP via simple code snippets. Throughout my book Data-Oriented Programming, the application of DOP principles to production information systems is explored in depth.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK