Earlier quoted context omitted.
I've worked with very high level engineers at Google that thought cyclic dependencies are fine. Sometimes they are just the simplest solution and trying to design abstractions to avoid it just creates a huge mess. If you've working with Java at Google (Guice) makes you learn to hate hiding circular dependencies behind dependency injection, since your binary gets injected by some huge tree of thousands of dependencies…
I have to say that in my whole career of doing Java / Clojure, Google’s SDK are one of the worst in terms of dependency hell. It’s incredibly unpleasant to work with, lots of breaking incompatibilities with libraries, etcetera. I may sound very snarky, but it really feels like an over engineered mess and I suspect the reason they need all these dependency tricks is the fact that it’s over engineered, not necessarily…
Cyclic dependencies are evil (2013)
91–100 of 125 posts
Re: Cyclic dependencies are evil (2013)
#92Language constraints aside, the real world is not something that can be cleanly modeled without the notion of circular dependencies between things. Not very many real, practical activities can be truly isolated from other closely-related activities and wrapped up in some leak-proof contract. Consider briefly the domain model of a bank. Customers rely on Accounts (I.e. have one or many). Accounts rely on Customers (i.…
Re: Cyclic dependencies are evil (2013)
#93The generic way to remove a cyclic dependency is by Dependency Inversion (not to be confused with Dependency Injection), so that a mutual dependency A B is transformed into the noncircular set of dependencies { A –> BIntf , BImpl –> BIntf , BImpl –> A }. That is, at least one node in the dependency cycle is split into interface and implementation, breaking the cycle. Compilers for languages like C# and Java can deal…
Re: Cyclic dependencies are evil (2013)
#94 mod widget
struct Widget
fn show(Widget) { ... }
fn join(Widget) { ... }
fn calc_box(Widget) { ... }
and one function is getting very long and complicated so I want to spin it out into its own module mod widget mod calc_box
import calc_box from widget import Widget
struct Widget fn calc_box(Widget) { ... }
fn show(Widget) { ... }
fn join(Widget) { ... }
The reason the article gives that this is "evil" is that there is no hierarchy between the modules; the cycle is really just one big supermodule. That's true... but that was basically the point. Where is the "evil" here?Re: Cyclic dependencies are evil (2013)
#95Language constraints aside, the real world is not something that can be cleanly modeled without the notion of circular dependencies between things. Not very many real, practical activities can be truly isolated from other closely-related activities and wrapped up in some leak-proof contract. Consider briefly the domain model of a bank. Customers rely on Accounts (I.e. have one or many). Accounts rely on Customers (i.…
Re: Cyclic dependencies are evil (2013)
#96The simplest case where I'd want a circular dependencies is I have a module that defines some data types and functions on those types mod widget struct Widget fn show(Widget) { ... } fn join(Widget) { ... } fn calc_box(Widget) { ... } and one function is getting very long and complicated so I want to spin it out into its own module mod widget mod calc_box import calc_box from widget import Widget struct Widget fn cal…
Re: Cyclic dependencies are evil (2013)
#97Language constraints aside, the real world is not something that can be cleanly modeled without the notion of circular dependencies between things. Not very many real, practical activities can be truly isolated from other closely-related activities and wrapped up in some leak-proof contract. Consider briefly the domain model of a bank. Customers rely on Accounts (I.e. have one or many). Accounts rely on Customers (i.…
Sometimes I read conversations about software engineering concepts by career developers and I get this sense that there is this entire hidden world of other engineers that I have somehow managed never to encounter. Every engineer I've ever met who has been doing it for more than a couple years universally decries circular dependencies. Every one of them has come to that opinion via hard won experience dealing with re…
Re: Cyclic dependencies are evil (2013)
#98The simplest case where I'd want a circular dependencies is I have a module that defines some data types and functions on those types mod widget struct Widget fn show(Widget) { ... } fn join(Widget) { ... } fn calc_box(Widget) { ... } and one function is getting very long and complicated so I want to spin it out into its own module mod widget mod calc_box import calc_box from widget import Widget struct Widget fn cal…
In that case you can separate ’struct Widget’ into another file. This way there will be no circular dependency
Re: Cyclic dependencies are evil (2013)
#99Earlier quoted context omitted.
Sometimes I read conversations about software engineering concepts by career developers and I get this sense that there is this entire hidden world of other engineers that I have somehow managed never to encounter. Every engineer I've ever met who has been doing it for more than a couple years universally decries circular dependencies. Every one of them has come to that opinion via hard won experience dealing with re…
> Every engineer I've ever met who has been doing it for more than a couple years universally decries circular dependencies. Every one of them has come to that opinion via hard won experience dealing with real world problems they encountered. They may not realize they have them - at runtime, in the object graph, possibly indirectly. There's little difference in principle between cycles in "static" code vs. runtime st…
Re: Cyclic dependencies are evil (2013)
#100Earlier quoted context omitted.
In that case you can separate ’struct Widget’ into another file. This way there will be no circular dependency
I know how to break the cycle. What I'm asking is why should I break the cycle?