3 ms·
"Data structure and functions should not be bound together": not if you don't want that, but often you do, to avoid constantly asking the question "where's the
by dboreham 6y ago
"Data structure and functions should not be bound together": not if you don't want that, but often you do, to avoid constantly asking the question "where's the code that messes with this data?".
"Everything has to be an object": obviously bad, but also not the case in most OO languages. So...bogus objection.
"In an OOPL data type definitions are spread out all over the place": Huh? This one is made up. You can put all your <whatever> in one place if you want to.
"Objects have private state": this is a feature not a bug. Exhibit A: JavaScript.
- jrochkind1 6y agoin ruby everything is an object. Of all the things people complain about about ruby, I don't think that's one of them, I don't see how it's a problem.
- k__ 6y agoI found JS to be one of the better OO implementations in the wild. All these OO additions since ES2015 felt like a step back to me.
- sodapopcan 6y agoI mean, OO isn't impervious to this: "Where is the factory to create this object?" "Where are the factorIES that create this object???" "Where is the service to perform this action on this object?" "Where is the manager that coordinates these objects????" This can be solved with some knowledge of DDD (for example) which applies to both paradigms.
- Igelau 6y ago> "Everything has to be an object": obviously bad Personally I prefer when it's all objects. Otherwise you wind up with primitive types that you can't do all the objecty stuff with. Then you wind up with hacks like Java's int vs Integer dichotomy. Compare this with Python where the internals of the integer type are so hidden that it can do things like seamlessly replace it with a bigint. What it is inside doesn't matter because you only care that it answers to the same messages.
- hderms 6y agoWhat are your thoughts on project valhalla on the JVM? I think making structs object-like is a win as ultimately having everything involve extreme pointer chasing is wasteful
- Arch-TK 6y ago> where's the code that messes with this data That just sounds like a code organization problem not an argument in favour of OOP. > but also not the case in most OO languages The fact that a lot of "OO" languages don't enforce this doesn't change the fact that the general sentiment around object oriented programming as I see it taught and as I see new programmers approach it is that "everything has to be an object." The problem with OOP is not just OOP languages but also OOP programmers who you have to deal with on a regular basis and have to explain that "this could just be a function, why do I need to instantiate a class to do this basic task?" > Huh? This one is made up. Once again, this doesn't matter in light of how people ACTUALLY write code in those languages and what actually is the status quo. > this is a feature not a bug Not sure I know enough about javascript to understand what you mean here. Hiding state inside things is fine when it's done correctly, more often than not in reality when people write object oriented code it is done poorly. I certainly haven't had the same troubles understanding what happens to state when reading someone else's pure functional code vs when I've had to read someone else's object oriented code.
- marcosdumay 6y ago> where's the code that messes with this data? Ouch! Try answering that in some Java Spring or C# MVC code. Then try to answer it in some not class-based Django or Rails code.