by orbz · 4y ago · 0 comments
Hitting cyclical dependencies is an indication that the code base is not being built in a composable fashion with layers depending on other layers. This is usually solved with more packages of more focused independent functionality rather than less packages of less functionality.
Also, dependency injection. It's possible to get rid of all dependencies if your code just refers to abstract interfaces and delegates the responsibility to provide concrete implementations to downstream dependencies.
Interfaces can help if you have multiple things that all implement the same functionality or you need to mock out for testing, but often times people will create interface bloat for things that are only implemented by a single struct and there’s no benefit to testing.