3 ms·
As I see it, there are two types of DOD, one that you've mentioned and where you “work on structs of arrays, not arrays of structs”. The other one means just g
by DeathArrow 3y ago
As I see it, there are two types of DOD, one that you've mentioned and where you “work on structs of arrays, not arrays of structs”.
The other one means just giving up of encapsulation, separate the data from the methods that work with the data, think the whole app in terms on how the data flows through it and model it so everything is easy to understand and change. For added correctness, you can use immutable data structures and pure functions.
- hohohmm 3y agoThis is exactly right. Good summary.
- butterNaN 3y agoIsn't this the very definition of functional programming?
- tsss 3y agoNo. Functional programming is programming with functions as values. It is not incompatible with data hiding (for example through modules).
- butterNaN 3y ago"Programming with functions as values" is merely one of the side effects, a feature, of writing your programs functionally. It does not define the paradigm.