I'm still a fan of doing things the simplest way.....
# functional
s
I'm still a fan of doing things the simplest way.. I have some orchestrator functions that wires everything together like
module { }
but it returns
class Module(val a: ServiceA, val b: ServiceB)
, etc. Then I simply pass them around throughout the callgraph of my app but as fine grained as possible. Typically this results in me splitting into feature modules as well when the app grows.
class Module(val a: FeatureA. val b: FeatureB)
with
class FeatureA(val a: ServiceA, val metrics: MetricsA)
. From personal experience it results in roughly the same or less than using Koin, Dagger/Metro. Less framework to learn, and easy to understand/click-through. I think it might be a habit I picked up from working with other languages. In Java/Kotlin people tend to heavily lean on DI frameworks.
w
I wrote up this awhile back to help explain my approach to some of my Kotlin novice coworkers: wakingrufus.neocities.org/adhoc-polymorphism