# android


06/19/2020, 5:37 PM
I’m sorry if this has already been debated in here but I really want to get people’s opinions about Koin vs Hilt. I work on an app that was originally using Dagger 2 but we switched over to Koin over a year ago and I really like it compared to Dagger 2. Now that Hilt is out I’m facing a tough decision of whether or not I switch to it. Koin has worked really well for the app I work on and it has solved a lot of problems that Dagger 2 struggles with. Hilt seems to simplify things over Dagger 2 but it seems as though Koin still has the upper hand in certain areas. Hilt is backed by Google and supposedly has a better performance so I’m faced with a tough decision.

Afzal Najam

06/19/2020, 6:00 PM
I mean Dagger 2 and Dagger Android were also backed by Google but that didn't stop you from going with Koin. So what's different this time? I haven't used either yet. Still with Dagger 2 + Dagger-android but I think if Koin works for you and there's nothing particular about Hilt that really gives you further benefit, why bother?
☝️ 5

Roger Home-Martinsen

06/19/2020, 6:15 PM
You must have a quite clean architecture and clean code if you are considering swapping DI (OK, I get it - Koin is a service locator) solution again. It is quite some work. My atitude on performance is that controll is more important than the speed of each operation. I also tend to write more tests when using koin. We have decided to go for Koin.

John O'Reilly

06/19/2020, 7:24 PM
Probably not an issue for you right now but if you decide to go down Kotlin Mulitplatform (KMP) route then worth knowing that Koin is supported in shared KMP code
👍 3


06/19/2020, 9:31 PM
Volley was backed by Google. I worked on a team that went spent too long down that path shudder
😂 3
😬 2


06/19/2020, 9:41 PM
dagger was originally written by crazy bob who worked at google but also worked at square
😮 1
time is a flat circle


06/19/2020, 9:58 PM
Honestly I haven't used Koin, but from what I've seen, there's more boilerplate when using it. With the introduction of Hilt, Dagger should become much more pleasant to work with in Android. For large projects I think Hilt would be a better pick


06/19/2020, 10:04 PM
i’m a dagger to koin convert
i love koin


06/20/2020, 7:38 AM
Aside from dev experience, it should be noted that one is app runtime performance optimized and the other is build time performance optimized.
☝️ 2


06/20/2020, 9:20 AM
It took quite a few years for Google to support Kotlin and it will take a while to abandon dagger/hilt.
👍 1


06/20/2020, 9:59 AM
Dagger 2 I would say is better than Koin. One because it scales properly . As in the bell curve spikes but pretty much evens out. Two Dagger is supported by Google, which means there is IDE support, and it will work well with future versions of Jetpack libraries. Not saying Koin is bad, its def good . But for a production app your going to want Google supported libraries over 3rd party over third party.
👍 1


06/20/2020, 11:47 AM
Depends on your team size as well. Koin can blow up at runtime if you don't set up your dependencies correctly (missing and circular). I used it in a previous project with a team size of 12 and we still managed to add a circular dependency. On a team size of 30 now... So having compile time safety is nice but Dagger also causes pain trying to get there dependencies right at compile time sometimes but there have never been runtime failures found by QA...

Joost Klitsie

06/20/2020, 4:26 PM
@JerryMiah what were your points to switch to Koin in the first place then? Maybe if you list the pros/cons, then compare to Hilt's pros and cons, then it might be clearer (Also I would be curious to hear your comparison between Koin and Dagger)
☝️ 1


06/22/2020, 1:49 PM
It was towards the end of 2018 that I was feeling frustrated with some of the complexities of dagger. I can’t remember now what exactly I was trying to do but it wasn’t going well. I had heard about Koin months prior to that so I decided to start to give it a shot and started experimenting with Koin a little. I was surprised by easy it was to work with and wasn’t complicated at all to do what I needed. In the end I just felt that Koin was more developer friendly plus I also liked that it is written all in Kotlin. It was easy to convert the app to use Koin so I went forward with it. If there was a hit in performance then it must have been very insignificant as there was no visible evidence of it. I have played around with Hilt and do I feel as though it helps reduce some of the complexities of Dagger 2 but there are still features I use in Koin that are not nearly as easy to do in Dagger 2. I might just wait until Hilt progresses a little more and re-evaluate. Thanks everybody for your opinions!