11-09-2021 12:31 PM
I've recently been learning more about how to avoid circular dependencies because they are bad, make code less modular and can cause LabVIEW to take longer to load.
But what I'm wondering about is community scope. It seems to me like if you use community scope at all, then it's not possible to avoid having a circular dependency. My thinking is: class A calls a community-scoped class B method so A depends on B. But in class B, I have to specify A as a friend so that means B depends on A also.
So if I don't want to have any circular dependencies in my code, does that mean I just can't use community scope at all? Or am I thinking about this in the wrong way?
Solved! Go to Solution.
11-09-2021 01:06 PM
If you specify a class as a "friend" but that class is missing, it shouldn't cause an error. Even if it's not missing, it doesn't show up in the dependencies of the project.
Think of adding something to the "Friend" list as putting their name on a list. The list doesn't depend on the name to exist, it exists on its own just fine, just waiting for someone with the name to show up, letting them use the class if they have it and not if they don't.