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

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

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

Dd17014e380450cfed5d55ff20fa3dfd?s=128

Ryutaro Miyashita

July 14, 2017
Tweet

Transcript

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

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

  3. ߏ੒

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

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

  6. ϥΠϑαΠΫϧʹண໨͢ΔΞʔΩςΫνϟ ‣ 3Y+BWB΍&WFOU#VTΛ࢖͍ͬͯΕ͹ҙࣝ͢Δ͸ͣ  PO4UBSUPO4UPQͰTVCTDSJCFVOTVCTDSJCF  ߪಡ͕ഁغ͞Εͨͱ͖ͷ؂ࢹର৅ͷద੾ͳഁغ ‣ ϥΠϑαΠΫϧʹண໨͢Δͱ͞Βʹҙࣝ͢Δ͜ͱ 

    ໾ׂͷ෼཭ ը໘ͱ৘ใ ৘ใͱϩδοΫ ϩδοΫͱӬଓԽػߏ
  7. "OESPJE"SDIJUFDUVSF$PNQPOFOUT ‣ (PPHMF*0Ͱൃද͞Εͨ ‣ (PPHMFͷߟ͑ΔਪનΞʔΩςΫνϟ ‣ "DUJWJUZ'SBHNFOUͷϥΠϑαΠΫϧʹண໨  ؍ଌՄೳͳϥΠϑαΠΫϧͱඥ෇͘σʔλ -JGFDZDMF-JWF%BUB

     ը໘ճసʹӨڹ͞Εͳ͍σʔλͷอ࣋ 7JFX.PEFM  σʔλͷӬଓԽΛखॿ͚͢Δ 3PPN1FSTJTUFODF-JCSBSZ
  8. ΞʔΩςΫνϟ͸ࣅͯ͘Δ ‣ "DUJWJUZ'SBHNFOU$VTUPN7JFX  7JFX6*ͷ੍ޚʹूத͢Δ ‣ 7JFX.PEFM  7JFXͷͨΊͷ஋Λอ࣋͢Δ 

    7JFXͱϏδωεϩδοΫͷڮ౉͠ ‣ #VTJOFTT-PHJD  ஋ΦϒδΣΫτ  ϏδωεϩδοΫ
  9. 7JFX 7JFX.PEFM #VTJOFTT-PHJD ‣ 3Y+BWB ‣ JOUFSGBDF ‣ &WFOU#VT

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

  11. "OESPJEͷ7JFX͸΍΍͍͜͠ ‣ "DUJWJUZ  'SBHNFOU %JBMPH'SBHNFOU #PUUPN4IFFU  $VTUPN7JFX ‣

    ը໘಺ͷίϯϙʔωϯτಉ࢜΋௨৴͕ඞཁ  7JFX.PEFMΛͲͷΑ͏ʹ࢖͏͔  %BUB#JOEJOHͱͲ͏૊Έ߹ΘͤΔ͔
  12. 7JFX.PEFMΛͲͷΑ͏ʹ࢖͏͔ ‣ Ϣʔβʔ͕ݟ͍ͯΔlը໘zʹؔ৺Λ޲͚Δ ʷ )PHF"DUJWJUZ⾮)PHF"DUJWJUZ7JFX.PEFM ̋ )PHF"DUJWJUZ )PHF'SBHNFOU )PHF$VTUPN7JFX )PHF7JFX.PEFM

     lը໘z΁ͷؔ৺ʹରͯ͠7JFX.PEFM͕͋Δ  ۃྗ"OESPJE౎߹ʹҾͬுΒΕͨ͘ͳ͍
  13. 7JFX.PEFMΛͲͷΑ͏ʹ࢖͏͔ ‣ "OESPJE"SDIJUFDUVSF$PNQPOFOUT  7JFX.PEFM1SPWJEFSTܦ༝Ͱڞ༗Ͱ͖Δ class MyFragment: Fragment() { val

    viewModel: MyViewModel by lazy { ViewModelProviders.of(activity) .get(MyViewModel::class.java) } }
  14. %BUB#JOEJOHͱͲ͏૊Έ߹ΘͤΔ͔ ‣ ֤ϨΠΞ΢τͱ7JFX.PEFMΛόΠϯυ  7JFX.PEFM͸ը໘ͷτοϓίϯϙʔωϯτ͔Βऔಘ <?xml version="1.0" encoding="utf-8"?> <layout> <data>

    <variable name="hogeViewModel" type="com.example.view.hoge.HogeViewModel"/> </data> </layout>
  15. %BUB#JOEJOHͱͲ͏૊Έ߹ΘͤΔ͔ ‣ 0CTFSWBCMF'JFMEͳͲ࢖ͬͯ૒ํ޲όΠϯυ <TextView android:text="@={hogeViewModel.textValue}"> data class HogeViewModel( val textValue:

    ObservableField<String> = ObservableField() )
  16. 7JFXͱ7JFX.PEFM )PHF "DUJWJUZ )PHF 'SBHNFOU )PHF 7JFX l)PHFz %BUB#JOEJOH l)PHF7JFX.PEFMz

    0CTFSWBCMF'JFME SY0CTFSWBCMF $PNNBOE &WFOU
  17. ೰Έ ‣ Ϣʔβʔ͕ݟ͍ͯΔlը໘zʹؔ৺Λ޲͚Δ  Ͳ͜·Ͱ͕ಉ͡ίϯςΩετͷը໘ͳͷ͔  )PHF"DUJWJUZ͕ΞΫςΟϒͰ͋Ε͹ɺ
 ͦ͜ʹදࣔ͞ΕΔ΋ͷ͸ಉ͡ίϯςΩετʁ  ྫ͑͹l%JBMPH'SBHNFOUz͸Ͳ͏ͩΖ͏ʁ

    )PHF7JFX.PEFMΛ࣋ͭ΂͖͔൱͔ ઐ༻ͷ7JFX.PEFM͕͋ͬͨํ͕ྑ͍ͷ͔ දࣔ͞ΕΔ%JBMPHͷத਎Ͱ΋มΘΓͦ͏͚ͩͲ΋ ʅЏʆʀ řŖƃʜ
  18. ύοέʔδߏ੒

  19. ύοέʔδߏ੒ ‣ "OESPJEΞϓϦͷύοέʔδߏ੒͸ࣗ༝౓͕ߴ͍  ϓϩδΣΫτσϑΥϧτͰ͸.BJO"DUJWJUZ͕
 ύοέʔδ௚Լʹυʔϯͱஔ͔Ε͍ͯΔ ‣ ྫ͑͹044ͳ"OESPJEϓϩδΣΫτͰ͸ʁ - root

    - ui - activities - fragments - views - viewmodels - root - ui - Activity.java - Fragment.java - model - utils
  20. Ͳ͜ʹ஫໨͢Δ͔ ‣ ύοέʔδߏ଄ΛͲ͏෼ׂ͢Δ͔  lVJz΍lNPEFMzʹ෼͚Δͷ͸ྑ͋͘Δ  ෼͔Γ΍͍͢ ‣ Ͱ΋ 

    lBDUJWJUZzͳͲͰ෼͚͍ͯ͘ͷ͕ຊ౰ʹྑ͍ͷ͔  lը໘zʹண໨͢Δͱίʔυ͕෼ࢄͯ͘͠Δ  ͞ΒʹlWJFXNPEFMz΋ग़ͯ͘Δͱʜʜʁ ̻̻̻ƅЧƅ űŘŎŎŎ
  21. ఏҊ ‣ Ϣʔβʔ͕ண໨͢Δը໘Λߏ੒͢ΔཁૉͰ·ͱΊΔ - root - ui - hoge -

    HogeActivity.kt - HogeFragment.kt - HogeCustomView.kt - HogeViewModel.kt - fuga - ……
  22. ఏҊ ‣ ϝϦοτ  ύοέʔδϓϥΠϕʔτʹͰ͖Δ  ը໘Λߏ੒͢ΔཁૉͰ·ͱΊΒΕΔͷͰࢄΒ͹Βͳ͍  (JU)VCͷ3FQPTJUPSZ7JFXFSͰݟΔͱ͖΋ָʑ ‣

    σϝϦοτ  ࢥ͍͔ͭͳ͍ʂ
  23. ʹΌΜͳΜͷͨΊʹ

  24. ͳͥlΞʔΩςΫνϟzʹ஫໨͢Δͷ͔ ‣ ਓͳΒ ଟ෼ ͲΜͳܗͰ΋໰୊͸ͳ͍  ਓ ਓʜʜνʔϜʹͳ͖ͬͯͨΒʁ  டং͕ඞཁ

    ΞʔΩςΫνϟ͸டং νʔϜͷͨΊʹΞʔΩςΫνϟ͕͋Δ ‣ டং͕ͳ͍ͱͲ͏ͳΔͷ͔  ։ൃ଎౓͕མͪɺόά΋ੜ·ΕɺΧΦεʹͳΔ  Ϣʔβʔ΁ͷՁ஋ఏڙ͕ૄ͔ʹͳΔ
  25. ελʔτΞοϓͱΞʔΩςΫνϟ ‣ Ϗδωε͸੒ޭ͢Δ͔෼͔Βͳ͍  ϐϘοτ͢Δ͜ͱ΋͋Δ  ૉૣ͘։ൃͯ͠ɺՁ஋ͷݕূΛߦ͍͍ͨ  Ͱ΋ɺϢʔβʔͷ໨͸ͱͯ΋੒ख़͍ͯ͠Δ ͸͡Ί͔Βҙਤ͢ΔػೳΛਖ਼͘͠ಈ࡞ͤ͞Δඞཁ͕͋Δ

    ૉૣ͍։ൃWTਖ਼͘͠ಈ࡞͢ΔϓϩάϥϜ  ΞʔΩςΫνϟʹΑͬͯடংΛखʹೖΕΑ͏  டংʹΑͬͯϢʔβʔ΁ͷՁ஋ఏڙΛखॿ͚͢Δ
  26. டং͋Δ։ൃΛߦ͏஥ؒΛ୳͍ͯ͠·͢ ‣ $IBU8PSLͰ͸"OESPJEJ04ΤϯδχΞΛืूத  ΞʔΩςΫνϟͱڞʹ͋Δ։ൃΛ͠·ͤΜ͔ʁ  ౦ژΦϑΟεେࡕΦϑΟε ౦ژΦϑΟε͸݄ʹ౦ژλϫʔͦ͹ʹҠస͠·͢ ࠓ͸ઙ૲ ͔ͬͺڮಓ۩֗ͷத

    ʹ͋Γ·͢ IUUQDPSQDIBUXPSLDPNKBSFDSVJUFOHJOFFS
  27. ͓͠·͍