Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Perhaps a better way of saying is is that hidden data is a characteristic of abstraction. Which is certainly fair, and fits the analogy to algebra quite well.

But in any case, parent's comment that "OOP has no special claim" to hidden state/data (or abstraction) is sound; after all, ADTs already do that.



> Perhaps a better way of saying is is that hidden data is a characteristic of abstraction. Which is certainly fair, and fits the analogy to algebra quite well.

I'd disagree with even that much; I'd say abstraction is much more about parameterisation - factoring out the common structure from different constructions - than outright hiding anything.

> But in any case, parent's comment that "OOP has no special claim" to hidden state/data (or abstraction) is sound; after all, ADTs already do that.

ADTs don't hide mutable state. That much is something OO has a special claim to.


"hiding data" and "factoring out the common structure" are almost always intrinsically connected in software systems, because if you can poke at the data then you can violate contracts that give rise to the common structure.

This is particularly true of software, but I'd argue it's also true of basically every branch of mathematics outside of a few particular sub-fields of algebra (which are either extremely simple or extremely abstract, and often both).

> ADTs don't hide mutable state. That much is something OO has a special claim to.

How so? Abstract datatypes certainly hide mutable state. Just because a language doesn't have the "private" keyword doesn't mean that internal data can't be excluded from the interface... this was done all the time in e.g. C without the message passing semantics that characterize OO languages.


> if you can poke at the data then you can violate contracts that give rise to the common structure.

Maybe if you can mutate it, but having it be visible isn't an issue.

> Abstract datatypes certainly hide mutable state.

ADTs are normally understood to be values i.e. immutable. Hidden structure is not the same thing as hidden state.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: