2 ms·
I really like this this perspective but I think it’s more multi dimensional. Often data only needs to be read so new data can be produced. There’s no need for
by dgb23 3y ago
I really like this this perspective but I think it’s more multi dimensional.
Often data only needs to be read so new data can be produced. There’s no need for encapsulation here. If you want to ensure that you’re dealing with data that has certain properties then you can do that with types, schemas or simply read it.
Encapsulation at a lower level is needed when you mutate state or otherwise own resources and possibly multiple things need to be updated in tandem. In this case you want operational semantics and not look at the innards of the data. So the interface you want describes behavior.
And then there is another level where you only care about coordination of messages. The interface is not the data/state behind whoever produces or reads them. You don’t even care about behavior anymore.