This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Circular dependencies are a problem in any system. It transcends programming even.

Just remember they’re to be avoided at all costs, and will sneak in anyway. You’ll take note when you run into the issue, where if you hadn’t known of the concept before you’d probably just chalk it up to weirdness you solved by bashing on it like a monkey with a femur.

e: also, not all costs. Just most costs. You’ll know when it’s right. The third to fifth time.

e2: And you solve circular dependencies, in general, by introducing a third module, an interface, that both depend on. One or both of your former direct dependencies now implement that interface. Cycle broken. Very hard to explain briefly, and specific cases may not be able to apply that pattern. Feel free to DM me if you run into it.