Welcome to EverybodyWiki 😃 ! Nuvola apps kgpg.png Log in or ➕👤 create an account to improve, watchlist or create an article like a 🏭 company page or a 👨👩 bio (yours ?)...

Data-oriented programming

From EverybodyWiki Bios & Wiki








In programming, data-oriented programming (DOP) is a paradigm based on the treatment of data as a value.

The main objective of DOP is to reduce.[1] the accidental complexity of a program as it is defined by Fred Brooks in his paper No Silver Bullet.

Like in Functional programming, DOP prevents data from being mutated in place. However, in DOP data is represented with generic data structures (like maps and arrays), without the necessity to specify data types. As a consequence, data can be accessed with code that is not coupled with data definition and can manipulated with general-purpose data manipulation functions.

History[edit]

It seems that the term "Data-Oriented programming" was coined[2] by Eugene Kutznetsov in 2004. Kustznetsov's term is quoted in Data-Oriented Architecture: A Loosely-Coupled Real-Time SOA[3]

Clojure has been the first language to provide an efficient way to apply Data-oriented programming in production systems in 2007, by providing an efficient implementation[4] of persistent data structures. In The Joy of Clojure[5], the author illustrates the benefits of treating data as data in Clojure.

Since then, efficient persistent data structures have been implemented in many programming languages, which makes it practical to apply Data-oriented programming in more languages.

Examples[edit]

Here is a classic example of Data-Oriented programming in JavaScript using Immutable.js immutable collections.

var author = Immutable.Map([ 
  ["firstName", "Isaac" ], 
  ["lastName", "Asimov" ]
]);

function fullName(author) {
  return author.get("firstName") + " " + author.get("lastName")
}

The author data is represented by an immutable map.

The function that manipulates the data is decoupled from the internal representation of the data. The only information that the function assumes is about the name of the data fields.

Separation between code and data[edit]

According to DOP, there should be a clear separation between code and data.

The code could be defined in functions or in classes, constrained by:

  • Functions should not access data via lexical scope.
  • Classes should not have member fields.

Data Representation[edit]

The two main properties of the data in a data-oriented program are:

  • Data is immutable.
  • Data can be manipulated by general-purpose functions[6]

The most common way to represent the data in a data-oriented program is with persistent data structures.

DOP Languages[edit]

DOP is language agnostic. For example, DOP is applicable in languages that support object-oriented programming or functional programming. While it is more natural to apply DOP in dynamically-typed languages, it could also be applied to statically typed languages.

There exist efficient implementation of persistent data structures in many programming languages.

Comparison with other programming paradigms[edit]

Contrast with object orientation[edit]

In DOP, there is a clear separation between code and data. It contrasts with the concept of an object in object-oriented programming, which can contain data and code.

However, it is possible to apply DOP in an object-oriented language by prohibiting the presence of fields in the classes, considering the class only as an aggregation of static methods.

Comparison to functional programming[edit]

Like DOP, Functional programming (FP) advocates the immutability of the data. However, FP allows the usage of specific types to store aggregate data which contrasts with the generality of the data representation that DOP encourages. Also, in FP usage of lexical scope could break the clear separation between code and data that DOP requires.

See also[edit]


Other articles of the topic Computer programming : Soaplab, The Countess of Lovelace, Koseven (framework), AdoptOpenJDK, JDK Flight Recorder, Zig (programming language), Peachpie (compiler)
Some use of "" in your query was not closed by a matching "".Some use of "" in your query was not closed by a matching "".

  • Object-oriented programming
  • Functional programming
  • Data-oriented design
  • Persistent data structures

References[edit]

  1. "Simple Made Easy". InfoQ.
  2. "Data integration: A little DOP might do you". ADTmag.
  3. "Data-Oriented Architecture: A Loosely-Coupled Real-Time SOA" (PDF). RTI.
  4. "Clojure - Data Structures". clojure.org.
  5. "Chapter 14: Data-oriented programming". The Joy of Clojure. Search this book on Amazon.com Logo.png
  6. Nygard, Michael (June 28, 2016). "The New Normal: Data Leverage". Cognitect.com.

Submitting again after having addressed reviewer rejection here https://en.wikipedia.org/wiki/User_talk:Enterprisey#Data-oriented_programming[edit]

This article "Data-oriented programming" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Data-oriented programming. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.