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

Android, the way to go!

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.

Selim

December 09, 2016
Tweet

More Decks by Selim

Other Decks in Programming

Transcript

  1. @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
  2. @a_selims Contents - The Current Context - Challenges - How

    to tackle those - Best practices - Recommendations
  3. @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...
  4. @a_selims Android TimeLine * <p>Applications targeting this * or a

    later release will get these * new changes in behavior: </p>
  5. @a_selims What is the Ultimate Answer to Life, Universe and

    Everything? The hitchhikers guide to the galaxy. Image: funnyjunk.com
  6. @a_selims Android Studio MultiCursor: Alt + Shift + Click /

    Ctrl + G Generate: CMD + N Tab (not Enter!): Code Completion ...
  7. @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.+)
  8. @a_selims Gradle - If still not sufficient, give OkBuck a

    try! https://github.com/uber/okbuck
  9. @a_selims Tools / Plugins Material Design Icon Generator String Manipulation

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

    - Testability - Readability Separation of concerns, decoupling -> beautiful code -> Art & creativity
  11. @a_selims Libraries - Dagger2, ToothPick - Gson, Jackson, Moshi -

    Immutables, AutoValue, Lombok - Retrofit2, OkHttp3.5 - Glide, Picasso - Realm, ORM
  12. @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
  13. @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.
  14. @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
  15. @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);
  16. @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);