Data-oriented programming (DOP) organizes software around data entities and stateless code modules. It aims to reduce complexity—the difficulty of understanding a system—by separating code from data, representing data generically, and treating data as immutable values. section 1.2 section 2.6
Consider a library system whose requirements keep changing. Instead of hiding member data inside objects and growing a class hierarchy for every membership rule, DOP keeps library data in data entities and places behavior in modules such as UserManagement, Catalog, and Library. New rules usually become new functions or small changes to existing functions. section 2.1 section 2.5
A DOP system follows several practical constraints:
- Separate code from data: data entities contain members only, while code modules aggregate stateless functions. section 2.4
- Pass manipulated data explicitly to functions rather than relying on an object’s implicit state. section 2.6
- Represent records as heterogeneous string maps and collections as arrays, lists, vectors, sets, or other suitable collections. section 3.0 section 3.2
- Keep module relationships to usage and data relationships to association or composition; avoid inheritance as the primary organizing mechanism. section 2.6 section 2.4
- Treat primitive values and collections alike as immutable values when possible, making behavior easier to reason about. section 1.2.2
Adding library permissions
A stateless Library.getBookLendings function can receive libraryData, userId, and memberId, then call UserManagement.isLibrarian and Catalog.getBookLendings. To support Super members, add UserManagement.isSuperMember and extend the permission condition; the data model and overall module design remain unchanged. The same pattern lets VIP members call Library.addBookItem through a new UserManagement predicate. section 2.5
Reproducing a data scenario
Capture a function’s map and query arguments, paste them into a clean REPL session, and improve the function without repeatedly invoking the endpoint. A reproduced catalog search exposes a failing prefix search, after which the implementation can be changed and tested against the same data. section 15.3
Table 1.1 Aspects of OOP and their impact on system complexity (view table figure)
| Explicit synchronization is required on multi-threaded environments. |
|
Compare how mixing code and data, mutability, encapsulation, and class-bound behavior increase understanding, synchronization, serialization, and hierarchy costs. section 1.2

