https://kotlinlang.org logo
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
benchmarks
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
confetti
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hiring-french
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
lincheck
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by
Title
a

Ahmed Mamdouh

10/01/2019, 1:37 PM
what library do you use to di in kotlin ?
🍿 5
e

Efe

10/01/2019, 1:42 PM
koin #koin
a

Alexander Stark

10/01/2019, 1:43 PM
Dagger2, but probably not the best choice. We’re using it since we’re working on a big legacy project and it’s not easy to change
k

Kris Wong

10/01/2019, 1:44 PM
i haven't read anything that's lead me to believe Dagger is not a good choice
👏 11
a

Ahmed Mamdouh

10/01/2019, 1:45 PM
@Efe i started to use #koin , it's so easy and i'm a little worried
a

Andy Gibel

10/01/2019, 1:47 PM
Toothpick
a

Ahmed Mamdouh

10/01/2019, 1:48 PM
@Kris Wong dagger2 is definitely a good choice but the initial setup and all that code is the real pain.
t

tapchicoma

10/01/2019, 1:49 PM
just kotlin :troll:
k

Kris Wong

10/01/2019, 1:49 PM
dagger2 definitely has a learning curve. i'd call it steep.
👍 6
a

Ahmed Mamdouh

10/01/2019, 1:50 PM
@Andy Gibel i should check that out.
@tapchicoma ofc but, not when you're taking unit tests seriously.
t

tapchicoma

10/01/2019, 1:53 PM
why not? You could still provide dependencies through constructor params without any DI framework
👍 2
a

Andy Gibel

10/01/2019, 1:53 PM
@Ahmed Mamdouh wait about a month and the new, kotlin first, version will be released publically 🙂
👍 1
a

Ahmed Mamdouh

10/01/2019, 1:54 PM
@tapchicoma aha , got you sorry
@Andy Gibel i already like what i am reading about it , and how safe it is , thank you ! 🙂
g

Giorgio Antonioli

10/01/2019, 1:59 PM
I work on a huge project with around 130 Gradle modules and honestly Dagger is the only viable choice for us. Furthermore Koin is a service locator, not a dependency injector
👍 2
e

Efe

10/01/2019, 2:03 PM
that is right. It doesn’t have to use di pattern to be useful 😄 it is a charm for small-medium size projects.
a

Ahmed Mamdouh

10/01/2019, 2:03 PM
@Giorgio Antonioli thank you for clearing that up !
e

Efe

10/01/2019, 2:04 PM
for large projects runtime injections would hurt though
👍 3
m

Marc Knaup

10/01/2019, 2:44 PM
None. Tried multiple times. Always more hassle to maintain and debug than it does actually solve problems. imo not needed in most projects until they become huge.
👍 2
👎 2
a

Ahmed Mamdouh

10/01/2019, 2:57 PM
@Marc Knaup what i like about di is that you don't recreate/instantiate objects every time you need them , you just inject them to classes , it's a good practice that leads to a good architecture and a clearer code , if you opened any class you'd find that any foreign class is being injected in the same pattern , that way it's easier to read , it's just building the di framework can be hassle at first but it's worth it.
l

Lou Morda

10/01/2019, 4:55 PM
opinion time: large project dagger, small project koin. best to form your own opinion tho! 🙂
👍 4
m

Marc Knaup

10/02/2019, 2:42 AM
@Ahmed Mamdouh I also create them only once or per transaction, whatever makes sense in a given context. This is not unique to DI. You can have pretty clear code without DI too. In my experience that code was always more navigable because you can use all IDE and static tooling and basic Kotlin knowledge to understand what your code is doing, when objects are created and where they live. Try doing the same with Dagger. Once you have a bunch of modules and components it can still work, but once something breaks unexpectedly you'll have a hell of a debugging session. Usually if my project's dependencies become complex I start refactoring to simplify the project structure and flatten the dependency tree rather than adding more tools to manage that complexity. Bonus points: As it's still plain old Kotlin new developers in the project don't have to learn any DI library and it's annotations, classes, functions, methodology and quirks first. They just need their Kotlin knowledge. I won't judge DI in general as there are so many different types of projects at all sizes - it can have its merits. Just in all Kotlin projects I've worked on so far - mostly backend systems of varying size, Android apps and general libraries - it just wasn't needed nor useful and sometimes detrimental. As with everything when programming: Whether something is useful or not depends on the context.
a

Alexander Stark

10/02/2019, 5:18 AM
I just said, that Dagger might not be the best choice. Depending on your use case. Dagger is a very mighty framework and provides solutions for many different use cases. Koin or Kodein might be simpler. Also keep in mind that annotations slows down your build times
j

Jeremy

10/02/2019, 2:56 PM
I'm not sure that Dagger is more complex unless you're specifically talking about dagger-android. If not ready for Dagger just use constructor injection+homegrown solution. At same point the benefit of not maintaining the boilerplate yourself will become obvious
a

Ahmed Mamdouh

10/02/2019, 3:52 PM
@Marc Knaup ok , i understand your point , from where you stand right now di seems useless and just a burden , and i feel the same sometimes, when i said clearer code i meant having a common ground where all developers using di understand where goes where instantly.
@Marc Knaup i mean , i saw developers using extensions differently , kotlin is so wide and expressive which makes it slightly hard to have a common and perfectly set way , that's why i respect what you are saying you shouldn't use anything just for the sake of it.
m

Marc Knaup

10/02/2019, 4:10 PM
@Jeremy yeah my experience with Dagger is mostly Android. There are indeed many ways to do dependency management even without DI frameworks. Good point that without DI framework devs will come up with different solutions. So there should be a strong per-project convention at least 🙂
j

Jeremy

10/02/2019, 4:12 PM
I know this is #android but I've been experimenting and thinking of DI patterns that work across iOS/Android. iOS obviously doesn't have Dagger so currently investigating the manual injection route while Android assembles dependencies using Dagger
Developing good abstractions, separations is most important and how everything assembled less important imo
👍 1
If your implementation is dependent on a DI library that is def a code smell
a

Ahmed Mamdouh

10/02/2019, 4:37 PM
@Marc Knaup exactly 🙂