Re:Data-Oriented Programming in Python
by wodenokoto on Friday September 18, 2020 @10:45AM
(#24517416)
I thought that data oriented programming was a paradigm that sits next to Object Oriented and Functional programming and I had a lot of trouble understanding the DOP-related articles that have been trending on HN recently.
But apparently it is just what we in R and Python call vectorised functions.
To boil it down:
non-vectorised:
square(2) -> 4
square([2,4]) -> error
vectorised:
square(2) -> 4
square([2,4]) -> [4, 16]
Which doesn't care whether you are passing messages between objects or avoiding side effects through pure functions and monads or imperatively muting your data left and right.
But apparently it is just what we in R and Python call vectorised functions.
To boil it down:
non-vectorised:
vectorised: Which doesn't care whether you are passing messages between objects or avoiding side effects through pure functions and monads or imperatively muting your data left and right.Or am I completely off?