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

Modern, maintainable and coRRRect project

Igor Wojda
November 06, 2020

Modern, maintainable and coRRRect project

Each day our software projects become more and more complex. It may because of changes introduced into the Android platform, some external ecosystem change, or the developer community that just discovered a better solution for an existing problem. On top of that our application is constantly evolving driven by a stream of new business requirements. In this dynamic environment, we have to guarantee not only protection about regressions but also high code quality. Let's take a look at various ways of improving and verifying the Android projects and ways to integrate these tools into the modern software development life cycle.

Igor Wojda

November 06, 2020
Tweet

More Decks by Igor Wojda

Other Decks in Technology

Transcript

  1. Modern, maintainable and
    coRRRect project
    1

    View full-size slide

  2. 2
    Hello!
    I AM IGOR WOJDA
    Android Developer Advocate, Vonage
    @igorwojda

    View full-size slide

  3. BECOMING A DEVELOPER
    Day 0:
    ◦First “Hello, World” program
    ◦First variable
    ◦First method
    ◦First class
    ◦First module
    ◦...
    3

    View full-size slide

  4. Why does developing
    quality software take time?

    View full-size slide

  5. APPLICATION COMPLEXITY
    6
    1a

    View full-size slide

  6. INPUT COMBINATIONS
    7
    72 characters
    ◦ a-z - 26 characters
    ◦ A-Z - 26 characters
    ◦ 0-9 - 10 characters
    ◦ ! - 10 characters

    View full-size slide

  7. INPUT COMBINATIONS
    8
    1 character
    72 permutations
    a

    View full-size slide

  8. INPUT COMBINATIONS
    9
    2 characters
    5184 permutations
    ab

    View full-size slide

  9. INPUT COMBINATIONS
    10
    3 characters
    373248 permutations
    abc

    View full-size slide

  10. SIMPLE VALIDATION
    11

    View full-size slide

  11. COMPLEX VALIDATION
    12
    Email validation regular expression:
    Works 99.99% of times

    View full-size slide

  12. SOFTWARE PROJECT COMPLEXITY
    13
    1b

    View full-size slide

  13. BIG PICTURE
    14
    Correctness
    Code style
    Accessibility
    Frameworks & libraries
    Programming languages Build scripts
    Data Storage Version control
    Networking Documentation
    UI/UX
    Android versions
    Devices
    Architecture
    Issue trackers
    Code quality
    Terminal
    IDE & Plugins
    Soft Skills
    Releases
    Security

    View full-size slide

  14. DEALING WITH COMPLEXITY
    16
    2

    View full-size slide

  15. IDE CODE HINTS
    17

    View full-size slide

  16. LINTERS
    19
    App source files Result
    Lint tool

    View full-size slide

  17. ANDROID LINT
    20

    View full-size slide

  18. KTLINT & CHECKSTYLE
    ◦Ktlint + ktlint-gradle (Kotlin)
    ◦Checkstyle (Java)
    21
    Ok
    Missing space

    View full-size slide

  19. DETEKT
    Too many parameters in the constructor
    22

    View full-size slide

  20. SPELLCHECKER
    coRRRect
    23
    Typo

    View full-size slide

  21. ONLINE TOOLS
    ◦Codacy
    ◦CodeFactor
    ◦CodeBeat
    24

    View full-size slide

  22. ANDROID TEST PYRAMID
    26

    View full-size slide

  23. ALTERNATIVE TEST CLASSIFICATION
    27

    View full-size slide

  24. Gradle Plugins
    28
    4

    View full-size slide

  25. GRADLE PLAY PUBLISHER
    ./gradlew publishApk
    29

    View full-size slide

  26. GRADLE DEPENDENCY LOCK PLUGIN
    implementation 'com.nexmo.android:client-sdk:2.7.+'
    30
    Dynamic dependency
    major.minor.patch
    implementation 'com.nexmo.android:client-sdk:2.7.0'
    Fixed dependency

    View full-size slide

  27. ARCHITECTURE
    31
    5

    View full-size slide

  28. FEATURE MODULES
    33

    View full-size slide

  29. KEEP ARCHITECTURE CONSISTENT
    34

    View full-size slide

  30. CHECK LAYERS
    35

    View full-size slide

  31. AUTOMATION
    36
    5

    View full-size slide

  32. CONTINUOUS INTEGRATION (CI)
    37
    Change code
    Run CI checks on
    each code change
    in the PR branch
    Push to repository

    View full-size slide

  33. GITHUB ACTIONS WORKFLOWS
    38

    View full-size slide

  34. GITHUB ACTIONS WORKFLOW CONFIG
    39
    Name
    Triggers
    Setup steps
    Environment
    Artefact
    Actual task

    View full-size slide

  35. BUG FIX FLOW
    42
    Checkout the code Fix the bug
    Create new branch
    Push changes and
    create PR
    Run CI

    View full-size slide

  36. CI STEPS
    43
    Checkout
    source code
    Build Release
    Build Debug
    Release to
    test channel
    Unit test
    Detect
    Ktlint
    Android lint
    Notify testers
    Step 1 Step 2 Step 3 Step 4 Step 5

    View full-size slide

  37. BUG FIX FLOW
    44
    Checkout the code Fix the bug
    Create new branch
    Push changes and
    create PR
    Run CI
    Review
    Merge Production Release

    View full-size slide

  38. TAKEAWAYS
    ◦ Maintain codebase to have consistent code
    ◦ Create simple, human-readable tests
    ◦ Use linters
    ◦ Good architecture will allow you to scale
    ◦ Use CI to automate releases and PR checks
    45

    View full-size slide

  39. RESSOURCES
    ◦ Android-showcase https://github.com/igorwojda/android-showcase
    ◦ ktlint https://github.com/pinterest/ktlint
    ◦ ktlint-gradle https://github.com/JLLeitschuh/ktlint-gradle
    ◦ detekt https://github.com/detekt/detekt
    ◦ Android lint https://developer.android.com/studio/write/lint
    ◦ ArchUnit https://www.archunit.org/
    ◦ Semver https://semver.org/
    ◦ Github Actions https://github.com/features/actions
    ◦ Gradle Play Publisher https://github.com/Triple-T/gradle-play-publisher
    ◦ Gradle Dependency Lock Plugin https://github.com/nebula-plugins/
    gradle-dependency-lock-plugin
    46

    View full-size slide

  40. 47
    ANY QUESTIONS?
    Find me on twitter
    @IgorWojda
    Thanks!

    View full-size slide

  41. 48
    Special thanks to SlidesCarnival who made and released these
    awesome presentation template for free.
    Credits

    View full-size slide