3 ms·
You've hit the nail on the head, and I think the replies below aren't getting your original point. Which I think is actually your point :-) The defining featur
by cmrdporcupine 3y ago
You've hit the nail on the head, and I think the replies below aren't getting your original point. Which I think is actually your point :-)
The defining feature of OO approaches is in shifting the emphasis in sw development into the concept of identity-bags. All the other stuff about message passing, encapsulation, inheritance etc is just window dressing and implementation details of this core concept of identity-classification in software systems.
I like how the "Out Of the Tarpit" (2006) paper breaks this down into the notion of "intentional" vs "extensional" identity, and I think this is a great model.
For them, OO is all about "intentional identity" in that we create identities (objects, components) in our systems and move attributes and behavior onto them. OO shifts the analysis of software to identifying objects, components, services, and then makes software development all about the taxonomical management of them. In this model of software development, it's all about identifying components and then shuffling the data and functionality "into" them and managing the flow between them. (FWIW the paper identifies this way of thinking as one of the prime culprits in unnecessary complexity in software systems, and I agree with them.)
The contrast is "extensional" identity, where identity in the software systems are emergent from their attributes. In this box we can put the relational data model, and its cousins in logic programming (prolog, datalog etc). In those systems, we are not concerned with "creating" identities and classifying systems/components/objects, but instead declaring the raw attributes -- tuples, facts, relations -- only. Queries then produce, at runtime, a multitude of results from permutations of those attributes. And, as you point out, equality/inequality is defined by the value of a tuples attributes, not by the object it lies in. This is crucial.
There's a couple generations of software developers that are so immersed in the OO/intentional-identity way of thinking that they don't see that it's not intrinsic to software development, but actually a mental framework that was fostered through the 80s and 90s. It was an attempt to manage complexity and structure in software systems and also to create a marketplace of re-usable components. But I think it's actually failed at that.
Most classes, objects, components, microservices end up failing in two respects: they end up reflecting the company's org chart more than anything else, and .. worse .. the bulk of the code and complexity ends up being how one moves data between all these (programmer created) systems rather than what the actual data is. The relationships (lines) between the boxes becomes the focus instead of the stuff was shoved into the box, and the whole behavior of the system becomes difficult to reason about.
And when developers encounter systems that don't work along this model -- relational databases, functional programming, logic programming -- they often scratch their heads, resist, or wrap them up/confine them in OO/component type structures... damaging their usefulness.
- kaba0 3y agoA great, and often under-appreciated point is - as put by Guy Steele - "We find that the notion of side effect and the notion of equality (object identity) are mutually constraining; to define one is to define the other." With that in mind, I do believe that objects, as in encapsulating some kind of side-effect, is a very good model. But it is not a replacement for everything - a more data-oriented approach makes much more sense for some other parts of a program. Multiple views are absolutely possible within the same language/program, and should in general be the preferred way.
- cmrdporcupine 3y agoWhat I would like to see is a system where object-orientation is emergent from a more set-oriented/relational model. I haven't put my finger on what exactly this is yet, but maybe it's something like "methods" really being a kind of predicate-dispatch over matching tuples. So a "class" (and object identity) is really telling the system: when you see attributes X, Y, Z bundled together as a result of a query, here is a set of behaviors that you can apply on those tuples.
- kaba0 3y agoI don't know, relational model seems to be fundamentally mathematical/side-effect free. Like, I think we should think of a `Connection` as an object, not `User`, which is just plain data.
- cmrdporcupine 3y agoI get your point, but ... updates on tuples are definitely a "thing" in a relational system... and the set of connections and their attributes and state can be modeled in relations quite easily... Not sure I see a conflict.
- kaba0 3y agoFair enough, though I think a functional approach (you create a new set from the old, with one field changed), and somehow “committing” it back is fine, and no need for side effecting then (besides at the boundary). Maybe structural typing is somewhat similar to what you think of? Probably typescript, maybe go are the most well-known for this out of the statically typed ones, but clojure is also all about every “object” being a key-value map.