Re:Ask HN: Why do you make class members private?
by ironmagma on Monday July 25, 2022 @02:11PM
(#32228531)
We do it because that's how it's always been done. There is no why of OOP, there is only do.
[ Parent
| on HN ]
Re:Ask HN: Why do you make class members private?
by Jtsummers on Monday July 25, 2022 @02:36PM
(#32228920)
> There is no why of OOP, there is only do.
You really think that in the 50+ years of OOP and modular programming no one has considered why? That they've really just thrown shit at the wall and seen what stuck and never considered what to throw at the wall or why it stuck?
Re:Ask HN: Why do you make class members private?
by ironmagma on Monday July 25, 2022 @04:05PM
(#32230208)
I’m sure lots of people have considered it. But lots of people can be wrong, myself included.
We do it because it’s largely automated by IDEs now. I strongly suspect that if IDEs didn’t make it so easy to do, we basically wouldn’t bother with it. Python does OOP just fine without real visibility control.