3 ms·
My dislike of OOP is its emphasis on state. If you do foo.bar(), then you have changed the state of foo, even for other references to it. If you do foo=bar(foo)
by gizmo686 14y ago
My dislike of OOP is its emphasis on state. If you do foo.bar(), then you have changed the state of foo, even for other references to it. If you do foo=bar(foo), then the state of the original data is unchanged, while code below behaves the same way. In most cases, I find minimizing state minimizes bugs.
I do however like objects, and think that they can have a very good role in code.
- ww520 14y agoThere's nothing wrong with state. State is a fact of life in programming. Even pure functional program has states, which are the parameters passed among functions. I guess you meant mutable state. You don't have to use mutable state with OOP - just create a class that allows state initialization in the constructors but nothing else, with none of the methods changing the states.