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

On the journey from legacy code to clean architecture

On the journey from legacy code to clean architecture

Presented with Joe Birch

Buffer for Android was first made in 2012 - and since then it's seen a range of iterations and features. Whilst it's important for a product to grow in-order to meet the needs of users, it's easy for code to become unclean and lose any sense of architecture. This legacy code makes it difficult for us to maintain our product and build new features without the fear of breaking the app.

But there is light! At Buffer we've just started to re-architect and refactor our application for Android using a clean architecture approach. Re-crafting our application feature by feature with the help of RxJava, Dagger and tests in the form of jUnit and Espresso has began to result in a more stable, better architected and maintainable codebase. Together with our new Continous Integration flow this all helps in providing a better Buffer experience on Android.

In this talk we will explore the journey we took through refactoring from legacy code to a clean architecture. Starting with heart of our app, the Composer, we'll share our learnings and findings discovered on our journey and the benefits from doing so.

Marcus Wermuth

December 15, 2016

More Decks by Marcus Wermuth

Other Decks in Programming


  1. On the journey from legacy code to clean architecture by

    Joe Birch & Marcus Wermuth a.k.a The Android Team at Buffer
  2. About us ‣ Android Developers at Buffer [buffer.com] ‣ Combining

    Architecture, Testing skills with Generalist Product and Design thinking ‣ @hitherejoe, @mwermuth at Twitter/Github
  3. Journey ‣ Introduction to Buffer ‣ History of our Android

    App ‣ Rebuilding our Composer ‣ Clean Architecture ‣ Continuous Integration
  4. ‣ Social media management tool + Customer service software [buffer.com/respond]

    ‣ over 4M Users in total ‣ over 800,000 posts shared a day About Buffer
  5. Buffer for Android ‣ around since 2012 ‣ ~150k Lines

    of Code ‣ 43k updates created daily ‣ minSdkVersion: 15
  6. Challenges ‣ GodActivites everywhere ‣ no consistency in style ‣

    old unsupported libraries ‣ no testing, no CI
  7. Complexities ‣ A lot of different features ‣ Social network

    data types ‣ No structure ‣ No tests
  8. Complexities ‣ A lot of different features ‣ Social network

    accepted data types ‣ No structure ‣ No tests
  9. Complexities ‣ A bunch of different features ‣ Social network

    accepted data types ‣ No structure ‣ No tests
  10. 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
  11. Android Architecture Blueprints GitHub - googlesamples/android-architecture Blueprints Architecting Android…The clean

    way? Fernando Cejas - http://fernandocejas.com/ Android-CleanArchitecture Github - android10/Android-CleanArchitecture
  12. Want did we want? ‣ stable and easy way to

    run a build ‣ decentralised ‣ automated ‣ easy to understand and modify