0

Let's say we have an abstract class A, a concrete class B, and a concrete class C. The relationships between these classes are depicted as following

enter image description here

  1. Is this an acyclic dependency?

If yes, I have two more questions

  1. Is it a bad practice that we need to avoid?
  2. What is a solution for this scenario?
Uvuvwevwevwe
  • 971
  • 14
  • 30
  • The answer to this question largely depends on your specific use cases and language of choice. See: https://stackoverflow.com/questions/1897537/why-are-circular-references-considered-harmful – Cameron Tinker Dec 14 '20 at 22:13

1 Answers1

1
  1. No, this is clearly a cyclic dependency. A depends on C which depends on B which depends on A.
  2. While this example is not something I remember encountering anywhere, I can imagine that there might be use cases where this makes sense. Circular dependencies are not always bad.
  3. That totally depends on the exact use case.
EricSchaefer
  • 25,272
  • 21
  • 67
  • 103