Upgrade to Pro — share decks privately, control downloads, hide ads and more …

手動DIの教訓

mkeeda
October 27, 2023

 手動DIの教訓

Cybozu Mobile Meetup 2023.10.27で登壇したLTのスライド資料です。
https://cybozu.connpass.com/event/299246/

mkeeda

October 27, 2023
Tweet

More Decks by mkeeda

Other Decks in Programming

Transcript

  1. DI (Manual Dependency Injection) 3 rd perty DI 3 class

    RemoteDataSource { // ... } class Repository( private val remoteDataSource: RemoteDataSource ) { // ... } class Component { private val remoteDataSource = RemoteDataSource() val repository = Repository(remoteDataSource) }
  2. 14

  3. :shared :module-a SingletonComponent Class A C Component A :module-c Class

    C Component C Class A singleton 🔄 15 Component
  4. :shared Interface Module B singleton :module-b :module-a 16 SingletonComponent Class

    A Class B singleton Component A Class A singleton 🔄 Component
  5. :module-b :shared :module-a 17 SingletonComponent Impl Class A Class B

    singleton Component A Class A singleton Interface Module B singleton Component
  6. DI 18 :module-b :app :module-a SingletonComponent Impl Class A Class

    B singleton Component A :module-c Class C Component C Class A singleton Interface Module B singleton Interface Module A singleton SingletonComponent
  7. 22