Matej Drobnič
09/12/2019, 10:18 AMCoroutineScope
. This practically requires such functions to reside on top level, since calling member extension functions of other classes is very awkward in Kotlin. But on the other hand, I fail to see how to properly handle dependencies in top level functions.
* For example if I have Downloader
class that has CoroutineScope.startDownloading
method, I can inject every dependency of the downloader easily via constructor, but calling startDownloading()
is awkward (I need to call it via with (downloader) {startDownloading())
statement).
* On the other hand, if I just create CoroutineScope.startDownloading()
top level method, it would be easy to call, but I would have to provide dependencies with every single call to that method, which would create messy code.spand
09/12/2019, 10:58 AMMatej Drobnič
09/12/2019, 11:54 AMspand
09/12/2019, 11:58 AMInstant::now
.streetsofboston
09/12/2019, 11:59 AMMatej Drobnič
09/12/2019, 12:30 PMcedric
09/13/2019, 6:07 PMReader
is a worse form of DI in all respects. I’d argue it’s not even dependency injection, it’s dependency passing, which only covers a subset of what DI actually enables.jimn
09/19/2019, 7:03 AM