7 points · by viebel · 5y ago · 25 comments
The specific structure can be part, but the difference is exactly as is on the name.
Niklaus Wirth say:
Algorithms + Data Structures = Programs
Most paradigms pay a bigger attention to the "Algorithms" side. And data is a distant second class citizen."Functional Programming" is about functions. All discussions are centerer in the algorithms related to it.
"Object oriented" is about objects. All discussions are centerer in the algorithms related to it.
But this is distracting:
Show me your flowcharts, and conceal your tables, and I shall continue to be mystified; show me your tables and I won’t usually need your flowcharts: they’ll be obvious.
Fred BrooksThat is why a lot of people get drown in abstractions, instead of solve what the problem is.
---
Now, if we instead make data the driver of the decisions a lot of things can be simplified. A common example is when we ditch "abstracting-away" ORMs and just use SQL (that is data oriented), because hide/not use at full what a RDBMS is moronic.
----
But both are part of the same coin. So if data become truly important, WHICH algorithms fit it better?
This is where become easier to work on data with structural comparisons, immutability, etc. Is in fact a relational way of think, just with other names and probably a small part of it.
---
Now the answer is more like "yes" because focus in how represent data is actually big part of the deal, but that still can make some to get carry away by the algorithms of it, like get too focused in make use of persistent structures instead of exactly think on HOW to represent the data that allow the best way to manipulate it.
Also Clojure not emphasizing the power of types… but types emphasize programming with data awareness.
Things like http routing, schemas of data (malli / spec), having an in-memory "app-db" storing all state for a CloureScript web frontend, etc. You can then employ universal and powerful data traversal/validation/manipulation tools in Clojure to these data structures.
Also array Langs like kdb+?
The main difference between DOP and FP is that in DOP we use generic data structures to represent data (e.g. maps and lists)
p.s. given that I strongly disagree with your definitions of DO and FP.
DOD/P: Data oriented design and programming is structuring code in light of form, size, access patterns of data. Efficient access and ops on domain specific data is the name of the game. Strictly speaking, this is an optimization approach and not a genuine general programming paradigm. In sum: organize your data layout to maximize efficient processing suited to your application. (DB analog: 1st normal form is DoD. 5th normal form is anti-DOD.)
FP: true to its mathematical origins, FP is mainly about transformation of data via a methematical treatment. Arguably, algorithms are far more central to FP than data. A significant manifestation of this fact is the existence of "lazy" and "strict" evaluation in FP runtimes which flies in the face of the primary concerns of Data Oriented Programming (which came from gaming). FP in no way addresses memory layout as a primary concern. FP is a conceptual general purpose paradigm.
DO as I understand it is about recognizing how data is actually laid out and interacted with by a processor, as opposed to meaningful abstract relationships to a programmer. It's about breaking down costly abstractions, rather than ignoring the cost of higher level abstractions.
DO exists primarily in opposition to OO, not FP. The classic example is the array of structs to struct of arrays (OO to DO transformation).
https://blog.klipse.tech/visualization/2021/02/16/data-relat...
I need this written on a huge poster behind my desk