Jump to content

Friends and their Communities


Recommended Posts

No, not a touchy-feely post about love amongst mankind, but a philisopical question about access scope. I have two classes: Class1 (contains MethodA) and Class2 (contains MethodB). When I set MethodA's scope to community, and I want to put it on the block diagram of MethodB, I need to make MethodB friends with Class1. Why can't I just make MethodB friends with MethodA?

Link to comment

No, not a touchy-feely post about love amongst mankind, but a philisopical question about access scope. I have two classes: Class1 (contains MethodA) and Class2 (contains MethodB). When I set MethodA's scope to community, and I want to put it on the block diagram of MethodB, I need to make MethodB friends with Class1. Why can't I just make MethodB friends with MethodA?

Because classes aren't very friendly? biggrin.gif

I would imagine it's because a class is an entity and you access that entities data through methods and properties by exposing them to a greater or lesser extent (I think of it like a box with buttons and indicators on it). As such your interface boundary is the "class" so you are in fact saying that the Method B should be able to poke a couple of wires behind the buttons and indicators when all Method B can do is press the buttons and read the indicators.

But then again. I usually over-simplify thingslaugh.gif there's probably a more technical explanation.

Edited by ShaunR
Link to comment
Because classes aren't very friendly? biggrin.gif
No. It's VIs that don't have friends.

The library (this is not specific to classes) is the thing that defines the access scope of its contained items. The library has to know that an item is a friend to grant it access to the community scope. Granting a particular other VI access to a particular VI within the library is something we could have implemented, but fiddling around with that level of declaration is usually noise -- if a VI not in the library is closely bound enough to the library to need a friend relationship, then it frequently wants access to multiple community scoped VIs, and you've already said that you know this other VI well enough to trust it with general access.

Link to comment
The library has to know that an item is a friend to grant it access to the community scope. Granting a particular other VI access to a particular VI within the library is something we could have implemented, but fiddling around with that level of declaration is usually noise -- if a VI not in the library is closely bound enough to the library to need a friend relationship, then it frequently wants access to multiple community scoped VIs, and you've already said that you know this other VI well enough to trust it with general access.

That's fair.

So it was all touchy-feely then and about trust wub.gif awhh.....

Sounds like the progression of most relationships. Or is it the opposite?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.