3 ms·
There are a ton of perfectly OO languages with little to no language-enforced encapsulation. You're sort of proving my point... if you're going to insist that i
by jerf 13y ago
There are a ton of perfectly OO languages with little to no language-enforced encapsulation. You're sort of proving my point... if you're going to insist that if you don't have that you don't have OO, you've got an awful lot of language communities to go explain to them that their language isn't OO... hopefully you've got some explanation of what it actually is, too, that makes some sort of sense.
- seanmcdirmid 13y agoEncapsulation isn't just information hiding, though I guess that is how people usually grok it. The essence of an object is its identity, with identity you can own things like state, but then that state needs to be protected. In a pure system, this identity is problematic: all values are are identified simply by their structure, and state would be unheard of. We might try to fake it by providing identities manually (see immediate-mode UIs), but then you are just trying to build objects again anyways. Do you have values that you can name and talk about independent of their structure or how you get a handle to them? Yep, those are objects. I think most languages that claim to have objects actually have objects, the bar is not high! What is more problematic are communities who claim not to have objects, like the entity component people, or the functional programming people who start passing around numeric/string based identifiers to "solve expressiveness problems." But they are just in denial in that they have recreated objects. Note that information hiding, what we more generally understand as encapsulation, is not even meaningful without objects. So if your values don't have identity, it is only their structure that is important, and then it doesn't make sense to hide that structure without chopping it off of the value itself!