4 ms·
"Classes are much harder to reason about than other type systems." Strange, I find classes intuitive. Objects lend themselves to physical system analogues; mak
by shanebellone 4y ago
"Classes are much harder to reason about than other type systems."
Strange, I find classes intuitive. Objects lend themselves to physical system analogues; making objects easier to reason about in complex systems. The paradigm specifically helps me build light mental models which in turn helps me retain the associated codebase.
Anyone else have a similar experience?
- recursivedoubts 4y agoI find classes extremely intuitive.
- thesz 4y agoI find classes extremely unintuitive. I find type classes and (generalized) algebraic data types to be extremely intuitive.
- recursivedoubts 4y agoI have met a few people like you, and I wish you all well in your programming careers.
- kaba0 4y agoI find both intuitive and one is better for these kinds of jobs, the other for other kinds.
- DeathArrow 4y agoThere are countless articles showing how OOP fails to model the physical world.
- shanebellone 4y agoStraw man. The point of contention regards ease of reasoning not completeness or ability to model the physical world.
- thesz 4y agoDefine "ease of reasoning," then you can accuse others of "straw man" attack. OOP does not even consider effects in it's reasoning. You can do anything with the state of an object and whatever that object can reach through references. The changes are not atomic, they are allowed to be (temporarily) inconsistent. In my book, this is opposite of ease of reasoning. You can change something that will shoot the user of your program much down the line and do that without any hiccup.
- shanebellone 4y ago"Define "ease of reasoning," then you can accuse others of "straw man" attack." Capable of being retained both as individual components and aggregate system. My reply which the other user is replying to specifically quotes ease of reasoning from the parent comment. You're also conflating implementation with conceptualization. I was only noting that OOP is easy for me. It fits my system and worldview. I did not generalize that experience to a larger population.
- thesz 4y ago"Capable of being retained both..." is not a definition, it is a property, at best.
- shanebellone 4y agowtf?
- menotyou 4y ago> Anyone else have a similar experience? Exactly contrary. I find modelling in objects classes counter-intuitive and thus not good to reason about. When I paint a wall I apply a function (paint) to the object (wall), not the object is painting itself. I can apply the same function to a different type (aka class) of object e.g. I can paint my chair. Stays the same function. So in my cognitive model of the world the objects are objects manipulated by me, not subjects executing "methods", but OOP is treating them as subjects.
- kaba0 4y agoOk, let’s represent a double-ended stack then, as a circular buffer. It will be in the end a fixed sized array with a start and end variables pointing to one-one element of it. Doesn’t it inherently makes sense that I want to have a public API on top of it denoting how can it be used from the outside, while a private one, that encapsulates the implementation details, and makes them only callable by other methods of this object? This is the major point of OOP, in my opinion.
- menotyou 4y agoTo get an API I just define a type for double-ended-stacks functions manipulating it. Or if you prefer to define it with immutable variables the functions accept an double-ended-stack and return a new copied and modified stack as result. The set of functions will be a moduls resembling what you call an API. I am not argue this can not be done on OOP, but I find it counter-intuitive and overly complex to do so.
- shanebellone 4y agoYou can do the same thing with objects though. I have "utilities" which can be used with objects. Per your example, if object(wall) and object(chair) both share the attribute(color) then they both can utilize function(paint). The only prerequisite would that they are paintable.
- thesz 4y agoWhat you describe there is use of interfaces and properties. These things are much easier to reason about and to compose than classes with inheritance. For example, it is easy to solve Expression Problem [1] with interfaces and properties and it is hard to solve it with only classes and inheritance. [1] https://en.wikipedia.org/wiki/Expression_problem https://en.wikipedia.org/wiki/Expression_problem