droidcon berlin 2015

41
DroidCon Berlin June 5 2015 Raymond Chenon App Fails and Retrospectives 1

Upload: raymond-chenon

Post on 27-Jan-2017

390 views

Category:

Mobile


0 download

TRANSCRIPT

Page 1: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

App Fails and Retrospectives

1

Page 2: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

IntroThis talk is about fuckups

We acknowledge our mistakes

Maybe you’ve made the same mistakes?

2

Page 3: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

About Me

Raymond Chenon● Software Engineer● Joined in Nov. 2013

Team● Six devs on an agile team, five nationalities

3

Page 4: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

The Fuckups I’ll Be Talking About:

1. Our Google Play Release Panic2. An Internationalization Problem3. A User Country Problem4. Refactoring:

- selecting your libraries- a BIG refactoring

4

Page 5: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Fuckup Number One:

Our Google Play Store Release Panic

5

Page 6: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Play Store Release: The Context

After a week of testing and bugfixing:- 100% Tests OK. QA team gave the go

New app version becomes available to 50% of our users right before a long weekend

6

Page 7: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Play Store Release: The Fuckup

We updated the database …

One user complained that our app was crashing ...

and then all app upgrades crashed :(

7

Page 8: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Play Store Release: A HARD Lesson

In the Play Store, it is NOT possible to rollback to a previous version of an app

The newer version must have a higher versionCode

8

Page 9: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Play Store Release: How It Happened

9

stress level

17:00 app published

19:00 first complaint.Phone call.

19:30bug found.We must rollback

19:40 the build script failed everytime

19:45team lead arrived

timeline

21:00apk. released

Page 10: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon 10

Page 11: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Play Store Release: Solution

11

Prepare an .apk Backup

vc : versionCodevn : versionName

vn = 2.3, vc = 100

vn = 2.4, vc = 101

vn = 2.3.1 vc = 102

Current version Rollback

previous version

Use the rollback only when something goes wrong with the new version

Page 12: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Play Store Release: Lessons- Always test an app upgrade- Have a backup .apk ready- Make sure your build script is simple- Never publish before weekends or public holidays- Avoid overconfidence in your staged rollout—start at

10%- Celebrate a release one week after

AND … TRUST your team12

Page 13: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Fuckup Number Two:

Our Internationalization Problem

13

Page 14: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Internationalization: The ContextWe’re in 15 countries—but not Russia

● If your device is in Russian, Zalando’s app title is “Barcode scanner”

WHAT?

14

Page 15: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Internationalization: The FuckupWhy “Barcode Scanner?”

● We use libraries with resources: apklib, aar

● The apklib, aar library overrides our strings

15

app_name library’s app_name

en zalando barcode scanner

de zalando barcode scanner

ru barcode scanner

Page 16: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Internationalization: Solutions

● app_name is the default key for the name Rename app_name to company_app_name

● Make sure there is no key name collision

16

Page 17: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Internationalization: Lessons

You don’t have to cover all languages (there are 6,500 languages in the world, BTW)

17

Page 18: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Fuckup Number Three:

A User Country Problem

18

Page 19: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

User Country: The Context

At Zalando, the user’s country of product delivery matters a lot

BUT: device locale is NOT the same as country of delivery● Example: My phone is in English, but I live in Germany

19

Page 20: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

User Country: Solution 1

Web: .fr domain name implies a French user

Mobile: you infer the user’s country by using the TelephonyManager

20

Page 21: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

User Country: Solution 2

Or: let the user select his/her country

21

Page 22: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Fuckup Number Four:

Refactoring

22

Page 23: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Refactoring: Some PerspectivesA change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior.

—Martin Fowler

Architectural refactoring itself is a fuckup :)—S.B.

23

Page 24: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Refactoring: Some Best Practices

DO1. no behavior change (100% unit tests success)2. measurable improvement—strengthen the argument for

refactoring3. the development cycle will be faster

DON’T1. refactor without a set of tests in place

24

Page 25: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Common Excuses for Not Testing

- “We don’t have time”- “I trust my coding abilities. Others make

mistakes.”- “There is a Quality team for that. Not my

role.”

25

Page 26: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Refactoring: Two Fuckup Scenarios

- comparing libraries- image downloading caching

- “Big” refactoring/one big rewrite- dependency injection (Roboguice to Dagger 2)

26

Page 27: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Selecting a Library

Where to start?- so many good open source libraries out

there- sometimes we are not objective—we tend to

follow certain authors, blogs => self-fulfilling prophecy

- libraries evolve27

Page 28: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

The Fuckup: Select the Wrong Library

“I want to replace interfaces used for callback by Otto Event bus”

“I am a fan of Square and Jack Wharton”Otto cannot post on a background thread

28

X

Page 29: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Solution: Select Your Library Carefully

Have your metrics:- number of crash reports (OutOfMemory

exceptions)- time to load

Use these metrics for benchmarking29

Page 30: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Select Your Library: LessonsWhat is best for X may not be for you. Do you own research.

- Always compare the available libraries

- Don’t let fanboy/girlism cloud your judgment

30

X

Libraries memory use

loading time ...

Picasso

Glide

Ion

Universal Image Loader

Volley

Page 31: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Incremental Refactoring

31

Page 32: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Incremental Refactoring Lessons

Do:● Narrow the scope of your changes● Apply the changes only if there are

significant improvementsDon’t:“Let’s apply everywhere” — does more harm than good

32

1

2

X

Page 33: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Big Refactoringwhen you can’t apply an incremental

refactoring

33

Page 34: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

BIG Refactoring: The Fuckup

We accumulated lots of technical debt with Roboguice

This happened before Dagger was released

34

Page 35: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Convince to Refactor: Geek Talk

- RoboGuice is a runtime DI that uses reflection

- Dagger 2 performs its magic during compile time - Performance-wise, Dagger 2 is faster

35

Page 36: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Convince to Refactor: Human Talk

- The app start time will be 80% faster

- Improvements => we can release faster

36

Page 37: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Prepare for Refactoring (1)

Dependency injection itself:

● Rethink the graph model

● Roboguice forces to extend from RoboActivity, RoboFragment

37

Page 38: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Prepare for Refactoring (2)

38

View [email protected](R.id.add_wishlist_button)private Button addToWishlistButton;

[email protected](R.id.add_wishlist_button)Button addToWishlistButton;

Page 39: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Big Refactoring: Lessons

● The better you prepare for changes, the fewer problems afterward

● Make sure everything compiles—don’t go in a dark area

39

Page 40: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Final Thoughts

Any man can make mistakes, but only an idiot persists in his error.

—Cicero

40

Page 41: Droidcon Berlin 2015

DroidCon Berlin June 5 2015Raymond Chenon

Questions ?

41