Skip to main content
added 42 characters in body
Source Link
user321630
user321630

I don't consider that "perfect encapsulation". That might be a bit subjective but what I consider the strongest level of encapsulation is a class whose state doesn't even need to be exposed in the first place (through accessor functions or anything else). In my mind it's a class that exposes the absolutely minimal information about itself, like a container that doesn't even need to expose what's stored inside for anything other than read-only access. That is the strongest way to maintain invariants over its state is to not expose it in any mutable form whatsoever. If we want to maintain Universe-level invariants in our Universe class/interface, then we cannot expose anything inside of it for tampering. Of course, as mentioned above, that tends to not be very practical when we're modeling things at the level of a "Universe" with the types of shifting requirements imposed on game engines which often want to model a "Universe" of sorts (however simplified, gamedevs are creating their own miniature universe, and I'd dare say that is one of the most challenging things to do from a programming design standpoint as they are literally trying to be "gods" breathing life into some universe whether it's Super Mario or Unreal 4).

I don't consider that "perfect encapsulation". That might be a bit subjective but what I consider the strongest level of encapsulation is a class whose state doesn't even need to be exposed in the first place (through accessor functions or anything else). In my mind it's a class that exposes the absolutely minimal information about itself, like a container that doesn't even need to expose what's stored inside for anything other than read-only access. That is the strongest way to maintain invariants over its state is to not expose it in any mutable form whatsoever. If we want to maintain Universe-level invariants in our Universe class/interface, then we cannot expose anything inside of it for tampering. Of course, as mentioned above, that tends to not be very practical when we're modeling things at the level of a "Universe" with the types of shifting requirements imposed on game engines which often want to model a "Universe" of sorts (however simplified, gamedevs are creating their own miniature universe, and I'd dare say that is one of the most challenging things to do from a programming design standpoint).

I don't consider that "perfect encapsulation". That might be a bit subjective but what I consider the strongest level of encapsulation is a class whose state doesn't even need to be exposed in the first place (through accessor functions or anything else). In my mind it's a class that exposes the absolutely minimal information about itself, like a container that doesn't even need to expose what's stored inside for anything other than read-only access. That is the strongest way to maintain invariants over its state is to not expose it in any mutable form whatsoever. If we want to maintain Universe-level invariants in our Universe class/interface, then we cannot expose anything inside of it for tampering. Of course, as mentioned above, that tends to not be very practical when we're modeling things at the level of a "Universe" with the types of shifting requirements imposed on game engines which often want to model a "Universe" of sorts (however simplified, gamedevs are creating their own miniature universe, and I'd dare say that is one of the most challenging things to do from a programming design standpoint as they are literally trying to be "gods" breathing life into some universe whether it's Super Mario or Unreal 4).

added 124 characters in body
Source Link
user321630
user321630

I don't consider that "perfect encapsulation". That might be a bit subjective but what I consider the strongest level of encapsulation is a class whose state doesn't even need to be exposed in the first place (through accessor functions or anything else). In my mind it's a class that exposes the absolutely minimal information about itself, like a container that doesn't even need to expose what's stored inside for anything other than read-only access. That is the strongest way to maintain invariants over its state is to not expose it in any mutable form whatsoever. If we want to maintain Universe-level invariants in our Universe class/interface, then we cannot expose anything inside of it for tampering. Of course, as mentioned above, that tends to not be very practical when we're modeling things at the level of a "Universe" with the types of shifting requirements imposed on game engines which often want to model a "Universe" of sorts (however simplified, gamedevs are creating their own miniature universe, and I'd dare say that is one of the most challenging things to do from a programming design standpoint).

I don't consider that "perfect encapsulation". That might be a bit subjective but what I consider the strongest level of encapsulation is a class whose state doesn't even need to be exposed in the first place (through accessor functions or anything else). In my mind it's a class that exposes the absolutely minimal information about itself, like a container that doesn't even need to expose what's stored inside for anything other than read-only access. That is the strongest way to maintain invariants over its state is to not expose it in any mutable form whatsoever. If we want to maintain Universe-level invariants in our Universe class/interface, then we cannot expose anything inside of it for tampering.

I don't consider that "perfect encapsulation". That might be a bit subjective but what I consider the strongest level of encapsulation is a class whose state doesn't even need to be exposed in the first place (through accessor functions or anything else). In my mind it's a class that exposes the absolutely minimal information about itself, like a container that doesn't even need to expose what's stored inside for anything other than read-only access. That is the strongest way to maintain invariants over its state is to not expose it in any mutable form whatsoever. If we want to maintain Universe-level invariants in our Universe class/interface, then we cannot expose anything inside of it for tampering. Of course, as mentioned above, that tends to not be very practical when we're modeling things at the level of a "Universe" with the types of shifting requirements imposed on game engines which often want to model a "Universe" of sorts (however simplified, gamedevs are creating their own miniature universe, and I'd dare say that is one of the most challenging things to do from a programming design standpoint).

added 544 characters in body
Source Link
user321630
user321630

Just write accessor-methods for all accessor-methods of all classes that Master is composed of. This leads to perfect encapsulation, because no implementation detail of Master is visible [...]

I don't consider that "perfect encapsulation". That might be a bit subjective but what I consider the strongest level of encapsulation is a class whose state doesn't even need to be exposed in the first place (through accessor functions or anything else). In my mind it's a class that exposes the absolutely minimal information about itself, like a container that doesn't even need to expose what's stored inside for anything other than read-only access. That is the strongest way to maintain invariants over its state is to not expose it in any mutable form whatsoever. If we want to maintain Universe-level invariants in our Universe class/interface, then we cannot expose anything inside of it for tampering.

Just write accessor-methods for all accessor-methods of all classes that Master is composed of. This leads to perfect encapsulation, because no implementation detail of Master is visible [...]

I don't consider that "perfect encapsulation". That might be a bit subjective but what I consider the strongest level of encapsulation is a class whose state doesn't even need to be exposed in the first place (through accessor functions or anything else). In my mind it's a class that exposes the absolutely minimal information about itself, like a container that doesn't even need to expose what's stored inside for anything other than read-only access. That is the strongest way to maintain invariants over its state is to not expose it in any mutable form whatsoever. If we want to maintain Universe-level invariants in our Universe class/interface, then we cannot expose anything inside of it for tampering.

added 86 characters in body
Source Link
user321630
user321630
Loading
added 445 characters in body
Source Link
user321630
user321630
Loading
added 54 characters in body
Source Link
user321630
user321630
Loading
added 35 characters in body
Source Link
user321630
user321630
Loading
Source Link
user321630
user321630
Loading