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

Android, the way to go!

3a7c04e082380dc5d76182aefb1e244a?s=47 Selim
December 09, 2016

Android, the way to go!

Droidcon Krakow 8-10/12/2016
Android platform is under development and progressing... Some parts are mature and some are not... From IDE, core components, till support/3rd party libraries. Even not surprisingly official documentation/other resources is somehow outdated and may not reflect behaviour changes with each major release. This what we can call living the diversity in Android world!

In this talk, I will try to tackle this diversity with some tools and best practices/pro-tips while adopting KISS principle with quality, performance and UX in mind. As of the inspiring nature of this talk: Architecture, Productivity tools, and lessons learnt from day-to-day development will be discussed.

3a7c04e082380dc5d76182aefb1e244a?s=128

Selim

December 09, 2016
Tweet

More Decks by Selim

Other Decks in Programming

Transcript

  1. Android, the way to go! Selim Salman @a_selims #droidconPL Krakow

    2016
  2. Android, the way to go! Selim Salman @a_selims #droidconPL Krakow

    2016
  3. Android, Living the diversity! Selim Salman @a_selims #droidconPL Krakow 2016

  4. @a_selims Selim: - Android, IoT Engineer / Evangelist - MSc

    in IT with Focus on Android & Ubiquitous Computing 2009 - Worked at Multi-National Corporates, Startups, Academia - Cosmopolitan born in Sinai - Philosophy & Psychology interested! - PingPong player and a Digital Nomad! - +ASelimSalman - @a_selims
  5. @a_selims Contents - The Current Context - Challenges - How

    to tackle those - Best practices - Recommendations
  6. @a_selims Context & Challenges

  7. @a_selims Globally ~4 out 5 Smart phones are Android Different

    sources
  8. @a_selims More Than 25,000 Distinct Android Devices opensignal.com

  9. @a_selims Fragmentation

  10. @a_selims Versions developer.android.com/about/dashboards Nov.2016

  11. @a_selims Build.VERSION_CODES /** * February 2009: First Android update, officially

    called 1.1. */ public static final int BASE_1_1 = 2; /** * May 2009: Android 1.5. */ public static final int CUPCAKE = 3; /** * October 2013: Android 4.4, KitKat, another tasty treat. */ public static final int KITKAT = 19; /** * Lollipop. A flat one with beautiful shadows. But still tasty. */ public static final int LOLLIPOP = 21; /** * M is for Marshmallow! */ public static final int M = 23; /** * N is for Nougat! */ public static final int N = 25; The Journey will continue...
  12. @a_selims Version 8 Baklava API 28 public static final int

    BAKLAVA = 28; #AndroidBaklava
  13. @a_selims Android TimeLine * <p>Applications targeting this * or a

    later release will get these * new changes in behavior: </p>
  14. @a_selims Resources

  15. @a_selims What is the Ultimate Answer to Life, Universe and

    Everything? The hitchhikers guide to the galaxy. Image: funnyjunk.com
  16. @a_selims Android Studio CMD + Shift + A

  17. @a_selims Android Studio Live Templates

  18. @a_selims Android Studio MultiCursor: Alt + Shift + Click /

    Ctrl + G Generate: CMD + N Tab (not Enter!): Code Completion ...
  19. @a_selims Android Studio: Build/APK Analyzer

  20. @a_selims Gradle Gradle is emerging from the Build Hell!

  21. @a_selims Gradle

  22. @a_selims Gradle - > gradle.properties org.gradle.jvmargs=-Xmx4608M -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.daemon=true

    org.gradle.configureondemand=true org.gradle.parallel=true - Upgrade Gradle to the latest version - Avoid Dynamic dependencies (x.y.+)
  23. @a_selims Gradle - If still not sufficient, give OkBuck a

    try! https://github.com/uber/okbuck
  24. @a_selims Tools / Plugins

  25. @a_selims Tools / Plugins ADB Idea Ctrl + Shift +

    A
  26. @a_selims Tools / Plugins Material Design Icon Generator String Manipulation

    Quality Plugins (SonarLint, QAPlug...) Parceler Builder ...
  27. @a_selims Architecture - Modularity, - Independence, - Reusability, - Extendibility,

    - Testability - Readability Separation of concerns, decoupling -> beautiful code -> Art & creativity
  28. @a_selims Architecture MVP MVVM Clean Architecture

  29. @a_selims Architecture KISS principle. Cc: mustfeed.com

  30. @a_selims The Engineering Chart UnderEngineering - ProperEngineering - OverEngineering

  31. @a_selims Libraries It is nice to reuse but do you

    really need it!
  32. @a_selims Libraries - Dagger2, ToothPick - Gson, Jackson, Moshi -

    Immutables, AutoValue, Lombok - Retrofit2, OkHttp3.5 - Glide, Picasso - Realm, ORM
  33. @a_selims Libraries - RxJava - Stetho, LeakCanary - ...

  34. @a_selims Testing

  35. @a_selims Testing Src: http://giphy.com/

  36. @a_selims Testing JUnit4, Hamcrest/AssertJ-Android, Mockito Espresso / EspressoRecorder UI Automator

    Testing Unit UI Integration EndToEnd Acceptance ...
  37. @a_selims Testing BDD: Cucumber

  38. @a_selims Testing: Reporting

  39. @a_selims Testing

  40. @a_selims Quality FindBugs PMD CheckStyle AndroidLint Infer SonarQube

  41. @a_selims Quality public class MainActivity extends AppCompatActivity {}

  42. @a_selims So What?!

  43. @a_selims Created with Gimp :) Resource Utilization/Saving Attitude

  44. @a_selims Best Practices - Automate repeatable tasks - Debatable: Use

    native widgets over custom widgets - Use Analytics for usage patterns and crash reports - Never release without proguard - Check latest trends in Security - Personal: Prefer Readability over Complexity - Package by feature
  45. @a_selims Best Practices - Keep work off the main thread

    - In the background, process heavy Computation when needed - Cache them for reuse - Batch Operation when possible for I/O or network calls.
  46. @a_selims Best Practices - Use simple layouts - Try not

    to deeply nest layouts - Use Vector graphics instead of different density PNGs - Use <merge> tag for custom widgets - Include Layouts - Extract styles and reuse them - Use/reuse Resources
  47. @a_selims Best Practices - Avoid enums, use @IntRes/@StringRes instead -

    Use Specialised collections like SparseArray (Where the Key is primitive Type) rather than HashMap - Initialize Arrays with expected capacity List<String> list = new ArrayList<>(10);
  48. @a_selims Best Practices - Use Annotations https://developer.android.com/reference/android/support/annotation/package-summary.html

  49. @a_selims App vs Platform Google Awareness API

  50. @a_selims AI & ML Google Vision API Google Machine Learning

    API TensorFlow ... FaceDetector faceDetector = new FaceDetector.Builder(getApplicationContext()) .setTrackingEnabled(false) .build(); Frame frame = new Frame.Builder().setBitmap(myBitmap).build(); SparseArray<Face> faces = FaceDetector.detect(frame);
  51. @a_selims Recommendation Read SourceCode Follow Android NewsLetter Exchange Experiences

  52. @a_selims Thanks, @a_selims +ASelimSalman speakerdeck.com/aselims github.com/aselims selim.2k@gmail.com *Image from mattermark.com