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

Kotlin Clean Code

Kotlin Clean Code

Are you an Android developer? Do you have huge monolithic fragments in your code? Are there too many non-testable classes? Are you faced with poor code coverages? Doesn’t this sound like a familiar story in Android app engineering? Kotlin Clean Code can help you solve these problems and improve the developer experience.

In this experiential talk, Mohanraj Karatadipalayam gives you a detailed overview of Kotlin Clean Code For Android, that enables the developers to write clean code, that has a good degree of separation of concerns and testability. He explores in detail, the need for Kotlin Clean Code for Android that makes programming more predictable. Using real examples and code snippets, Mohan highlights key challenges encountered while writing such apps and how he overcame them.

What actionable benefits/knowledge will attendees gain by attending your talk?
Key Takeaways from this talk include:
 
* Understanding the need for Kotlin Clean Code For Android
* Learn how it differs from other patterns
* Learn how to write apps using Kotlin Clean Code For Android
* Learn about how to code less and test more in an efficient manner

Mohanraj K.M.

April 22, 2019
Tweet

More Decks by Mohanraj K.M.

Other Decks in Technology

Transcript

  1. CONFIDENTIAL & RESTRICTED Receptive to unit testing? Tools support Uses

    minimal mocking / no mocking at all Soup ? WHAT ABOUT APP ARCHITECTURE?
  2. CONFIDENTIAL & RESTRICTED UNIT TESTING OF APPS UNIT TESTING OF

    APPS Trivial ? Code coverage ? How much we test ?
  3. CONFIDENTIAL & RESTRICTED LET US START WITH UNIT TESTING o

    Functions are doing everything everywhere o Intertwined o Testing them ? o Mock it ?
  4. CONFIDENTIAL & RESTRICTED “One of the major reasons behind the

    failure of the unit test automation is an architecture of the app that does not support unit testing.”
  5. CONFIDENTIAL & RESTRICTED Android code has a massive activity or

    fragment Typical fragment class do the below tasks Data retrieval from data sources Data manipulation and decoration UI Specific activities Life cycle UNIT TESTING IN APPS
  6. CONFIDENTIAL & RESTRICTED Native Mobile Development Patterns • MVMM •

    MVP • VIPER – View Interactor Presenter Entity Route • Clean Swift
  7. CONFIDENTIAL & RESTRICTED LET’S SPLIT IT UP 1 Get data

    from one or more data source à Interactor 2 Modify data in form that can be presented by the fragment à Presenter 3 Present data and listen to user events à Fragment
  8. CONFIDENTIAL & RESTRICTED CONFIGURATOR Does the wiring of the dependencies

    Worried about writing too many boilerplate codes?
  9. CONFIDENTIAL & RESTRICTED • Smoke test • how do we

    test the fragment without Interactor? LET’S TEST IT
  10. CONFIDENTIAL & RESTRICTED • What is the work of Interactor?

    • data from the data sources like local DB, web service and content provider INTERACTOR
  11. CONFIDENTIAL & RESTRICTED • If the task is simpler, you

    can have all the work done by the Interactor itself. • When you foresee that the task can be reused somewhere else in the app, move it to the worker. WHAT IS THE NEED FOR THE WORKER?
  12. CONFIDENTIAL & RESTRICTED • We don’t need a real worker,

    let’s create a spy. • And Spy for presenter INTERACTOR UNIT TESTING
  13. CONFIDENTIAL & RESTRICTED References • https://medium.com/@kmmraj/kotlin-clean-code-for-android-series- f3b32307342d • http://bit.ly/KtlnCC4Drd •

    https://github.com/kmmraj/kt-clean-code4Android-generator • https://github.com/kmmraj/KotlinCleanCode4Android • https://clean-swift.com/ https://medium.com/@kmmraj