On the journey from
legacy code to clean
architecture
by Joe Birch & Marcus Wermuth
a.k.a The Android Team at Buffer
Slide 2
Slide 2 text
About us
‣ Android Developers at Buffer [buffer.com]
‣ Combining Architecture, Testing skills with
Generalist Product and Design thinking
‣ @hitherejoe, @mwermuth at Twitter/Github
Slide 3
Slide 3 text
Journey
‣ Introduction to Buffer
‣ History of our Android App
‣ Rebuilding our Composer
‣ Clean Architecture
‣ Continuous Integration
Slide 4
Slide 4 text
‣ Social media management tool + Customer
service software [buffer.com/respond]
‣ over 4M Users in total
‣ over 800,000 posts shared a day
About Buffer
Slide 5
Slide 5 text
‣ 78 employees
‣ 100% working remotely
Slide 6
Slide 6 text
Our values
Slide 7
Slide 7 text
Buffer for Android
‣ around since 2012
‣ ~150k Lines of Code
‣ 43k updates created daily
‣ minSdkVersion: 15
Slide 8
Slide 8 text
Challenges
‣ GodActivites everywhere
‣ no consistency in style
‣ old unsupported libraries
‣ no testing, no CI
Slide 9
Slide 9 text
No content
Slide 10
Slide 10 text
Lookback
Slide 11
Slide 11 text
Lookback
Slide 12
Slide 12 text
Lookback
Slide 13
Slide 13 text
Lookback
Slide 14
Slide 14 text
Lookback
Slide 15
Slide 15 text
Lookback
Slide 16
Slide 16 text
How did we do all
this?
Slide 17
Slide 17 text
Complexities
‣ A lot of different features
‣ Social network data types
‣ No structure
‣ No tests
Slide 18
Slide 18 text
No content
Slide 19
Slide 19 text
Complexities
‣ A lot of different features
‣ Social network accepted data types
‣ No structure
‣ No tests
Slide 20
Slide 20 text
No content
Slide 21
Slide 21 text
Complexities
‣ A bunch of different features
‣ Social network accepted data types
‣ No structure
‣ No tests
Slide 22
Slide 22 text
And so the journey begins…
Slide 23
Slide 23 text
No content
Slide 24
Slide 24 text
No content
Slide 25
Slide 25 text
No content
Slide 26
Slide 26 text
Clean Architecture
Slide 27
Slide 27 text
Reactive Approach
Slide 28
Slide 28 text
No content
Slide 29
Slide 29 text
No content
Slide 30
Slide 30 text
No content
Slide 31
Slide 31 text
Use Case Repository
Remote
Local
Data Store
Factory
Slide 32
Slide 32 text
Now we have tests!
‣ UI tests for activities and fragments
‣ Unit Tests for Use Cases, Repository classes and
pretty much any class that can be tested
‣ From 0 to over 400 unit tests