Questions tagged [circular-dependency]

circular dependency is a relation between two or more modules which either directly or indirectly depend on each other to function properly.

1693 questions
8
votes
4 answers

How to design a class to prevent circular dependencies from calling derived members before construction?

(I tagged this as both C# and Java, since it's the same question in both languages.) Say I have these classes interface IKernel { // Useful members, e.g. AvailableMemory, TotalMemory, etc. } class Kernel : IKernel { private /*readonly*/…
user541686
  • 205,094
  • 128
  • 528
  • 886
8
votes
3 answers

C circular dependency

I have this problem with circular dependency in C, I looked around the other questions about this topic but really couldn't find the answer. I have this first struct named vertex: #ifndef MapTest_vertex_h #define MapTest_vertex_h #include…
Marnix v. R.
  • 1,638
  • 4
  • 22
  • 33
7
votes
3 answers

Recommended way to have 2+ modules recursively refer to each other in Lua 5.2

Is there a way to have Two Lua modules (let's call them A and B) Each module uses functions from the other, so they must require each other A third module (let's call it C) can use A but not B e.g. C.lua: local A = require 'A' --…
finnw
  • 47,861
  • 24
  • 143
  • 221
7
votes
3 answers

Circular dependency between "controller" and "gui"

I am writing a complex GUI in Java with many components on several screens working on top of and interacting with a shared piece of logic and model. Clearly there are some circular dependencies between the "gui" and "controller/logic": User actions…
Konrad Garus
  • 53,145
  • 43
  • 157
  • 230
7
votes
0 answers

Does the .NET CLR have a circular dependency?

Possible Duplicate: How did Microsoft create assemblies that have circular references? I was in the process of putting together a little PowerShell cmdlet that would give me a dependency tree for .NET assemblies, when I discovered something…
Mark
  • 11,257
  • 11
  • 61
  • 97
7
votes
1 answer

Avoiding circular imports when base class returns a subclass instance in an importable module

Summary TLDR: How to avoid circular import errors when a base class returns a subclass instance in an importable module? I have collected some solutions from other locations/questions (see A-D, below) but none is satisfactory IMHO. Starting…
ElRudi
  • 2,122
  • 2
  • 18
  • 33
7
votes
3 answers

Angular cyclic dependency when enabling ivy

After enabling ivy in my angular project, everything compiles but when starting the app in the browser I get the following error during app bootstrap: Error: Cannot instantiate cyclic dependency! ApplicationRef at throwCyclicDependencyError…
that_guy
  • 2,313
  • 4
  • 33
  • 46
7
votes
3 answers

How to properly implement Navigator pattern

I am following John Sundell's post to implement a Navigator pattern (https://www.swiftbysundell.com/posts/navigation-in-swift). The basic idea is that, in contrast to Coordinator pattern, each view controller could simply call navigator.navigate(to:…
Jack Guo
  • 3,959
  • 8
  • 39
  • 60
7
votes
1 answer

Dagger in separate gradle module

I have 3 gradle modules in my 'clean architecture' Android application: 'data', 'domain' and 'presentation'. 'data' and 'presentation' both depend on 'domain', but not each other. 'presentation' holds Application class realization, and 'data' holds…
Alexey
  • 2,980
  • 4
  • 30
  • 53
7
votes
2 answers

How to solve a circular class dependency with shared base class without headers?

So I am creating a project that involves having vectors nested inside one another, but the structure won't compile. I think this is a case of circular dependency, but all of the fixes I've seen seem to only apply to code involving header files and…
Sr1703
  • 83
  • 7
7
votes
3 answers

Circular Dependency among two Projects of Different Solution

Suppose there are two .net projects not under same solution. ProjectA is under solution1 and ProjectB is under solution2. ProjectA has a reference of ProjectB and ProjectB has reference of ProjectA. There are two classes ProjectA_Class and…
7
votes
1 answer

Exception: "load_missing_constant Circular dependency detected while autoloading constant" in Rails

I'm using Rails 4.0.2. I added sub directories (with model names) in Concern directory: /app/models/concerns/company/cache_concern.rb /app/models/concerns/user/cache_concern.rb /app/models/concerns/document/cache_concern.rb cache_concern.rb in…
7
votes
4 answers

Possible circular dependency issue with PHP application

I'm experiencing what I believe is a circular dependency issue with my PHP application. Please let me know if this is incorrect. Here is the situation: Two classes, LogManager and DBSession. DBSession is used to interact with the database, and…
Matt Refghi
  • 791
  • 2
  • 12
  • 27
7
votes
4 answers

C++ circular include

I can't solve this circular dependency problem; always getting this error: "invalid use of incomplete type struct GemsGame" I don't know why the compiler doesn't know the declaration of GemsGame even if I included gemsgame.h Both classes depend on…
Nikola C
  • 315
  • 1
  • 3
  • 11
7
votes
1 answer

Implement custom behaviour to a repository method in spring-data-jpa

I'm trying to implement custom behaviour to a method in Repository using spring-data-jpa. The ProductRepository interfaces is @Repository public interface ProductRepository extends JpaRepository, ProductRepositoryCustom { public List…