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

Android Engineering for Scale

Android Engineering for Scale

Droidcon London 2014 & Droidcon NYC 2015

Jamie McDonald

October 31, 2014
Tweet

More Decks by Jamie McDonald

Other Decks in Programming

Transcript

  1. View Slide

  2. Android Engineering
    for Scale
    Jamie McDonald

    View Slide

  3. What is scale?
    In the context of mobile development
    title, date, 01 of 10

    View Slide

  4. Subtitle
    4M Android downloads / month
    175M monthly listeners
    title, date, 01 of 10

    View Slide

  5. title, date, 01 of 10

    View Slide

  6. title, date, 01 of 10
    Codebase

    View Slide

  7. Ball of Mud
    title, date, 01 of 10

    View Slide

  8. Layered Architecture
    title, date, 01 of 10

    View Slide

  9. Featurised Architecture
    title, date, 01 of 10

    View Slide

  10. Layers

    View Slide

  11. Feature Packages

    View Slide

  12. Feature Packages
    STREAM
    StreamAdapter
    StreamFragment
    StreamModule
    StreamOperations
    StreamStorage
    StreamItemPresenter

    View Slide

  13. Lava Layers
    title, date, 01 of 10
    “Successive, well intentioned,
    changes to architecture throughout
    the lifetime of an project can lead
    to a fragmented and hard-to-
    maintain code base”
    The Lava Layer Anti-pattern

    View Slide

  14. SPOCCER
    Screen Presenter Operations Controller Command
    EntityState Repository

    View Slide

  15. Subtitle
    Reactive
    Programming
    title, date, 01 of 10
    Rx

    View Slide

  16. Branches
    title, date, 01 of 10
    <>
    branch
    <>
    master
    <>
    origin/master

    View Slide

  17. master
    Branch by Abstraction
    title, date, 01 of 10
    abstraction
    layer
    <> <>
    Martin Fowler: Branch by Abstraction

    View Slide

  18. master
    Branch by Abstraction
    title, date, 01 of 10
    abstraction
    layer
    <>
    Martin Fowler: Branch by Abstraction

    View Slide

  19. master
    Branch by Abstraction
    title, date, 01 of 10
    <>
    Martin Fowler: Branch by Abstraction

    View Slide

  20. master
    Trunk-based Development
    title, date, 01 of 10
    feature-B .isEnabled()
    .isEnabled()
    feature-A
    .isEnabled()
    feature-C
    Trunk-based Development

    View Slide

  21. if (flags.isEnabled(Feature.BRAND_NEW_FEATURE)) {
    return newThing;
    } else {
    return oldThing;
    }
    title, date, 01 of 10
    Feature Flags

    View Slide

  22. Modules
    title, date, 01 of 10
    MAIN REPO
    SINGLE REPO
    ANDROID-KIT
    PROPELLER
    LIGHTCYCLE
    SKIPPY PLAYER

    View Slide

  23. Users
    title, date, 01 of 10

    View Slide

  24. Subtitle
    End-to-End
    Development
    title, date, 01 of 10

    View Slide

  25. Android iOS
    SoundCloud API

    View Slide

  26. API Mobile
    Mobile API
    Android iOS

    View Slide

  27. Subtitle
    title, date, 01 of 10
    {
    "id":612849,
    "kind":"user",
    "permalink":"bazan",
    "username":"David Bazan",
    "uri":"https://api.soundcloud.com/users/612849",
    "permalink_url":"http://soundcloud.com/bazan",
    "avatar_url":"https://i1.sndcdn.com/avatars-000030728315-
    oe5uld-large.jpg?e76cf77",
    "country":"United States",
    "first_name":"David",
    "last_name":"Bazan",
    "full_name":"David Bazan",
    "description":"Known for his work fronting the enigmatic
    rock band Pedro the Lion, David Bazan\u2019s emotionally
    charged narratives, eye for telling detail, and mournful
    voice have more in common with J.D. Salinger\u2019s
    \u201cNine Stories\u201d or Flannery O\u2019Connor\u2019s
    \u201cWise Blood\u201d than with the usual lyrical slant of
    popular music. Bazan is a gifted storyteller, weaving
    parables of spiritual conflict, suburban ennui, and personal
    surrender into magnetic, well-crafted songs.\r\n\r\nHis debut
    solo full-length album, Curse Your Branches (out now on
    Barsuk), is a masterwork by a modern American poet at the
    height of his powers. Paste Magazine called him one of the
    \u201c100 Best Living Songwriters\u201d. This record is the
    deepest and most explicit exploration of his struggles with
    faith and a meditation on all things passed between the
    generations.",
    "city":"Seattle",
    [...]
    }
    {
    "collection":[
    "hip hop",
    "chill",
    "electronic",
    "deep house",
    "party",
    "love",
    "rap",
    "happy",
    "study",
    "techno",
    "indie rock",
    "dubstep",
    "r&b",
    "relax",
    "country",
    "pop",
    "edm",
    "reggae",
    "house",
    "workout",
    "soundtrack",
    "reggaeton",
    "piano",
    "dance",
    "remix",
    "alternative",
    "summer",
    "instrumental",
    "rock",
    "morning",
    "funk",
    "classical",
    [...]
    }
    SoundCloud API Mobile API

    View Slide

  28. Staying Connected

    View Slide

  29. Team
    title, date, 01 of 10

    View Slide

  30. Mobile Team
    Other Engineering
    Android iOS
    Platform
    Teams

    View Slide

  31. Feature Teams
    Core Engineering
    Android iOS

    View Slide

  32. Core Engineering
    Android iOS
    Feature Teams

    View Slide

  33. title, date, 01 of 10

    View Slide

  34. title, date, 01 of 10

    View Slide

  35. Enabling Involvement

    View Slide

  36. Subtitle
    Collective Values
    title, date, 01 of 10

    View Slide

  37. title, date, 01 of 10
    Pairing & Pull Requests

    View Slide

  38. title, date, 01 of 10
    ACCEPTANCE TEST
    UNIT TEST
    CODE

    View Slide

  39. Subtitle
    title, date, 01 of 10
    @Inject @LightCycle ActionBarUtil actionBarUtil;
    @Inject @LightCycle PlayerController playerController;
    public MainActivity() {
    [...]
    }
    Unit Testing

    View Slide

  40. title, date, 01 of 10
    Acceptance Testing

    View Slide

  41. Release Train
    title, date, 01 of 10
    BETA
    257 258 259
    258-beta 259-beta
    RELEASE

    View Slide

  42. title, date, 01 of 10
    UNIT
    TESTS
    BUILD PROMOTE
    ACCEPTANCE
    TESTS
    Continuous Integration

    View Slide

  43. title, date, 01 of 10
    Featurised, layered architecture
    Shared practices: reactive programming
    Feature teams & end-to-end development
    Shared values: testing
    Trunk-based development
    Summary

    View Slide

  44. soundcloud.com/jobs
    Thank you, NYC!

    View Slide