Hacker News new | ask | show | jobs
by thrmsforbfast 2787 days ago
"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.

1 comments

> 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.