You can edit almost every page by Creating an account and confirming your email.

Data-oriented programming: Difference between revisions

From EverybodyWiki Bios & Wiki
WikiMasterBot2 (talk | contribs)
 
WikiMasterBot2 (talk | contribs)
m remove duplicates internal links
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{AFC submission|d|nn|u=Viebel|ns=118|decliner=Hatchens|declinets=20210308050322|ts=20210307070819}} <!-- Do not remove this line! -->
{{AFC comment|1=Every statement in a Wikipedia article should be clearly attributable to a reliable source ([[WP:V]]) - how else can a reader check whether it is true or an editor distinguish it from vandalism/hoax?
{{AFC submission|d|exists|Data-oriented design|u=Viebel|ns=118|decliner=Enterprisey|declinets=20210302204108|small=yes|ts=20210226032357}} <!-- Do not remove this line! -->
 
For [[WP:N]], we need more sources that use the specific term. The sources here just demonstrate that one person has coined a neologism that they say describes a much wider phenomenon - but we need evidence that lots of people use the same framing of the subject. — [[User:Bilorv|Bilorv]] ('''[[User talk:Bilorv|<span style="color:purple">talk</span>]]''') 13:35, 14 July 2021 (UTC)}}


{{AFC comment|1=In agreement with {{u|Enterprisey}}. - [[User:Hatchens|Hatchens]] ([[User talk:Hatchens|talk]]) 05:03, 8 March 2021 (UTC)}}
{{AFC comment|1=In agreement with {{u|Enterprisey}}. - [[User:Hatchens|Hatchens]] ([[User talk:Hatchens|talk]]) 05:03, 8 March 2021 (UTC)}}
Line 8: Line 9:
----
----


{{Distinguish|Data-oriented design}}
{{Disambiguation|Data-oriented design}}
{{Distinguish|Data-driven programming}}
{{Disambiguation|Data-driven programming}}


In [[programming]], '''data-oriented programming''' (DOP) is a [[programming paradigm | paradigm]] based on the treatment of [[Data (computing) | data]] as a [[Value_semantics | value]].  
In [[Computer programming|programming]], '''data-oriented programming''' (DOP) is a [[programming paradigm | paradigm]] based on the treatment of [[Data (computing) | data]] as a [[Value_semantics | value]].  


