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

チーム開発と Android アプリの構成

チーム開発と Android アプリの構成

第4回スタートアップAndroid勉強会
https://connpass.com/event/59928/

Ryutaro Miyashita

July 14, 2017
Tweet

More Decks by Ryutaro Miyashita

Other Decks in Programming

Transcript

  1. νʔϜ։ൃͱ"OESPJEΞϓϦͷߏ੒
    ୈճελʔτΞοϓ"OESPJEษڧձ
    ελʔτΞοϓʹ͓͚ΔΞʔΩςΫνϟͱͷ޲͖߹͍ํ

    View full-size slide

  2. ٶԼཽେ࿠
    $IBU8PSLגࣜձࣾ
    ΞϓϦέʔγϣϯ։ൃ෦νʔϜϦʔμʔ
    !SZVHPP@

    View full-size slide

  3. "OESPJEΞϓϦͷߏ੒
    ΞʔΩςΫνϟ
    ύοέʔδߏ੒

    View full-size slide

  4. ΞʔΩςΫνϟ
    .7$
    .71
    .77.
    'MVY
    7*1&3
    $MFBO"SDIJUFDUVSF
    FUD

    View full-size slide

  5. ϥΠϑαΠΫϧʹண໨͢ΔΞʔΩςΫνϟ
    ‣ 3Y+BWB΍&WFOU#VTΛ࢖͍ͬͯΕ͹ҙࣝ͢Δ͸ͣ
    PO4UBSUPO4UPQͰTVCTDSJCFVOTVCTDSJCF
    ߪಡ͕ഁغ͞Εͨͱ͖ͷ؂ࢹର৅ͷద੾ͳഁغ
    ‣ ϥΠϑαΠΫϧʹண໨͢Δͱ͞Βʹҙࣝ͢Δ͜ͱ
    ໾ׂͷ෼཭
    ը໘ͱ৘ใ
    ৘ใͱϩδοΫ
    ϩδοΫͱӬଓԽػߏ

    View full-size slide

  6. "OESPJE"SDIJUFDUVSF$PNQPOFOUT
    ‣ (PPHMF*0Ͱൃද͞Εͨ
    ‣ (PPHMFͷߟ͑ΔਪનΞʔΩςΫνϟ
    ‣ "DUJWJUZ'SBHNFOUͷϥΠϑαΠΫϧʹண໨
    ؍ଌՄೳͳϥΠϑαΠΫϧͱඥ෇͘σʔλ
    -JGFDZDMF-JWF%BUB
    ը໘ճసʹӨڹ͞Εͳ͍σʔλͷอ࣋
    7JFX.PEFM
    σʔλͷӬଓԽΛखॿ͚͢Δ
    3PPN1FSTJTUFODF-JCSBSZ

    View full-size slide

  7. ΞʔΩςΫνϟ͸ࣅͯ͘Δ
    ‣ "DUJWJUZ'SBHNFOU$VTUPN7JFX
    7JFX6*ͷ੍ޚʹूத͢Δ
    ‣ 7JFX.PEFM
    7JFXͷͨΊͷ஋Λอ࣋͢Δ
    7JFXͱϏδωεϩδοΫͷڮ౉͠
    ‣ #VTJOFTT-PHJD
    ஋ΦϒδΣΫτ
    ϏδωεϩδοΫ

    View full-size slide

  8. 7JFX
    7JFX.PEFM
    #VTJOFTT-PHJD
    ‣ 3Y+BWB
    ‣ JOUFSGBDF
    ‣ &WFOU#VT

    View full-size slide

  9. 7JFX
    7JFX.PEFM
    #VTJOFTT-PHJD
    ‣ 3Y+BWB
    ‣ JOUFSGBDF
    ‣ &WFOU#VT

    View full-size slide

  10. "OESPJEͷ7JFX͸΍΍͍͜͠
    ‣ "DUJWJUZ
    'SBHNFOU
    %JBMPH'SBHNFOU
    #PUUPN4IFFU
    $VTUPN7JFX
    ‣ ը໘಺ͷίϯϙʔωϯτಉ࢜΋௨৴͕ඞཁ
    7JFX.PEFMΛͲͷΑ͏ʹ࢖͏͔
    %BUB#JOEJOHͱͲ͏૊Έ߹ΘͤΔ͔

    View full-size slide

  11. 7JFX.PEFMΛͲͷΑ͏ʹ࢖͏͔
    ‣ Ϣʔβʔ͕ݟ͍ͯΔlը໘zʹؔ৺Λ޲͚Δ
    ʷ )PHF"DUJWJUZ⾮)PHF"DUJWJUZ7JFX.PEFM
    ̋ )PHF"DUJWJUZ
    )PHF'SBHNFOU
    )PHF$VTUPN7JFX
    )PHF7JFX.PEFM
    lը໘z΁ͷؔ৺ʹରͯ͠7JFX.PEFM͕͋Δ
    ۃྗ"OESPJE౎߹ʹҾͬுΒΕͨ͘ͳ͍

    View full-size slide

  12. 7JFX.PEFMΛͲͷΑ͏ʹ࢖͏͔
    ‣ "OESPJE"SDIJUFDUVSF$PNQPOFOUT
    7JFX.PEFM1SPWJEFSTܦ༝Ͱڞ༗Ͱ͖Δ
    class MyFragment: Fragment() {
    val viewModel: MyViewModel by lazy {
    ViewModelProviders.of(activity)
    .get(MyViewModel::class.java)
    }
    }

    View full-size slide

  13. %BUB#JOEJOHͱͲ͏૊Έ߹ΘͤΔ͔
    ‣ ֤ϨΠΞ΢τͱ7JFX.PEFMΛόΠϯυ
    7JFX.PEFM͸ը໘ͷτοϓίϯϙʔωϯτ͔Βऔಘ



    name="hogeViewModel"
    type="com.example.view.hoge.HogeViewModel"/>


    View full-size slide

  14. %BUB#JOEJOHͱͲ͏૊Έ߹ΘͤΔ͔
    ‣ 0CTFSWBCMF'JFMEͳͲ࢖ͬͯ૒ํ޲όΠϯυ
    android:text="@={hogeViewModel.textValue}">
    data class HogeViewModel(
    val textValue: ObservableField =
    ObservableField()
    )

    View full-size slide

  15. 7JFXͱ7JFX.PEFM
    )PHF
    "DUJWJUZ
    )PHF
    'SBHNFOU
    )PHF
    7JFX
    l)PHFz
    %BUB#JOEJOH
    l)PHF7JFX.PEFMz
    0CTFSWBCMF'JFME
    SY0CTFSWBCMF
    $PNNBOE
    &WFOU

    View full-size slide

  16. ೰Έ
    ‣ Ϣʔβʔ͕ݟ͍ͯΔlը໘zʹؔ৺Λ޲͚Δ
    Ͳ͜·Ͱ͕ಉ͡ίϯςΩετͷը໘ͳͷ͔
    )PHF"DUJWJUZ͕ΞΫςΟϒͰ͋Ε͹ɺ

    ͦ͜ʹදࣔ͞ΕΔ΋ͷ͸ಉ͡ίϯςΩετʁ
    ྫ͑͹l%JBMPH'SBHNFOUz͸Ͳ͏ͩΖ͏ʁ
    )PHF7JFX.PEFMΛ࣋ͭ΂͖͔൱͔
    ઐ༻ͷ7JFX.PEFM͕͋ͬͨํ͕ྑ͍ͷ͔
    දࣔ͞ΕΔ%JBMPHͷத਎Ͱ΋มΘΓͦ͏͚ͩͲ΋
    ʅЏʆʀ
    řŖƃʜ

    View full-size slide

  17. ύοέʔδߏ੒

    View full-size slide

  18. ύοέʔδߏ੒
    ‣ "OESPJEΞϓϦͷύοέʔδߏ੒͸ࣗ༝౓͕ߴ͍
    ϓϩδΣΫτσϑΥϧτͰ͸.BJO"DUJWJUZ͕

    ύοέʔδ௚Լʹυʔϯͱஔ͔Ε͍ͯΔ
    ‣ ྫ͑͹044ͳ"OESPJEϓϩδΣΫτͰ͸ʁ
    - root
    - ui
    - activities
    - fragments
    - views
    - viewmodels
    - root
    - ui
    - Activity.java
    - Fragment.java
    - model
    - utils

    View full-size slide

  19. Ͳ͜ʹ஫໨͢Δ͔
    ‣ ύοέʔδߏ଄ΛͲ͏෼ׂ͢Δ͔
    lVJz΍lNPEFMzʹ෼͚Δͷ͸ྑ͋͘Δ
    ෼͔Γ΍͍͢
    ‣ Ͱ΋
    lBDUJWJUZzͳͲͰ෼͚͍ͯ͘ͷ͕ຊ౰ʹྑ͍ͷ͔
    lը໘zʹண໨͢Δͱίʔυ͕෼ࢄͯ͘͠Δ
    ͞ΒʹlWJFXNPEFMz΋ग़ͯ͘Δͱʜʜʁ
    ̻̻̻ƅЧƅ
    űŘŎŎŎ

    View full-size slide

  20. ఏҊ
    ‣ Ϣʔβʔ͕ண໨͢Δը໘Λߏ੒͢ΔཁૉͰ·ͱΊΔ
    - root
    - ui
    - hoge
    - HogeActivity.kt
    - HogeFragment.kt
    - HogeCustomView.kt
    - HogeViewModel.kt
    - fuga
    - ……

    View full-size slide

  21. ఏҊ
    ‣ ϝϦοτ
    ύοέʔδϓϥΠϕʔτʹͰ͖Δ
    ը໘Λߏ੒͢ΔཁૉͰ·ͱΊΒΕΔͷͰࢄΒ͹Βͳ͍
    (JU)VCͷ3FQPTJUPSZ7JFXFSͰݟΔͱ͖΋ָʑ
    ‣ σϝϦοτ
    ࢥ͍͔ͭͳ͍ʂ

    View full-size slide

  22. ʹΌΜͳΜͷͨΊʹ

    View full-size slide

  23. ͳͥlΞʔΩςΫνϟzʹ஫໨͢Δͷ͔
    ‣ ਓͳΒ ଟ෼
    ͲΜͳܗͰ΋໰୊͸ͳ͍
    ਓ ਓʜʜνʔϜʹͳ͖ͬͯͨΒʁ
    டং͕ඞཁ
    ΞʔΩςΫνϟ͸டং
    νʔϜͷͨΊʹΞʔΩςΫνϟ͕͋Δ
    ‣ டং͕ͳ͍ͱͲ͏ͳΔͷ͔
    ։ൃ଎౓͕མͪɺόά΋ੜ·ΕɺΧΦεʹͳΔ
    Ϣʔβʔ΁ͷՁ஋ఏڙ͕ૄ͔ʹͳΔ

    View full-size slide

  24. ελʔτΞοϓͱΞʔΩςΫνϟ
    ‣ Ϗδωε͸੒ޭ͢Δ͔෼͔Βͳ͍
    ϐϘοτ͢Δ͜ͱ΋͋Δ
    ૉૣ͘։ൃͯ͠ɺՁ஋ͷݕূΛߦ͍͍ͨ
    Ͱ΋ɺϢʔβʔͷ໨͸ͱͯ΋੒ख़͍ͯ͠Δ
    ͸͡Ί͔Βҙਤ͢ΔػೳΛਖ਼͘͠ಈ࡞ͤ͞Δඞཁ͕͋Δ
    ૉૣ͍։ൃWTਖ਼͘͠ಈ࡞͢ΔϓϩάϥϜ
    ΞʔΩςΫνϟʹΑͬͯடংΛखʹೖΕΑ͏
    டংʹΑͬͯϢʔβʔ΁ͷՁ஋ఏڙΛखॿ͚͢Δ

    View full-size slide

  25. டং͋Δ։ൃΛߦ͏஥ؒΛ୳͍ͯ͠·͢
    ‣ $IBU8PSLͰ͸"OESPJEJ04ΤϯδχΞΛืूத
    ΞʔΩςΫνϟͱڞʹ͋Δ։ൃΛ͠·ͤΜ͔ʁ
    ౦ژΦϑΟεେࡕΦϑΟε
    ౦ژΦϑΟε͸݄ʹ౦ژλϫʔͦ͹ʹҠస͠·͢
    ࠓ͸ઙ૲ ͔ͬͺڮಓ۩֗ͷத
    ʹ͋Γ·͢
    IUUQDPSQDIBUXPSLDPNKBSFDSVJUFOHJOFFS

    View full-size slide