This document summarizes a talk about software project mistakes and lessons learned from them. The speaker discusses four main fuckups: 1) A panic during a release to the Google Play store when an app upgrade crashed. The lesson was to always have a backup plan. 2) An internationalization issue where library resources overrode app strings. It's important to avoid name collisions. 3) Not properly determining a user's country from their device locale. Location should be explicitly set. 4) Issues selecting libraries and refactoring projects, like choosing the wrong event bus or taking on too large of a refactoring at once. Thorough planning and testing is key to avoiding refactoring problems.
2. DroidCon Berlin June 5 2015Raymond Chenon
Intro
This talk is about fuckups
We acknowledge our mistakes
Maybe you’ve made the same
mistakes?
2
3. 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
4. DroidCon Berlin June 5 2015Raymond Chenon
The Fuckups I’ll Be Talking About:
1. Our Google Play Release Panic
2. An Internationalization Problem
3. A User Country Problem
4. Refactoring:
- selecting your libraries
- a BIG refactoring
4
5. DroidCon Berlin June 5 2015Raymond Chenon
Fuckup Number One:
Our Google Play Store Release
Panic
5
6. 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
✔
7. 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
8. 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
9. 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:30
bug found.
We must rollback
19:40
the build script
failed everytime
19:45
team lead arrived
timeline
21:00
apk. released
11. DroidCon Berlin June 5 2015Raymond Chenon
Play Store Release: Solution
11
Prepare an .
apk Backup
vc : versionCode
vn : 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
12. 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 team
12
13. DroidCon Berlin June 5 2015Raymond Chenon
Fuckup Number Two:
Our Internationalization Problem
13
14. DroidCon Berlin June 5 2015Raymond Chenon
Internationalization: The Context
We’re in 15 countries—but not Russia
● If your device is in Russian, Zalando’s app
title is “Barcode scanner”
WHAT?
14
15. DroidCon Berlin June 5 2015Raymond Chenon
Internationalization: The Fuckup
Why “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
16. 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
17. 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
18. DroidCon Berlin June 5 2015Raymond Chenon
Fuckup Number Three:
A User Country Problem
18
19. 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
20. 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
21. DroidCon Berlin June 5 2015Raymond Chenon
User Country: Solution 2
Or: let the user select
his/her country
21
23. DroidCon Berlin June 5 2015Raymond Chenon
Refactoring: Some Perspectives
A 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
24. DroidCon Berlin June 5 2015Raymond Chenon
Refactoring: Some Best Practices
DO
1. no behavior change (100% unit tests success)
2. measurable improvement—strengthen the argument for
refactoring
3. the development cycle will be faster
DON’T
1. refactor without a set of tests in place
24
25. 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
26. 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
27. 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 evolve
27
28. 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
29. 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 benchmarking
29
30. DroidCon Berlin June 5 2015Raymond Chenon
Select Your Library: Lessons
What 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
32. DroidCon Berlin June 5 2015Raymond Chenon
Incremental Refactoring Lessons
Do:
● Narrow the scope of your changes
● Apply the changes only if there are
significant improvements
Don’t:
“Let’s apply everywhere” — does more harm
than good
32
1
2
✔
X
33. DroidCon Berlin June 5 2015Raymond Chenon
Big Refactoring
when you can’t apply an incremental
refactoring
33
34. 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
35. 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
36. 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
37. 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
38. DroidCon Berlin June 5 2015Raymond Chenon
Prepare for Refactoring (2)
38
View Injection
Roboguice
@roboguice.inject.InjectView(R.id.add_wishlist_button)
private Button addToWishlistButton;
Butterknife
@butterknife.InjectView(R.id.add_wishlist_button)
Button addToWishlistButton;
39. 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
40. DroidCon Berlin June 5 2015Raymond Chenon
Final Thoughts
Any man can make mistakes, but only an idiot
persists in his error.
—Cicero
40