circular-dependency

circular dependencies between dlls with visual studio

淺唱寂寞╮ 提交于 2019-11-27 21:21:52
问题 I have a circular dependency between two functions. I would like each of these functions to reside in its own dll. Is it possible to build this with visual studio? foo(int i) { if (i > 0) bar(i -i); } -> should compile into foo.dll bar(int i) { if (i > 0) foo(i - i); } -> should compile into bar.dll I have created two projects in visual studio, one for foo and one for bar. By playing with the 'References' and compiling a few times, I managed to get the dll's that I want. I would like to know

Are circular dependencies considered bad design?

会有一股神秘感。 提交于 2019-11-27 18:40:40
问题 In my work (which is 90% Java but I'm sure this question applies to other languages) I often create two classes that "know about" each other. More concretely, class A imports B, and class B imports class A, and both have member or local variables of the other type. Is this considered bad design? An anti-pattern if you will? 回答1: Here is my take: If the two classes belong to the same logical module, then it's probably fine (still a judgement call of course, with lots of grey areas). It's less

Circular dependency issue with Typescript, CommonJS & Browserify

假装没事ソ 提交于 2019-11-27 16:47:07
问题 I'm in the process of moving a fairly large typescript project from internal modules to external modules. I do this because I want to create one core bundle, which, if and when required, can load other bundles. A seccond requirement which I'm keeping in mind is that I'd like to be able to run the bundles (with some modifications if required) on the server with nodeJS aswell. I first tried using AMD & require.js to build the core bundle, but I came across an issue with circular dependencies.

In C#, how to find chain of circular dependency?

时光毁灭记忆、已成空白 提交于 2019-11-27 16:08:31
问题 This error usually occurs when one deployment project contains the project outputs of a second deployment project, and the second project contains the outputs of the first project. I have a method that check circular dependency. In input, we have a dictionary that contains, for example, <"A", < "B", "C" >> and <"B", < "A", "D" >> , this means that A depends on B and C and we have circular dependency with A->B . But usually we have a more complex situation, with a chain of dependency. How to

Cannot add reference to project because of a circular dependency error

旧街凉风 提交于 2019-11-27 15:30:51
问题 I created 2 dummy projects in my application and named them BAL and DAL . When I build them, they build successfully. If I add a reference to BAL to the DAL project, it added nicely. But while adding the DAL reference to the BAL project, I get the following error: A reference to DAL could not be added. Adding this project as a reference would cause a circular dependency. Can anyone help me to solve this error? 回答1: Here's what you need to do: Right click on the DAL Project in the solution

Python mutually dependent classes (circular dependencies)

别来无恙 提交于 2019-11-27 15:29:48
I've searched a lot, but what I find is mainly examples of recursive programming in python. So here goes the question: How can I achieve this? class A: b = B() class B: a = A() Everything is dynamic in Python - even the class declarations. There's nothing to stop you modifying the contents of a class after the initial declaration: class A: pass class B: a = A() A.b = B() NB: If you're not that familiar with Python, the pass keyword simply allows you to say 'nothing here' - it's not important unless class A is as empty as it is in this example! 来源: https://stackoverflow.com/questions/6402522

circular generic type parameters

妖精的绣舞 提交于 2019-11-27 14:36:39
问题 I have 2 generic classes, a BaseComponent Class, and a BaseManager class. They're both abstract and are intended to be made concrete. public abstract class BaseManager<T> where T : BaseComponent<?> public abstract class BaseComponent<T> where T : BaseManager<?> BaseManager has a list of BaseComponents, which is why i want to make it generic, so a PhysicsManager : BaseManager<PhysicsComponent> would have a list of PhysicsComponents . I want (or rather, think i need) BaseComponent to be generic

Static Circular Dependency in Java

一笑奈何 提交于 2019-11-27 13:55:20
问题 for the following code: class A { public static int X; static { X = B.Y + 1;} } public class B { public static int Y = A.X + 1; static {} public static void main(String[] args) { System.out.println("X = "+A.X+", Y = "+B.Y); } } the output is: X = 1, Y = 2 Why? and How??? -Ivar P.S: Code snippet taken from JavaCamp.org 回答1: Here is what happens in chronological order: Class B contains the main-method so it is loaded by the class loader. Initialization of B references A , so class A is loaded.

Circular Dependency in C++

这一生的挚爱 提交于 2019-11-27 12:49:26
The facts: I have two predominant classes: Manager and Specialist. There are several different types of Specialists. Specialists often require the help of other Specialists in order to get their job done. The Manager knows all of the Specialists, and initially each Specialist knows only their Manager. (This is the problem.) At runtime, the Manager creates and stores a list of Specialists. Then the Manager iterates through the list and asks each Specialist to initialize. During their initialization, each Specialist asks the Manager to supply them with other Specialists that fulfill some

Does Objective-C allow circular dependencies?

依然范特西╮ 提交于 2019-11-27 12:49:10
I'm rewriting a Java library in Objective-C and I've come across a strange situation. I've got two classes that import each other. It's a circular dependency. Does Objective-C support such a situation? If not, how do you recommend I rewrite it? Importing a class is not inheritance. Objective-C doesn't allow circular inheritance, but it does allow circular dependencies. What you would do is declare the classes in each other's headers with the @class directive, and have each class's implementation file import the other one's header. To wit: ClassA.h @class ClassB; @interface ClassA : NSObject {