GithubHelp home page GithubHelp logo

Comments (16)

MrIceman avatar MrIceman commented on September 17, 2024 2

@gzodx the issue with java code is that it requires a JVM which strikes out iOS and any other platform that has no JVM.
Hilt is a wrapper over Dagger. Let's have a look at Kodein

from kotlin-sdk.

FreedomChuks avatar FreedomChuks commented on September 17, 2024 2

Okey @MrIceman

from kotlin-sdk.

galalen avatar galalen commented on September 17, 2024 1

I agree with @gzodx implementing this from scratch would be hard to scale. If koin causes unexpected bugs then I guess dagger is a better choice

from kotlin-sdk.

akulinski avatar akulinski commented on September 17, 2024

@MrIceman do we want to use dagger or koin ?

from kotlin-sdk.

MrIceman avatar MrIceman commented on September 17, 2024

@akulinski What I don't like about koin is that it resolves dependencies at runtime and can cause unexpected bugs, Dagger on the other hand has a big overhead. What do you think about implementing an own factory per module which holds singleton instances of each repository? E.g.
object BankFactory { val repository: BankRepository by lazy { BankRepositoryImpl(**Injections**) } 
After all, this is what Dagger generates and in a too complicated way imo.

from kotlin-sdk.

FreedomChuks avatar FreedomChuks commented on September 17, 2024

i dont think we should do this because we have to look at it at scale and it 100 going to grow it best of we use dagger

from kotlin-sdk.

MrIceman avatar MrIceman commented on September 17, 2024

Dagger is implemented in Java, our aim is to be multiplatform in future. What about a Kotlin solution?
https://github.com/Kodein-Framework/Kodein-DI

Does anyone want to do some research and rate it?

from kotlin-sdk.

FreedomChuks avatar FreedomChuks commented on September 17, 2024

I don't think dagger being written in java changes anything about it use in multiplaform ,my only problem with koin or Kodein are the fact that they are more of a service locator then a DI lib ,they do all their dependencies graph generation and all on run time which potentially can lead to runtime errors or slow down the app and the main concern once it begins to scale that when it becomes a big overhead to manage

from kotlin-sdk.

FreedomChuks avatar FreedomChuks commented on September 17, 2024

We don't have to go through dagger 2 over head we can actually use hilt which take 90% of the boilerplate but if KMM if what our focus is then https://github.com/Kodein-Framework/Kodein-DI would be a better solution @MrIceman

from kotlin-sdk.

IanArb avatar IanArb commented on September 17, 2024

Why don't we just delegate the dependency injection to each platform (i.e. Android and iOS) ?

from kotlin-sdk.

FreedomChuks avatar FreedomChuks commented on September 17, 2024

The idea to focus on Android first then we target KMM

from kotlin-sdk.

MrIceman avatar MrIceman commented on September 17, 2024

@IanArb from SDK point of view we should offer instances of the specific UseCases / Repositories already to the host app. So the HostApp at the end would only have to call something like
TNBClient.bankManager and we'd provide the bank manager instance lazy

from kotlin-sdk.

khurram-saeed-malik avatar khurram-saeed-malik commented on September 17, 2024

I can create this kind of solution. Will look at in the upcoming weeks and try to build custom factory(ish) pattern to resolve the current challenges and the future ones.

from kotlin-sdk.

IanArb avatar IanArb commented on September 17, 2024

Hey @khurramsaeed feel free to take this one and looking forward to your solution!

from kotlin-sdk.

IanArb avatar IanArb commented on September 17, 2024

Hey @khurramsaeed just checking in to see if you need any help?

from kotlin-sdk.

IanArb avatar IanArb commented on September 17, 2024

Going to close this issue now. We'll be using Dagger.

from kotlin-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.