Slide 1

Slide 1 text

Effective Android

Slide 2

Slide 2 text

Effective (Android) development

Slide 3

Slide 3 text

AppFoundry appfoundry.be

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

–H. Alan Stevens Building the right thing is always more important than building it right.

Slide 6

Slide 6 text

Prototyping

Slide 7

Slide 7 text

Whiteboard

Slide 8

Slide 8 text

Paper prototyping

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Remote configuration

Slide 16

Slide 16 text

Remote configuration - Check flags - maintenance - upgrade - Do specific work (load menu, …) - Check and act on feature switches Production API Test API Load Production config file https://xxxxx/2.1.json Load Test config file https://xxxxx/2.1-test.json

Slide 17

Slide 17 text

–Martin Fowler Feature toggles are a powerful technique, allowing teams to modify system behavior without changing code.

Slide 18

Slide 18 text

Key / value pairs @ Firebase Firebase Remote Config Change behaviour at runtime Developer console dynamic (no app update required) rules & conditions hosted, scalable, cross platform

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

User feedback

Slide 21

Slide 21 text

A/B testing

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Architecture

Slide 25

Slide 25 text

Architecture

Slide 26

Slide 26 text

MODEL PRESENTER VIEW View Presenter View View Presenter Presenter Data Manager Interactors Prefs API API DB Network service Network service Preferences Helper Observables Observables Presentation Layer Domain Layer Data Layer STREAM Architecture

Slide 27

Slide 27 text

Model View Presenter Model Presenter View

Slide 28

Slide 28 text

Model View Presenter Model Presenter View Android UI

Slide 29

Slide 29 text

MODEL PRESENTER VIEW View Presenter View View Presenter Presenter Data Manager Interactors Prefs API API DB Network service Network service Preferences Helper Observables Observables Presentation Layer Domain Layer Data Layer STREAM Architecture

Slide 30

Slide 30 text

Consistent Expressive Concise Verbose

Slide 31

Slide 31 text

X

Slide 32

Slide 32 text

Jetbrains Kotlin Good interoperability with Java Modern Small standard library (±600kb) Statically typed, no runtime overhead Reduce common errors Reduce boilerplate

Slide 33

Slide 33 text

Data class public class User {
 
 private String firstName;
 private String lastName;
 private int age;
 
 public int getAge() {
 return age;
 }
 
 public void setAge(int age) {
 this.age = age;
 }
 
 public String getFirstName() {
 return firstName;
 }
 
 public void setFirstName(String firstName) {
 this.firstName = firstName;
 }
 
 public String getLastName() {
 return lastName;
 }
 
 public void setLastName(String lastName) {
 this.lastName = lastName;
 }
 
 @Override
 public boolean equals(Object o) {
 if (this == o) return true;
 if (o == null || getClass() != o.getClass()) return false;
 
 User user = (User) o;
 
 if (age != user.age) return false;
 if (firstName != null ? !firstName.equals(user.firstName) : user.firstName != null) {
 return false;
 }
 return lastName != null ? lastName.equals(user.lastName) : user.lastName == null;
 }
 
 @Override
 public int hashCode() {
 int result = firstName != null ? firstName.hashCode() : 0;
 result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
 result = 31 * result + age;
 return result;
 }
 
 @Override
 public String toString() {
 return "User{" +
 "age=" + age +
 ", firstName='" + firstName + '\'' +
 ", lastName='" + lastName + '\'' +
 '}';
 }
 } @AutoValue
 public abstract class User {
 
 public abstract String firstName();
 
 public abstract String lastName();
 
 public abstract int age();
 
 @AutoValue.Builder
 public abstract static class Builder {
 
 public abstract Builder firstName(String s);
 
 public abstract Builder lastName(String s);
 
 public abstract Builder age(int i);
 }
 
 public static Builder builder() {
 return new AutoParcel_User.Builder();
 }
 
 public abstract Builder toBuilder();
 }

Slide 34

Slide 34 text

Data class public class User {
 
 private String firstName;
 private String lastName;
 private int age;
 
 public int getAge() {
 return age;
 }
 
 public void setAge(int age) {
 this.age = age;
 }
 
 public String getFirstName() {
 return firstName;
 }
 
 public void setFirstName(String firstName) {
 this.firstName = firstName;
 }
 
 public String getLastName() {
 return lastName;
 }
 
 public void setLastName(String lastName) {
 this.lastName = lastName;
 }
 
 @Override
 public boolean equals(Object o) {
 if (this == o) return true;
 if (o == null || getClass() != o.getClass()) return false;
 
 User user = (User) o;
 
 if (age != user.age) return false;
 if (firstName != null ? !firstName.equals(user.firstName) : user.firstName != null) {
 return false;
 }
 return lastName != null ? lastName.equals(user.lastName) : user.lastName == null;
 }
 
 @Override
 public int hashCode() {
 int result = firstName != null ? firstName.hashCode() : 0;
 result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
 result = 31 * result + age;
 return result;
 }
 
 @Override
 public String toString() {
 return "User{" +
 "age=" + age +
 ", firstName='" + firstName + '\'' +
 ", lastName='" + lastName + '\'' +
 '}';
 }
 } data class User(val firstName: String, val lastName: String, val age: Int) val user = User("Andy", "Rubin", 53) println(user) // User(firstName=Andy, lastName=Rubin, age=53) val usersBirthDay = user.copy(age = 54) // Named parameters
 println(usersBirthDay) // User(firstName=Andy, firstName=Rubin, age=54)

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

