I would like for Java to provide one more publicity level than it does: "internal-public" (or, conversely, "api"). Not all public classes are meant to be used by applications; some are public only because they have to be visible to other classes in your code base.
Assuming that package visibility isn't sufficient, another approach is to define your class as implementing an interface that only contains the API methods, and set things up so that application code is written to the interface rather than the implementation class.
We've got a number of cases where package visibility isn't sufficient but, possibly, package family would be. For example, if we could restrict something to being visible in com.foo.bar and all of its children (like com.foo.bar.x), but not in com.foo.baz, that would probably solve a lot of our problem cases. Ah well -- in a perfect world...
Writing exclusively to interfaces: interesting idea! Thanks; I hadn't thought of that.
"It is my sad duty to report that an SCA participant died at a fighting practice this weekend. We do not yet have permission from the family to release more details. Stay tuned.".
Well, that's pure supposition. This seems to be what the kingdom chirurgeon is hinting at. Because she refuses to say anything as direct as this, though, the kingdom mailing list has been flooded with speculation and complaints and arguments over HIPA (a new health-privacy laws) and all sorts of stuff.
Here is the original message on the subject, and here is her followup message. If this is in fact about a death (or serious injury), as it appears to be, there were (IMO) better ways to handle it, ways that would have (probably) eliminated the followup conversation that is now occurring. She posted, ostensibly, to stop rumors; she succeeded in starting them instead. (Hers were the first posts there on the subject. She says people were already discussing it, but they weren't doing so on this list. So she blind-sided people.)
Yup. And to illustrate the point that the original message stirred up more than it calmed: we wouldn't even be having this conversation if she'd just said what she meant in the first place. That's probably going on all over the kingdom. I feel bad for the family, because when the details eventually emerge they'll be even more in the spotlight than they would have been.
More or less. The .NET "internal" keyword basically means that this item is visible within this assembly, which roughly translates to this .dll. The intent is that assembly boundaries more or less correspond to logical library boundaries, so it basically does what you want. (And in fact, I use the keyword mainly for its autodoc effects.)
Comments 12
Assuming that package visibility isn't sufficient, another approach is to define your class as implementing an interface that only contains the API methods, and set things up so that application code is written to the interface rather than the implementation class.
Reply
Writing exclusively to interfaces: interesting idea! Thanks; I hadn't thought of that.
Reply
Excuse me?
Reply
Here is the original message on the subject, and here is her followup message. If this is in fact about a death (or serious injury), as it appears to be, there were (IMO) better ways to handle it, ways that would have (probably) eliminated the followup conversation that is now occurring. She posted, ostensibly, to stop rumors; she succeeded in starting them instead. (Hers were the first posts there on the subject. She says people were already discussing it, but they weren't doing so on this list. So she blind-sided people.)
Reply
Reply
Reply
More or less. The .NET "internal" keyword basically means that this item is visible within this assembly, which roughly translates to this .dll. The intent is that assembly boundaries more or less correspond to logical library boundaries, so it basically does what you want. (And in fact, I use the keyword mainly for its autodoc effects.)
Reply
Leave a comment