The main objective of DOP is to reduce<ref>{{Cite web|url=https://www.infoq.com/presentations/Simple-Made-Easy/|title=Simple Made Easy|website=InfoQ}}</ref> the accidental [[Programming complexity | complexity]] of a program as it is defined by [[Fred Brooks]] in his paper [[No Silver Bullet]].
The main objective of DOP is to reduce.<ref>{{Cite web|url=https://www.infoq.com/presentations/Simple-Made-Easy/|title=Simple Made Easy|website=InfoQ}}</ref> the accidental [[Programming complexity | 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.  
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.  
Line 19: Line 20:
== History ==  
== History ==  


It seems that the term "Data-Oriented programming" was coined<ref>{{Cite web|url=https://adtmag.com/articles/2004/08/05/data-integration-a-little-dop-might-do-you.aspx|title=Data integration: A little DOP might do you|website=ADTmag}}</ref> by [[Eugene Kutznetsov]] in 2004. Kustznetsov's term is quoted in Data-Oriented Architecture: A Loosely-Coupled Real-Time SOA<ref>{{Cite web|url=https://community.rti.com/sites/default/files/archive/Data-Oriented_Architecture.pdf|title=Data-Oriented Architecture: A Loosely-Coupled Real-Time SOA|website=RTI}}</ref>.
It seems that the term "Data-Oriented programming" was coined<ref>{{Cite web|url=https://adtmag.com/articles/2004/08/05/data-integration-a-little-dop-might-do-you.aspx|title=Data integration: A little DOP might do you|website=ADTmag}}</ref> by [[Eugene Kutznetsov]] in 2004. Kustznetsov's term is quoted in Data-Oriented Architecture: A Loosely-Coupled Real-Time SOA<ref>{{Cite web|url=https://community.rti.com/sites/default/files/archive/Data-Oriented_Architecture.pdf|title=Data-Oriented Architecture: A Loosely-Coupled Real-Time SOA|website=RTI}}</ref>


[[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<ref>{{Cite web|url=https://clojure.org/reference/data_structures|title=Clojure - Data Structures|website=clojure.org}}</ref> of [[Persistent_data_structure | persistent data structures]]. In The Joy of Clojure<ref>{{cite book |title=The Joy of Clojure|chapter=Chapter 14: Data-oriented programming}}</ref>, the author illustrates the benefits of treating data as data in Clojure.
[[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<ref>{{Cite web|url=https://clojure.org/reference/data_structures|title=Clojure - Data Structures|website=clojure.org}}</ref> of [[Persistent_data_structure | persistent data structures]]. In The Joy of Clojure<ref>{{cite book |title=The Joy of Clojure|chapter=Chapter 14: Data-oriented programming}}</ref>, the author illustrates the benefits of treating data as data in Clojure.
Line 34: Line 35:
   ["lastName", "Asimov" ]
   ["lastName", "Asimov" ]
]);
]);


function fullName(author) {
function fullName(author) {
Line 61: Line 61:
* Data can be manipulated by general-purpose functions<ref>{{Cite web|url=https://www.cognitect.com/blog/2016/6/28/the-new-normal-data-leverage|title=The New Normal: Data Leverage|first=Michael|last=Nygard|date=June 28, 2016|website=Cognitect.com}}</ref>
* Data can be manipulated by general-purpose functions<ref>{{Cite web|url=https://www.cognitect.com/blog/2016/6/28/the-new-normal-data-leverage|title=The New Normal: Data Leverage|first=Michael|last=Nygard|date=June 28, 2016|website=Cognitect.com}}</ref>


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


== DOP Languages ==
== DOP Languages ==
Line 67: Line 67:
DOP is language agnostic. For example, DOP is applicable in languages that support [[object-oriented (programming) | object-oriented programming]] or [[functional (programming) | functional programming]]. While it is more natural to apply DOP in [[dynamic typing | dynamically-typed]] languages, it could also be applied to [[statically-typed programming language | statically typed languages]].
DOP is language agnostic. For example, DOP is applicable in languages that support [[object-oriented (programming) | object-oriented programming]] or [[functional (programming) | functional programming]]. While it is more natural to apply DOP in [[dynamic typing | dynamically-typed]] languages, it could also be applied to [[statically-typed programming language | statically typed languages]].


There exist efficient implementation of persistent data structures in [[Persistent_data_structure#Usage_in_programming_languages | many programming languages]].
There exist efficient implementation of persistent data structures in many programming languages.


== Comparison with other programming paradigms ==  
== Comparison with other programming paradigms ==  
Line 79: Line 79:
=== Comparison to functional programming ===
=== Comparison to functional programming ===


Like DOP, [[Functional_programming | 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 [[Scope_(computer_science)#Lexical_scope | lexical scope]] could break the clear separation between code and data that DOP requires.
Like DOP, [[Functional_programming | 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 ==  
== See also ==  
{{Portal|Computer programming}}
{{Portal|Computer programming}}


* [[Object-oriented programming]]
* Object-oriented programming
* [[Functional programming]]
* Functional programming
* [[Data-oriented design]]
* Data-oriented design
* [[Persistent data structures]]
* [[Persistent data structures]]


Line 94: Line 94:


== Submitting again after having addressed reviewer rejection here https://en.wikipedia.org/wiki/User_talk:Enterprisey#Data-oriented_programming ==
== Submitting again after having addressed reviewer rejection here https://en.wikipedia.org/wiki/User_talk:Enterprisey#Data-oriented_programming ==
 
{{⚠️🚨COPIED from EverybodyWiki ❗❕⚠️😡😤Please respect Licence CC-BY-SA ❗}}
{{AfC submission|||ts=20210312125803|u=Viebel|ns=118}}
{{Source Wikipedia}}
{{Source Wikipedia}}

Latest revision as of 04:47, 26 July 2026





__DISAMBIG__

__DISAMBIG__

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

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

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

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

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

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

Contrast with object orientation

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

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

References

  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
  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


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.