Save 37% off PRO during our Black Friday Sale! »

Modern, maintainable and coRRRect project

E481624463bdb1c97c46e2155408acb4?s=47 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.

E481624463bdb1c97c46e2155408acb4?s=128

Igor Wojda

November 06, 2020
Tweet

Transcript

  1. Modern, maintainable and coRRRect project 1

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

    @igorwojda
  3. BECOMING A DEVELOPER Day 0: ◦First “Hello, World” program ◦First

    variable ◦First method ◦First class ◦First module ◦... 3
  4. Why does developing quality software take time?

  5. COMPLEXITY 5

  6. APPLICATION COMPLEXITY 6 1a

  7. INPUT COMBINATIONS 7 72 characters ◦ a-z - 26 characters

    ◦ A-Z - 26 characters ◦ 0-9 - 10 characters ◦ !&# - 10 characters
  8. INPUT COMBINATIONS 8 1 character 72 permutations a

  9. INPUT COMBINATIONS 9 2 characters 5184 permutations ab

  10. INPUT COMBINATIONS 10 3 characters 373248 permutations abc

  11. SIMPLE VALIDATION 11

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

    times
  13. SOFTWARE PROJECT COMPLEXITY 13 1b

  14. 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
  15. CHANGE

  16. DEALING WITH COMPLEXITY 16 2

  17. IDE CODE HINTS 17

  18. LINTERS 18 2a

  19. LINTERS 19 App source files Result Lint tool

  20. ANDROID LINT 20

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

    Ok Missing space
  22. DETEKT Too many parameters in the constructor 22

  23. SPELLCHECKER coRRRect 23 Typo

  24. ONLINE TOOLS ◦Codacy ◦CodeFactor ◦CodeBeat 24

  25. TESTS 25 3

  26. ANDROID TEST PYRAMID 26

  27. ALTERNATIVE TEST CLASSIFICATION 27

  28. Gradle Plugins 28 4

  29. GRADLE PLAY PUBLISHER ./gradlew publishApk 29

  30. 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
  31. ARCHITECTURE 31 5

  32. LAYERS 32

  33. FEATURE MODULES 33

  34. KEEP ARCHITECTURE CONSISTENT 34

  35. CHECK LAYERS 35

  36. AUTOMATION 36 5

  37. CONTINUOUS INTEGRATION (CI) 37 Change code Run CI checks on

    each code change in the PR branch Push to repository
  38. GITHUB ACTIONS WORKFLOWS 38

  39. GITHUB ACTIONS WORKFLOW CONFIG 39 Name Triggers Setup steps Environment

    Artefact Actual task
  40. PR CHECKS 40

  41. FLOWS 41 6

  42. BUG FIX FLOW 42 Checkout the code Fix the bug

    Create new branch Push changes and create PR Run CI
  43. 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
  44. BUG FIX FLOW 44 Checkout the code Fix the bug

    Create new branch Push changes and create PR Run CI Review Merge Production Release
  45. 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
  46. 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
  47. 47 ANY QUESTIONS? Find me on twitter @IgorWojda Thanks!

  48. 48 Special thanks to SlidesCarnival who made and released these

    awesome presentation template for free. Credits