Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
"I'm not back." - Bill Harding, Twister
That doesn't say a lot, since encapsulation is enforced at compile time, not at run time. Short of writing a javac preprocessor, I wouldn't know a feasible technique to enforce object-level encapsulation.Originally posted by G Vanin:
there are OO languages with encapsulation at the level of objects and there are tools that trnslate from one language to another.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
The interface is loaded using the normal class loader, but for each instantiation of Foobar the FoobarFactory creates a new classloader and loads FoobarImpl afresh.
Well, as you noted it is not exactly unheard of; but James Gosling et al apparently thought it wasn't the best way for Java.Yes, I am perverse if it is a term of being original, gettin away from conventions imposed by a language or getting to the roots of (Java?) smth.
Why? I don't see any significant issues. If a class has become so messed up that an ordinary developer can no longer safely modify it, then yes, with class-level encapsulation an object can mess up other instances. With object-level encapsulation the same developer would add methods enabling the instances to mess up themselves. The net effect is exactly the same. When a developer who doesn't understand the class starts to modify it, things go pear-shaped no matter how it's encapsulated.The encapsulation at the level of classes has an implicit presuppositions [...] In practice we deal with a rather complicated subsubsubsubclasses [...]
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
A subclass of Account has no access whatsoever to its private methods and variables.
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|