Nullability var x: String? = "foo"
 
 x = null
 
 x.length // Does not compile 
 
 val y: String = null // Does not compile

Slide 37

Slide 37 text

Nullability if (x != null) {
 x.length // Compiles
 }
 
 // Safe call
 val length = x?.length // Value null
 
 // Default value
 val length = if (x != null) x.length else -1 // Value -1
 
 // Elvis operator
 val length = x?.length ?: -1 // Value -1

Slide 38

Slide 38 text

Kotlin • Properties • Data class • Function literal (Lambda) • Higher order functions • Extension functions • …

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

Layout 
 
 
 
 
 
 
 
 
 


Slide 41

Slide 41 text

Layout Anko 
 
 
 
 
 
 
 
 
 
 coordinatorLayout {
 fitsSystemWindows = true
 
 appBarLayout { 
 toolBar = toolbar {
 if (SDK_INT >= LOLLIPOP) elevation = 4f
 }.lparams(width = matchParent, height = actionBarSize()) }.lparams(width = matchParent)
 
 changeHandlerFrameLayout()
 .lparams(width = matchParent, height = matchParent) {
 behavior = ScrollingBehavior()
 } 
 }

Slide 42

Slide 42 text

Layout

Slide 43

Slide 43 text

Advanced Layout

Slide 44

Slide 44 text

Advanced Layout

Slide 45

Slide 45 text

Anko performance test Specs ANKO XML Diff ALCATEL
 ONE TOUCH Mediatek MT6572
 Dual-core 1.3GHz Cortex-A7
 512MB RAM 169.33 ms 608.66 ms 359% HUAWEI Y300 Qualcomm MSM8225
 Dual-core 1.0 GHz Cortex-A5 512 MB RAM 593.66 ms 3435.33 ms 578% HUAWEI Y330 Mediatek MT6572 Dual-core 1.3 GHz Cortex-A7 512MB 162.33 ms 984 ms 606% Samsung Galaxy S2 Exynos 4210 Dual Dual-core 1.2 GHz Cortex-A9 1 GB RAM 207.33 ms 753.66 ms 363%

Slide 46

Slide 46 text

Testing

Slide 47

Slide 47 text

Testing strategy

Slide 48

Slide 48 text

Confidence Refactor possible Code handover Fix bugs once

Slide 49

Slide 49 text

Automatic On every commit / scheduled Unit tests UI integration tests with Espresso

Slide 50

Slide 50 text

Test devices

Slide 51

Slide 51 text

Device testing

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

Remote

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

Google Cloud Test Lab

Slide 61

Slide 61 text

Google Cloud Test Lab

Slide 62

Slide 62 text

Google Cloud Test Lab

Slide 63

Slide 63 text

Creating software = complex Continuous integration Ensure quality Automate high-quality, robust and reliable apps tedious / error-prone activities

Slide 64

Slide 64 text

Reduce risk Continuous integration Reduce overhead Quality Assurance

Slide 65

Slide 65 text

Automate all the things

Slide 66

Slide 66 text

Continuous integration 1 2 3 4 CODE & COMMIT BUILD & CHECK CI PICKUP REPORT RESULTS

Slide 67

Slide 67 text

Build pipeline Checkout / compile Unit tests Test coverage Code analysis Create deployable artifact Deploy for automatic QA test Trigger automated QA stage

Slide 68

Slide 68 text

Static analysis

Slide 69

Slide 69 text

Auto publish Delivery Promote APK to production Automate Google Play alpha / beta without additional tools

Slide 70

Slide 70 text

Continuous Delivery

Slide 71

Slide 71 text

Continuous delivery / deliverable Continuous Delivery Deliverable Push on demand Confidence of being deployable

Slide 72

Slide 72 text

Feature-based deployment A successful Git branching model http://nvie.com/posts/a-successful-git-branching-model/

Slide 73

Slide 73 text

Code review Detect problems early. Learn from someone else’s code.

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

Test app distribution

Slide 80

Slide 80 text

Hockey test app distribution

Slide 81

Slide 81 text

Fabric Beta app distribution

Slide 82

Slide 82 text

Fabric Beta app distribution

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

Internal QA Testing Internal alpha testing program Beta testing / staged rollout of being deployable

Slide 85

Slide 85 text

Metrics

Slide 86

Slide 86 text

Crashlytics

Slide 87

Slide 87 text

Dashboard

Slide 88

Slide 88 text

Dashing

Slide 89

Slide 89 text

Questions? Filip Maelbrancke Consultant @ AppFoundry fi[email protected] @fmaelbrancke

Slide 90

Slide 90 text

Thank you!