Encapsulation

Bracha and Ungar motivated the encapsulation property of mirrors via a hypothetical class browser tool, noting that the Java core reflection APIs bring an unwanted restriction: reflecting only the host VM, not a remote instance.

This is a failure of encapsulation, not because it doesn’t hide the VM’s internals (it does!), but on criteria of plurality: clients may reflect only on one specific machine’s state (the host machine’s); they are provided with only a single, fixed view; and only one implementation of the interface may be present in any one program.

Different mirrors offering distinct meta-level views are often desirable, as alluded to by Bracha’s and Ungar’s mention of “a functional decomposition rather than. . . leaving that decision to the implementation of the objects themselves”.

Coexistence of different implementations of the same abstraction is a key property of object-oriented encapsulation, as noted by Cook (2009) and Aldrich (2013).

We can also see it as a hallmark of postmodernism in software – an instance of a concern for “many little stories”, in opposition to a unique grand modernist narrative.