3 ms·
Good points. However, object oriented programming doesn't necessarily mean arrays of objects. I'd disagree that it encourages it in any way. I realize that's
by jofer 11y ago
Good points. However, object oriented programming doesn't necessarily mean arrays of objects. I'd disagree that it encourages it in any way.
I realize that's a common paradigm in Java and C++, but it's an architectural decision that you make, not a part of a programming paradigm. The array-of-structs prevalence really stems from C, not object-oriented approaches.
You can do both in a object-oriented manner. For example:
points = Points(xarray, yarray, zarray)
vs
points = [Point(x0, y0, z0), Point(x1, y1, z1), ...]
If you're mostly operating on a series, it makes more sense to structure objects and methods around the former "plural" approach, anyway.