circular dependency is a relation between two or more modules which either directly or indirectly depend on each other to function properly.
Questions tagged [circular-dependency]
1693 questions
43
votes
7 answers
Game Objects Talking To Each Other
What is a good way of dealing with objects and having them talk to each other?
Up until now all my games hobby/student have been small so this problem was generally solved in a rather ugly way, which lead to tight integration and circular…
user245019
41
votes
8 answers
Are circular references acceptable in database?
When are circular references acceptable in database?
Theoretical and practical, any help is appreciated.

yli
- 2,679
- 5
- 25
- 31
39
votes
3 answers
Resolving circular dependencies by linking the same library twice?
We have a code base broken up into static libraries. Unfortunately, the libraries have circular dependencies; e.g., libfoo.a depends on libbar.a and vice-versa.
I know the "correct" way to handle this is to use the linker's --start-group and…

Nemo
- 70,042
- 10
- 116
- 153
39
votes
6 answers
Resolve circular typedef dependency?
What is the best way to resolve the following circular dependency in typedef-ing these structs?
Note the C language tag - I'm looking for a solution in standard gcc C.
typedef struct {
char* name;
int age;
int lefthanded;
People*…

Nick Van Brunt
- 15,244
- 11
- 66
- 92
39
votes
6 answers
Circular References Cause Memory Leak?
I'm trying to run down a memory leak in a windows forms application. I'm looking now at a form which contains several embedded forms. What worries me is that the child forms, in their constructor, take a reference to the parent form, and keep it…

GWLlosa
- 23,995
- 17
- 79
- 116
34
votes
6 answers
How to solve circular reference?
How do you solve circular reference problems like Class A has class B as one of its properties, while Class B has Class A as one of its properties?
How to do architect for those kind of problems?
If you take an example of NHibernate, there will be a…

user145610
- 2,949
- 4
- 43
- 75
34
votes
5 answers
WARNING in Circular dependency detected - Angular Cli
https://github.com/angular/angular-cli/pull/6813 Added warnings for circular dependencies, and I know I can turn off all warnings using "showCircularDependencies": false. But I would rather keep the circular dependency warnings on. Is there a…

Dulitha Ranatunga
- 361
- 1
- 3
- 6
29
votes
8 answers
Circular Dependency with Nestjs Swagger 4
When I updated the @nest/swagger library to version 4, this error happened:
(node:16134) UnhandledPromiseRejectionWarning: Error: A circular dependency has been detected (property key: "customer"). Please, make sure that each side of a bidirectional…

btd1337
- 2,616
- 2
- 16
- 25
27
votes
4 answers
Detecting circular imports
I'm working with a project that contains about 30 unique modules. It wasn't designed too well, so it's common that I create circular imports when adding some new functionality to the project.
Of course, when I add the circular import, I'm unaware of…

Ponkadoodle
- 5,777
- 5
- 38
- 62
26
votes
4 answers
Resolving a Circular Dependency between Template Classes
I have two classes, Foo and Bar, derived from Base. Each overrides a method virtual Base* convert(ID) const, where ID is an instance of a type that uniquely identifies a particular instantiation of Foo or Bar (pretend it's an enum). The…

Jon Purdy
- 53,300
- 8
- 96
- 166
25
votes
6 answers
Cannot connect to MongoDB because of wrong URI
I was trying to run mongoDB on node server
Full Code here from MongoDB:
My mongo version: 4.4.3
Node version: v15.7.0
I've imported get started code from MongoDB, and here's the code:
const { MongoClient } = require("mongodb");
// Connection…

Thirumalai vasan
- 655
- 2
- 6
- 19
24
votes
3 answers
Dependency Injection circular dependency .NET Core 2.0
I want my ApplicationContext constructor to have the UserManager as a parameter, but I am having trouble with dependency injection.
Code:
public class ApplicationContext : IdentityDbContext
{
private IHttpContextAccessor…

rory
- 1,490
- 3
- 22
- 50
24
votes
5 answers
Resolving circular imports in celery and django
I have a Django app that uses Celery to offload some tasks. Mainly, it defers the computation of some fields in a database table.
So, I have a tasks.py:
from models import MyModel
from celery import shared_task
@shared_task
def my_task(id):
qs…

Chinmay Kanchi
- 62,729
- 22
- 87
- 114
23
votes
1 answer
Dart - Circular imports
In other languages (like Python, Go, C#, etc.), circular imports are an issue and the program doesn't run. However, Dart seems to get around this issue and different Dart files can import each other. I am curious about how Dart handles this, and to…

Dinanjanan
- 399
- 2
- 11
23
votes
3 answers
How to define circularly dependent data classes in Python 3.7+?
Suppose that class A has a member whose type is class B, and class B has a member whose type is class A.
In Scala or Kotlin, you can define the classes in any order without worries in this case because the firstly-defined class can use the…

Naetmul
- 14,544
- 8
- 57
- 81