Data-Oriented Programming by Yehonathan Sharvit is a great book that gives a gentle introduction to the concept of data-oriented programming (DOP) as an alternative to good old object-oriented programming (OOP). Sharvit deconstructs the elements of complexity that sometimes seems inevitable with OOP and summarizes the main principles of DOP that helps us make the system more manageable.
As its name suggests, DOP puts data first and foremost. This can be achieved by adhering to four main principles. These principles are language-agnostic. They can be represented in OOP languages (Java, C++, etc.), functional programming (FP) languages (Clojure, etc.) or general-purpose languages (Python, JavaScript). Whereas the author illustrates his examples using JavaScript and Java, this article attempts to demonstrate the ideas in Python.
Following along the article, you’ll find simple code snippets in Python that illustrate how each principle can be adhered to or broken. Sharvit also clarifies what the benefits and costs for each principle — many of them are relevant in Python whereas some are not.
Please note all the principles, corresponding advantages and drawbacks mentioned are credited to Yehonathan Sharvit, whereas the viewpoints on the applicability of these statements to Python, in conjunction with the Python code illustrations, are my own.