4 ms·
When the whole OOP movement gained traction I struggled to accept the degree of value it provided above simple structs and functions (at least for an organized
by rkagerer 3y ago
When the whole OOP movement gained traction I struggled to accept the degree of value it provided above simple structs and functions (at least for an organized programmer).
After decades developing on a lot of diverse platforms in a variety of languages and models, I've decided there ain't much you can't achieve without structs and functions (or their equivalent).
Sure, any tool is most efficient in the hands of a master who knows how to wield it. But in practice all those shiny extras too often become productivity distractions.
- AnimalMuppet 3y agoTo me, the big difference between a struct and an object is when data has constraints. Let's say I have a rotation matrix. That means that the squares of all the entries in any one row or column add up to 1. If I have such a structure, and I find that it has rows that no longer add up to 1, well, what function messed it up? I have no idea. And if I have a million lines of code, that gives me a lot of places I have to look. But with an object, if I made that data private, only a member function can have messed up. I may still have a thousand lines I have to look at, but that's a lot less than a million. For larger code (tens of thousands of lines and larger), I consider access control to be essential, just to limit the size of the code that could possibly be at fault. Back in the day, I spent a lot of time playing "who messed up the structure?" in structure-and-function code...
- ReleaseCandidat 3y ago> But with an object, if I made that data private Being able to make a field of a record private does have nothing to do with OOP, even in C you can hide a struct's fields.
- deleted 3y ago[deleted]
- angiosperm 3y agoCongratulations, you have discovered Turing Completeness. But it is not a contest of what can be done, but rather of how clearly, succinctly, and performantly it can be done. Modularity is essential to human understanding, but inimical to performance. Succinctness demonstrates economy of expression, where it matters that what people need done is more succinct than things they don't. OO as a movement was childishly silly. OO as an organizational technique among many has been fruitful.