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

Yahoo! JAPANアプリとLayered Architecture

Yahoo! JAPANアプリとLayered Architecture

2018.03.12(Mon)にBonfire Android #3で発表した資料です。

Fe569e92f0850d4eccd77bd41f7b16da?s=128

Takuya Shigemoto

March 12, 2018
Tweet

Transcript

  1. Yahoo! JAPANΞϓϦͱ Layered Architecture Ϡϑʔגࣜձࣾ ॏݩ ୓໵

  2. About me • ॏݩ ୓໵ʢtwitter: @shgmn9ʣ • Android / iOS

    • Ϡϑʔגࣜձࣾʢ2017.07ʙʣ • Android൛ Yahoo! JAPANΞϓϦ • Χϝϥͱੜ͖෺͕޷͖ • ञ
  3. ΞδΣϯμ • Yahoo! JAPANΞϓϦ๊͕͍͑ͯͨ໰୊ • Layered Architectureಋೖ • Layered Architectureಋೖͷ੒Ռ

    • ઃܭΛҡ࣋͢ΔऔΓ૊Έ • ͜Ε͔Β • ·ͱΊ
  4. Yahoo! JAPANΞϓϦ͕ ๊͍͑ͯͨ໰୊ ࣸਅɿΞϑϩ

  5. ࣸਅɿΞϑϩ ໰୊ • େਓ਺ͷ։ൃͰɺෳ਺Ҋ͕݅ฒߦͯ͠૸Δ • ໌֬ͳઃܭํ਑͕ແ͍ • Ϣχοτςετ͕ॻ͖ͮΒ͍

  6. ઃܭͷબ୒ ࣸਅɿΞϑϩ

  7. Model View Whateverʁ ࣸਅɿΞϑϩ • Model View Whatever • MVP…ModelͱViewͱPresenter

    • MVVM…ModelͱViewͱViewModel • Presentation Domain SeparationʢPDSʣ • Presentation…ೖྗΛड͚औΔɺݟͨ໨Λ࡞Δ • Domain…ͦΕҎ֎
  8. Presentationʹ͍ͭͯ ࣸਅɿΞϑϩ • Presentationͷ࣮ݱ • MVP…ViewͱPresenter • MVVM…ViewͱViewModel

  9. Domainʹ͍ͭͯ ࣸਅɿΞϑϩ • Domain͸ʁ • MVP΍MVVMͷMʢModelʣͷ͜ͱ • Domainͷઃܭʹ͍ͭͯ͸MVWͰ͸৮Ε͍ͯͳ͍

  10. Layered Architectureಋೖ ࣸਅɿΞϑϩ

  11. goo.gl/GTAfLv

  12. Application Presentation Domain Infrastructure ViewͱWhatever Model

  13. Application Presentation Domain Infrastructure Ϣʔβೖྗɺදࣔ Presentation͕ୟ͘૭ޱ υϝΠϯ΁ΞΫηε͠ϢʔεέʔεΛ࣮ݱ ϏδωεϩδοΫ ֎෦΁ͷΞΫηεʢωοτϫʔΫɾDBɾetc…ʣ

  14. ಋೖํ๏ • ϨΠϠʔ෼ׂΛ࣮ࡍʹίʔυʹద༻͢ΔͨΊʹ • ઃܭن໿ҧ൓Λػցతʹ஄͘࢓૊Έ͕ඞཁ • ֤ϨΠϠʔ͸ผϞδϡʔϧʹ෼ׂ ࣸਅɿΞϑϩ

  15. Application Presentation Domain Infrastructure compile project(‘:Application’) compile project(‘:Domain’) compile project(‘:Infrastructure’)

  16. Application Presentation Domain Infrastructure Observable Observable Observable

  17. αʔϏεͷάϩʔε • ػೳ௥Ճ͸ࢭ·Βͳ͍ • ಉҰػೳͷϦϑΝΫλϦϯάͱػೳ௥Ճ͕ಉ࣌ʹ૸Βͳ ͍Α͏ʹεέδϡʔϧΛҾ͍ͨ ࣸਅɿΞϑϩ

  18. ඼࣭ • େن໛ͳϦϑΝΫλϦϯάͷલޙͰͷ඼࣭୲อ • ApplicationϨΠϠʔҎԼ͸ϢχοτςετʢC0ʣΛٛ຿ ෇͚ͨ • Coverage 80%Ҏ্ ࣸਅɿΞϑϩ

  19. ఘΊͨ͜ͱ • DIಋೖ • Dagger2͸ֶशίετΛߟ͑ͯಋೖΛఘΊͨ ࣸਅɿΞϑϩ

  20. Layered Architecture ಋೖͷ੒Ռ ࣸਅɿΞϑϩ

  21. ಘͨ΋ͷ • ίʔυ͕͖Ε͍ʹͳͬͨ • ػೳ௥Ճͷࡍʹ೰Ή͜ͱ͕ݮͬͨ • ϝϯόͷٕज़Ϩϕϧ͕੒௕ͨ͠ • ৽نʹδϣΠϯ͠΍͘͢ͳͬͨ ࣸਅɿΞϑϩ

  22. Layered ArchitectureΛ ҡ࣋͢ΔऔΓ૊Έ ࣸਅɿΞϑϩ

  23. • ίϛολʔ੍౓ • ࢓༷ڞ༗ձ • ઃܭϨϏϡʔձ ࣸਅɿΞϑϩ

  24. ίϛολʔ੍౓ • ֓ཁ • ઃܭɾ࣮૷ํ਑Λཧղͨ͠ϝϯόʔʢίϛολʔʣʹϓϧϦΫΤε τͷϨϏϡʔͷ੹຿Λෛͬͯ΋Β͏ • ϓϧϦΫΤετͷϚʔδʹ͸ɺ࠷௿1ਓͷίϛολʔͷঝೝ͕ඞཁ • ໨త

    • େن໛ϦϑΝΫλϦϯάޙͷίʔυΛܧଓతʹ͖Ε͍ͳঢ়ଶʹอͭ • ݱࡏʢ2018.03ʣ • ։ൃϝϯό21ਓʹର͠ίϛολʔ5ਓ ࣸਅɿΞϑϩ
  25. ࢓༷ڞ༗ձ • ֓ཁ • Ҋ݅࢓༷Λ؆୯ʹυΩϡϝϯτʹ·ͱΊɺΤϯδχΞ ؒͰڞ༗͢Δձ • ໨త • ଐਓԽΛղফ͢Δ

    • ࢓༷ͷٕज़తͳݒ೦఺Λઃܭલʹચ͍ग़͢ • ଞҊ݅ͱͷฒߦ։ൃͷ࣮ݱՄೳੑΛݕ౼͢Δ ࣸਅɿΞϑϩ
  26. ࣸਅɿΞϑϩ ઃܭϨϏϡʔձ • ֓ཁ • ࢓༷ڞ༗ձͰγΣΞͨ͠࢓༷ʹؔ͢ΔઃܭΛυΩϡϝ ϯτʹ·ͱΊɺΤϯδχΞؒ • ໨త •

    ઃܭํ਑Λἧ͑ɺΞϓϦͷઃܭɾ඼࣭Λҡ࣋͢Δ
  27. ͜Ε͔Β ࣸਅɿΞϑϩ

  28. ΍͍͖͍ͬͯͨऔΓ૊Έ • UIͷςετ • DI • AACʢLifecycleɺViewModelɺLiveDataʣ • Ϗϧυͷߴ଎Խ •

    ػೳ͝ͱͷϚϧνϞδϡʔϧԽ ࣸਅɿΞϑϩ
  29. ·ͱΊ

  30. ·ͱΊ • ղܾ͍ͨ͠໰୊Λ͖ͪΜͱݟఆΊͯಋೖ͢ΔઃܭΛܾΊ Δ͜ͱ • ઃܭͷಋೖʹ͋ͨͬͯɺແཧ͸͠ͳ͍͜ͱ • ϏδωεଆͷཧղΛ͖ͪΜͱಘΔ͜ͱ • ઃܭΛҡ࣋͢ΔͨΊͷࢪࡦΛ͖ͪΜͱߦ͏͜ͱ

  31. Yahoo! JAPANͰ͸ ༷ʑͳྖҬͰΤϯδχΞΛืू͍ͯ͠·͢ʂ https://about.yahoo.co.jp/hr/ ࣸਅɿΞϑϩ

  32. Thank you!