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

Menjadi Android Developer Expert - BDT DAY 2020 -

Ahmad Arif Faizin
November 29, 2020
240

Menjadi Android Developer Expert - BDT DAY 2020 -

How to not only make apps, but how to make good apps with architecture that easy to understand, easy to maintain, and easy to change.
https://youtu.be/60tbLQzS8g4?t=6776

Ahmad Arif Faizin

November 29, 2020
Tweet

More Decks by Ahmad Arif Faizin

Transcript

  1. “Even bad code can function. But if code isn’t clean,

    it can bring a development organization to its knees.” -Uncle Bob
  2. • Independent of Framework • Testable • Independent of UI

    • Independent of Database • Independent of External Clean Architecture
  3. • Without DI class Car { private val engine =

    Engine() fun start() { engine.start() } } fun main() { val car = Car() car.start() } • With DI class Car(private val engine: Engine){ fun start() { engine.start() } } fun main() { val engine = Engine() val car = Car(engine) car.start() } DI Manual Manual DI
  4. Automated Injection with Koin • Before class MainActivity : AppCompatActivity()

    { lateinit var engine: Engine override fun onCreate(...) { ... engine = Engine() val car = Car(engine) car.start() } } • After class MainActivity : AppCompatActivity() { val engine: Engine by inject() override fun onCreate(...) { ... val car = Car(engine) car.start() } }
  5. Automated Injection with Dagger • Before class MainActivity : AppCompatActivity()

    { lateinit var engine: Engine override fun onCreate(...) { ... engine = Engine() val car = Car(engine) car.start() } } • After class MainActivity : AppCompatActivity() { @Inject lateinit var engine: Engine override fun onCreate(...) { appComponent.inject(this) ... val car = Car(engine) car.start() } }
  6. Automated Injection with Dagger Hilt • Before class MainActivity :

    AppCompatActivity() { lateinit var engine: Engine override fun onCreate(...) { ... engine = Engine() val car = Car(engine) car.start() } } • After @AndroidEntryPoint class MainActivity : AppCompatActivity() { @Inject lateinit var engine: Engine override fun onCreate(...) { ... val car = Car(engine) car.start() } }
  7. Why Modularization? • Separation of concern • Proses build jadi

    lebih cepat • Code ownership • Reusability • Lebih aman ketika crash • Batasan yang lebih jelas daripada package • Bisa membuat Instant App dan Dynamic Feature Replace Me! (Bisa ditambahkan dengan image yang relevan)
  8. Summary • Ingat Software Design Principle • Pelajari Clean Architecture

    supaya kode lebih mudah dikembangkan • Pelajari Reactive Programming supaya kode lebih mudah dipahami • Pelajari Dependency Injection supaya kode lebih mudah digunakan kembali • Pelajari Modularization supaya kode lebih mudah dikelola