Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Koin vs Kodein - Dependency Injection what you prefer? Kotlin [closed]

Tags:

What dependency injection for Android with Kotlin do you prefer? I have started using Kodein but i don't want to lose my time if Koin it's better.

I have read this presentation https://www.kotlindevelopment.com/koin-vs-kodein/ by Makery Kotlin Development it's really nice.

From that presentation these are the differences:

Kodein

  • Robust
  • Tons of feature
  • Great documentation
  • More complicated API

Koin

  • Smaller
  • Less feature
  • Natural API

Github stars Kodein 1164 vs 1350 Koin


Thanks !!

like image 612
SergioCT Avatar asked Jul 13 '18 08:07

SergioCT


People also ask

Which is better KOIN or hilt?

As I mentioned before Dagger/Hilt has a significant impact on build time due to code generation. On the other hand, Koin also affects time, but not build, but runtime. Koin has slightly worse runtime performance, because it resolves dependencies at runtime.

Is KOIN a dependency injection?

Koin is a dependency injection framework for Kotlin. It is lightweight, can be used in Android applications, is implemented via a concise DSL, and takes advantage of Kotlin features like delegate properties rather than relying on annotations.

What is Kodein Kotlin?

What is Kodein? Kodein (for KOtlin DEpendency INjection) is a DI framework. It allows you to bind your business unit interfaces with their implementation and thus having each business unit being independent. If you are not familiar with Kodein, its pros / cons, etc go ahead and check documentation (it is great).

Is Kodein a locator?

One thing to note is out of the three, technically only Dagger uses a dependency injection (DI) pattern; Koin and Kodein are service locators.


1 Answers

As my project is small I prefer Koin, because is lightweight library. It has a good API for scopes and wrapper for VM from Android Architecture Components. But you should know that Koin looks like Service Locator.

like image 143
Aleksandr Melnikov Avatar answered Sep 19 '22 16:09

Aleksandr Melnikov