Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cyclic dependencies #382

Open
ChinZJ opened this issue Feb 25, 2025 · 1 comment
Open

Cyclic dependencies #382

ChinZJ opened this issue Feb 25, 2025 · 1 comment

Comments

@ChinZJ
Copy link

ChinZJ commented Feb 25, 2025

Given the following diagram

Image

Is getInfo() considered a cyclic dependency? If so, should it not be avoided?

@ChinZJ ChinZJ changed the title (Week 6) Cyclic dependencies Cyclic dependencies Feb 25, 2025
@damithc
Copy link
Contributor

damithc commented Mar 7, 2025

Is getInfo() considered a cyclic dependency?

@ChinZJ may or may not be. Depends on the code. In the following case, it is not.

interface Factory {
    String getInfo();
}

class ParserFactory implements Factory {
    // ...
}

class Parser {
    Parser(Factory f) {
        f.getInfo();
    }
}

If so, should it not be avoided?

We try to minimise cyclic dependencies in particular, and dependencies in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants