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

Life Without Fragments (with Eugenio Marletti)

Life Without Fragments (with Eugenio Marletti)

Video: https://www.youtube.com/watch?v=jl1HRiCaAP4

What is wrong with Fragments as they are implemented right now? You hear a lot of rage around bugs, issues, and plain bad/obscure APIs. But what alternatives are out there?
Most of the time, Fragments are used as custom Views. But that’s overkill for Fragments, and it’s not what they’re meant for, either: they can do way more than that (and probably shouldn’t). The talk will run through the architectural choices that we found out helped us create great apps without getting lost in Fragment hell. Because #fragmentsmatter, but not more than… [dramatic music mounts to climax, screen fades to black. "TO BE CONTINUED" appears on screen]

--------

Source keynote and PDF export available here: http://bit.ly/life-without-sources

Sebastiano Poggi

April 21, 2016
Tweet

More Decks by Sebastiano Poggi

Other Decks in Programming

Transcript

  1. Sebastiano Poggi
    @seebrock3r
    Novoda, Android GDE
    &
    Eugenio Marletti
    @workingkills
    Clue
    without
    life
    fragments

    View full-size slide

  2. *
    WARNING
    may contain traces of
    personal opinions and
    surprisingly little hate

    View full-size slide

  3. wrong
    What’s
    with
    Fragments

    View full-size slide

  4. Attila
    some poor guy

    View full-size slide

  5. Attila
    some poor guy

    View full-size slide

  6. FragmentManager
    YOU

    View full-size slide

  7. Fragment
    Manager
    * schizophrenia
    * unpredictable behaviour

    View full-size slide

  8. retained
    fragments

    View full-size slide

  9. transactions
    are async
    executePendingTransactions *

    View full-size slide

  10. state
    of chaos
    tech debt or crash: pick one *
    commitAllowingStateLoss *

    View full-size slide

  11. “Advocating Against Android Fragments”

    View full-size slide

  12. Nobody
    Fragments
    understands
    not a view, not a controller *

    View full-size slide

  13. not a view, not a controller *
    Balto
    Nobody
    Fragments
    understands

    View full-size slide

  14. Nobody
    understands
    Fragments
    Balto
    not a view, not a controller *
    also not a context *
    modular UI *
    lifecycle *

    View full-size slide

  15. CC BY-SA 4.0 by Steve Pomeroy

    View full-size slide

  16. CC BY-SA 4.0 by Steve Pomeroy

    View full-size slide

  17. CC BY-SA 4.0 by Steve Pomeroy

    View full-size slide

  18. they can *
    Google says so *
    all the “free” stuff *
    don’t fully understand *
    (mis)use
    Why do
    people still
    Fragments

    View full-size slide

  19. Fragments
    are not for:
    business logic *
    replacing views *
    persisting data *

    View full-size slide

  20. Fragments
    are evolving
    * ¯\_(ϑ)_/¯
    * attach to any Context

    View full-size slide

  21. Fragments
    are evolving
    * lots of fixes and less WTFs
    * commitNow

    View full-size slide

  22. Fragments
    are evolving
    * lots of fixes and less WTFs
    * commitNow
    Thanks Adam!
    (sorry Adam)

    View full-size slide

  23. Partial alternatives
    pyricau/fragnums *
    weefbellington/screenplay *
    lyft/scoop *
    bluelinelabs/conductor *
    doridori/pilot *
    soundcloud/lightcycle *
    square/flow + /mortar *
    * FRAGNUMS
    * Screenplay
    * Scoop
    * Conductor
    * Pilot
    * LightCycle
    * Flow + Mortar
    to Fragments

    View full-size slide

  24. ?
    custom views *
    clean architecture *
    SOLID *
    core vs mobile *
    write tests *
    unidirectional flow? *
    How are we
    dealing
    without
    Fragments

    View full-size slide

  25. Relax,
    not using Fragments is OK *
    using Fragments is… also OK *
    be a professional *
    use the Support Library *
    pray *
    pray a lot *
    we are
    not your
    supervisor

    View full-size slide

  26. Bunch
    o’
    Advocating Against Android Fragments *
    Android Forestry *
    Offline Application Architecture *
    Android Fragment & Activity Lifecycle *
    Let it flow *
    * goo.gl/VDMhs0
    * goo.gl/GN0rmP
    * goo.gl/P2ROcA
    * goo.gl/K4nThH
    * goo.gl/LNije5
    links

    View full-size slide

  27. A
    &
    Q
    (no pressure)

    View full-size slide

  28. Android Pro >> Novoda
    Google Developer Expert
    @seebrock3r
    Clue << Android Lead
    loves Tequila
    @workingkills
    we’re hiring
    Poggi
    Sebastiano
    MARLETTI
    EUGENIO
    bit.ly/life-without-fragments

    View full-size slide