Questions tagged [circular-dependency]
The circular-dependency tag has no summary.
54 questions
0
votes
1
answer
221
views
How should ViewModels and Services communicate in a JavaFX + Spring Boot MVVM application?
I'm building a JavaFX + Spring Boot application using the MVVM pattern.
I’m building a generic “wizard” in a JavaFX + Spring Boot MVVM app. A WizardViewModel drives a sequence of steps (STEP_ONE → ...
0
votes
4
answers
500
views
Resolving Dependency Cycles
Class and component dependency cycles
Assume, we have component A with class CA, and component B with class CB, with a cyclic two-way dependency between classes CAand CB. Hence, we have a cyclic ...
2
votes
4
answers
505
views
How to avoid circular dependency in my scenario?
For example, I have a Business Intelligence (BI) microservice, it reads data from other microservices, and displays the data as a bar chart or some other styles.
My problem is, the BI microservice ...
6
votes
2
answers
5k
views
How to easily avoid circular dependencies
In a legacy project's service layer, there are tens of service classes and among them there is one service, UtilityService using 2 other services:
class UtilityService{
private UserService ...
0
votes
3
answers
2k
views
How to solve a circular dependency with a composition relation?
For a game I'm making I have two objects; Gun and ReloadSystem. At the moment, these two object reference each other. Gun tells ReloadSystem to perform a reload when the gun gets clicked, and ...
0
votes
2
answers
308
views
Struggle with catch 22 in initialization code
I have a command line application written in C#. Here's some facts about the program that are relevant to my question:
The application has a "data directory" (e.g. ~/.config/myapp) where ...
3
votes
1
answer
215
views
How to structure python modules/packages according to dependecy inversion
If I am working on a project, say it has this file structure:
car/
body/
__init__.py
doors.py
bonnet.py
engine/
cyclinderhead/
__init__.py
pistons.py
...
0
votes
0
answers
54
views
Designing a proof mechanism
DataModel contains a Proof that contains all the information of its integrity along with the method with which the Proof should be verified.
In this case I designed a JWS type of proof that can be ...
-1
votes
2
answers
175
views
Decoupling 2 Tightly Coupled Classes, Basket and Discount
I have two tightly coupled classes Basket and Discount.
Basket is responsible for keeping track of the items in a shopping basket, keeping track of any discount codes applied, and calculating the ...
0
votes
3
answers
193
views
Logically grouped interfaces have circular dependencies in call graph, tight coupling. Leave as is, break up CRUD interfaces, something else?
The problem I have relates to an existing system in a specific business domain. I've simplified it into a very similar 'Library/Book' relationship to articulate the problem. Answers such as 'why would ...
0
votes
0
answers
488
views
Python circular dependency
I have two classes AST and ASTNode for working with some tree-like data. Both these classes have networkx graph as a field and a node id (integer). For AST this id refers to the root of a tree. These ...
-1
votes
1
answer
325
views
How to implement DAO design pattern?
I'm trying to learn how to implement a DAO design pattern (for a game, but this does not really matter). In my program, I have a database layer which has user objects. Then in the code, I have a DAO ...
2
votes
2
answers
806
views
Modular programming: module inter-dependency
I'm looking to make a clean modular architecture. I hear all around how bad are circular dependencies, and I'm convinced that the less two modules are coupled, the most reusable the code will be.
But ...
-2
votes
1
answer
2k
views
Simple circular dependency between three classes
I have this basic design with a circular dependency. Is there any solution for this? The problem is that a Machine cannot be created if a Model for that Team has been submitted.
5
votes
3
answers
930
views
How to avoid DI dependency cycle for observer pattern
In my project I'm using the observer pattern in several places, i.e. the subject notifies the observers about something, and expect them to act. The subject does not know anything about the details of ...
-2
votes
2
answers
323
views
How to solve this cyclic dependency problem?
I have a Base class that all other classes inherit from, including the User class. However, in the Base class I need to capture the createdBy, updatedBy, and deletedBy fields which all are going to ...
0
votes
0
answers
198
views
How to avoid circular dependency from abstracting navigation in desktop application?
I am trying to abstract some functionality from my desktop application (JavaFX) for changing views.
So, what I am thinking is:
Navigator interface with methods like goToAccountsOverview(), ...
2
votes
3
answers
964
views
Doubt about package-by-feature and circular dependencies
I am implementing a library that:
Takes some input data (I put data structures and classes in the parsing package)
Stores the data in a structure (I put data structures and classes in the storage ...
0
votes
2
answers
4k
views
Circular dependency - is there a good design to eliminate
I was writing some code and came across a scenario that I was thinking about doing a circular dependent class, which I have not done before. I then looked circular dependencies up and whether they are ...
3
votes
2
answers
3k
views
Is circular reference with Typescript array properties bad design?
I understand that having circular dependency can be bad design. However, I have a question regarding a certain class structure.
As an example:
ocean.ts
import {Boat} from './boat';
export class ...
2
votes
3
answers
2k
views
Tight coupling between parent and children: always to be avoided?
Say we consider two inherently coupled elements, using a real-life like example:
Body
PhysicalIllness
Note: the following code is pseudo-Java for the sole purpose of syntax-coloring, pure syntax doesn'...
1
vote
0
answers
90
views
How to solve circular dependency scenario while executing http calls which require authentication?
I am working on a project which requires me to execute standard HTTP calls with session tokens. I am building a custom HTTP client, with a custom authenticator, something like this:
Client client = ...
0
votes
1
answer
144
views
Removing an Object from its holder
Let's assume I have three classes, as follwing:
class A {
Array<B> bs;
createB() { b = new B(); this.bs.insert(b); return b; }
}
class B {
Array<C> cs;
createC() { c = new C(); ...
5
votes
1
answer
2k
views
How can I resolve circular dependency within service layer in a n-tier architecture system?
I am currently starting a new project with a 4-tier architecture design. The layers is set as follow.
+------------------+
+---------...
5
votes
3
answers
20k
views
Resolving circular dependency between two classes
I am trying to resolve a circular dependency between two components in my system. The Messenger component is responsible for sending and receiving messages on a web socket. The Controller component ...
4
votes
3
answers
3k
views
Is 2 methods calling each other code smell?
For example, if 2 classes depend on each other, it is a kind of circular dependency and should be avoided. How about methods? for example, if I have 2 methods which call each other:
public void ...
0
votes
3
answers
294
views
Circular dependency in composition root
I have a MDI MyMDIWinForm that needs an instance of IGUIErrorHanlder for error handling, At the same time IGUIErrorHanlder depends on the MDI MyMDIWinForm for having a place from where to launch pop-...
3
votes
1
answer
435
views
Circular dependency problem
"Single item in a set depends on the whole set. Set depends on that item."
I'm creating a compiler (https://github.com/SuperJMN/Plotty). In the last stage, the Intermediate Code is converted to ...
3
votes
4
answers
764
views
Circular Interface references
I've heard circular references are generally an issue, however I was wondering if this was true for interfaces that reference other interfaces, for example:
IQuestion{
IAnswer getCorrectAnswer();
...
1
vote
3
answers
3k
views
Callback injection
I have a service that needs to make a callback. Basically, it is an event that is expected to be handled in exactly one place, and that is too important to be optional.
The obvious approach seems to ...
-1
votes
3
answers
450
views
Refactoring - Resolve dependencies between legacy code used by third parties
I am developing two libraries in .Net
Firs one it's a library with core functionality (named it Library.Core.dll)
Let's focus in User class
public class User
{
//set of constructors and ...
1
vote
2
answers
6k
views
Remove circular dependency
I have 2 classes that have dependencies.
public class AuditManager
{
//set of methods
public static AuditManager Singleton= new AuditManager();
public int AuditEvent(int x){
...
3
votes
2
answers
2k
views
What other approaches are there to break circular dependency in MVC?
I'm attempting to build a web front-end based on the MVC pattern, as opposed to based on the libraries involved (e.g. React.js).
I'm using constructor-based dependency injection and interfaces to de-...
3
votes
3
answers
227
views
What is the motivation or usage to create a interface use once only just for breaking circular dependency?
I understand if 2 classes have circular dependency, eg:
public class MyWindow{
public MyWindow(){
new MyDialog(this);
}
public onDialogResponse(int option){
}
}
public class ...
7
votes
2
answers
6k
views
What are the potential problems with operational circular dependency between microservices
I am relatively new to microservice architecture and I was never before involved in a project where the architect insists on having a circular dependency between services.
I am in a position without ...
3
votes
1
answer
110
views
Logging an error and creating an error when the logging fails create a circular dependency between two projects
As part of a program I am developing for practice purposes, I've created a namespace Core designed to contain the core code resources for the program to use. This namespace is in a Class Library ...
-1
votes
3
answers
2k
views
Architecture, database design, avoid a circular reference
I have to design a database in a Rails application, where I have users (who can login), companies and jobs.
Each user belongs to a company, and each job belongs to a company, so when a user logs in, ...
27
votes
5
answers
4k
views
How to model a circular reference between immutable objects in C#?
In the following code example, we have an class for immutable objects that represents a room. North, South, East, and West represent exits into other rooms.
public sealed class Room
{
public Room(...
0
votes
1
answer
96
views
Mutual observer
I want my Wire objects to be in connection with Port objects. That is Port has a list of connected wires and method Port.add(wire). Similarly, Wire has list of ports it is connected to and Wire.add(...
1
vote
2
answers
1k
views
Help with getting rid of circular dependency
I have the following circular dependency that I'd like to eliminate. I think I must have a flaw in my design. And I'd much appreciate any feedback on how to fix this.
My circular dependency comes ...
0
votes
1
answer
107
views
Reflexive calls of objects in the same hierarchy
I am not sure how to phrase this. I believe this should have been asked somewhere, but I am unable to find it because I don't know the keywords.
Basically, I have some types like this:
interface Foo
...
16
votes
5
answers
26k
views
If A has B and B holds reference of A, is it a flawed design need to be fixed? [duplicate]
Suppose, I have class Boss and Worker; Boss has a Worker and Worker holds a reference of Boss:
Boss.h
#include "Worker.h"
class Boss{
public:
Worker worker;
};
Worker.h
class Boss;
class Worker{...
0
votes
2
answers
2k
views
How to remove circular reference when there is inter-dependence
I made an extensive research in previousv related questions, but since my questions is somewhat peculiar, I decided to create this new one.
I am implementing a visualisation application (in JS). ...
0
votes
0
answers
160
views
Should I reference both up and down a hierarchy when using Entity Framework?
Let's say I'm modelling an organizational hierarchy which consists of Divisions that contain Departments that contain Teams. So Division -> Department -> Team.
While it makes sense for the Division ...
1
vote
4
answers
233
views
File-Directory Implementation: Does a a file have to own a reference to it's dir?
I am currently issuing a problem while forming the program-design, which is exact like a File-Directory relationship, and to ease it, I am using that as an example.
I think it is usual, that a ...
1
vote
3
answers
218
views
What was the first language that allowed a class to contain a member of it's own type
So, I had to create a class that had a member of it's own type. I looked into why this was possible, which is fascinating. Reading the answer, I find that a lot of work had to go into making this work,...
0
votes
4
answers
2k
views
Circular dependencies: Recursive grammar parser (e.g. json)
(TLDR) To build a parser for a recursive grammar by composition of individual parsers (e.g. with a parser combinator framework), there are often circular dependencies between some of the individual ...
52
votes
3
answers
121k
views
How to solve circular dependency?
I have three classes that are circular dependant to each other:
TestExecuter execute requests of TestScenario and save a report file using ReportGenerator class.
So:
TestExecuter depends on ...
2
votes
2
answers
5k
views
Designing classes that depend on each other
How would one go about designing classes for a system in which two components depend on each other?
For a more concrete example, consider this scenario, you're designing a piece of software to manage ...
3
votes
1
answer
1k
views
How to calculate number of indirect dependencies of a class?
Most of the static code analysis tools which analyse class dependencies generate dependency pairs of classes where each pair represents a direct dependency between two classes. Given those dependency ...