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

マネーフォワードの設計へのアプローチ

79b6308e9ece8ee9780f8d4a9e0a656d?s=47 koutalou
March 16, 2017
2.9k

 マネーフォワードの設計へのアプローチ

CAMPFIRE iOS #1で発表した発表資料です。

Architectureの選定や、マネーフォワードでのClean Architectureの取り組みについてのお話です。

79b6308e9ece8ee9780f8d4a9e0a656d?s=128

koutalou

March 16, 2017
Tweet

Transcript

  1. ϚωʔϑΥϫʔυͷઃܭ΁ͷΞϓϩʔν CAMPFIRE iOS #1 2017/03/16 גࣜձࣾϚωʔϑΥϫʔυ ࣇۄ޹ଠ࿠

  2. ࣗಈՈܭ฽ɾࢿ࢈؅ཧαʔϏεʰϚωʔϑΥϫʔυʱ iOS, AndroidΞϓϦ։ൃΛ୲౰͍ͯ͠·͢ ࣇۄ޹ଠ࿠!LPVUBMPV ΤϯδχΞ ࣗݾ঺հ

  3. ಺༰ 1 "SDIJUFDUVSFʹ͍ͭͯ 2 "SDIJUFDUVSFͷબఆ 3 $MFBO"SDIJUFDUVSF΁ͷऔΓ૊Έ

  4. 1 2 "SDIJUFDUVSFͷબఆ 3 $MFBO"SDIJUFDUVSF΁ͷऔΓ૊Έ 2 3 "SDIJUFDUVSFʹ͍ͭͯ ಺༰

  5. طଘͷ"SDIJUFDUVSF .7$"SDIJUFDUVSF .71 .77. "SDIJUFDUVSF

  6. طଘͷ"SDIJUFDUVSF 7*1&3"SDIJUFDUVSF %%%"SDIJUFDUVSF

  7. $MFBO"SDIJUFDUVSF 7JFX 1SFTFOUFS 6TF$BTF 5SBOTMBUPS .PEFM %BUB4UPSF &OUJUZ 3FQPTJUPSZ 1SFTFOUBUJPO-BZFS

    %PNBJO-BZFS %BUB-BZFS w ੹຿Λࡉ෼Խ͢Δ͜ͱͰɺ֤ϨΠϠ͕ԿΛ୲౰͢Δ͔໌֬ʹͳΔ w 6*ͱϏδωεϩδοΫΛ෼཭Ͱ͖ɺϨΠϠؒͷґଘΛ࠷খݶʹͰ͖Δ w ϨΠϠؒ͸ૄ݁߹ͳͷͰϞδϡʔϧͷஔ͖׵͑ɺςετ͕༰қ
  8. $MFBO"SDIJUFDUVSFͷ1SPT$POT ɹQSPT w ಛఆͷ-BZFSͷංେԽΛ๷͛Δ w ݴޠԽ͞Εͨఆ͕ٛ͋ΔͷͰڞ௨ͷઃܭҙ͕ࣝ࣋ͯΔ w ੹຿͕ࡉ෼Խ͞Ε͍ͯΔͷͰϝϯς͠΍͍͢
 DPOT w

    ίʔυྔɺϑΝΠϧ਺͕ଟ͍ w ֶशίετ͕ߴ͍
  9. औΓ૊Έ "SDIJUFDUVSFʹ͍ͭͯ 2 "SDIJUFDUVSFͷબఆ $MFBO"SDIJUFDUVSF΁ͷऔΓ૊Έ 1 3

  10. Α͋͘ΔΞʔΩςΫνϟͷ໰୊ w ౓ॏͳΔ࢓༷มߋ΍ෳࡶͳ࢓༷ʹରԠ͢ΔͨΊʹ7JFX$POUSPMMFS΍
 ಛఆͷ.PEFM͕ංେԽ͠ɺϏδωεϩδοΫͷຊ࣭Λݟࣦ͏ w ಛఆͷϨΠϠ͕ෳ਺ͷ੹຿Λ࣋ͪґଘ౓ͷߴ͍ෳࡶͳίʔυ͕ੜ·ΕΔ ΤϯδχΞ ΤϯδχΞ ΤϯδχΞ ͍͢͝࢓༷มߋͩɺɺ

    ·ͨViewController͕๲ΒΉ ϏδωεϩδοΫ͜Μͳ ॻ͖ํͪ͠Ό͏Μͩɾɾ Model͕͍ΖΜͳॲཧΛ ؚΊͯෳࡶ͗͢Δɾɾ → VIPER΍Clean ArchitectureΛݕ౼ͯ͠΋ྑ͍
  11. ໰୊Λײ͍ͯ͡ͳ͍έʔε w গਓ਺Ͱن໛ͷখ͞ͳΞϓϦέʔγϣϯ͸ɺશ༰Λ೺Ѳ͠΍͍͢ w εϞʔϧελʔτͳͲͰ·ͣಈ͘΋ͷΛ࡞Γ͍ͨ w ϩδοΫ͕γϯϓϧͰಛʹෳࡶͳॲཧ͕ଘࡏ͠ͳ͍ ΤϯδχΞ ΤϯδχΞ ΤϯδχΞ

    ҰਓͰ։ൃ͢Δ͠ɺ ͦΜͳʹن໛΋େ͖͘ͳ͍ ͱʹ͔͘εϐʔυײॏࢹ ·ͣ͸ϞϊΛ࡞Γ͍ͨ ΞϓϦέʔγϣϯͷ ϩδοΫ͕ෳࡶͰ͸ͳ͍ → VIPER΍Clean Architecture͸޲͍͍ͯͳ͍
  12. "1*ʹΑΔෳࡶੑʹ͍ͭͯ ͭͷը໘Ͱෳ਺ͷ"1*͔ΒσʔλΛऔಘ͢Δ৔߹ɺ 7JFXͰ࢖͏.PEFM΁ม׵͕ඞཁʹͳΓϩδοΫ͸ෳࡶʹͳΓ͕ͪ "1* "1* "1* "1* "1* → Clean

    ArchitectureΛݕ౼ͯ͠΋ྑ͍
  13. ը໘"1*ͷΑ͏ͳ৔߹ɺ3FTQPOTF͕7JFXͷ.PEFMͱͯ͠ ࢖͑Δέʔε͕ଟ͍ͨΊϩδοΫ͸γϯϓϧʹͳΔ "1* "1* "1*ʹΑΔෳࡶੑʹ͍ͭͯ → Clean Architecture͸ෆ޲͖ɺVIPER͸ݕ౼ͯ͠΋ྑ͍

  14. "SDIJUFDUVSFͷબఆ w ௕ظతͳ։ൃɺϝϯςφϯε͕ඞཁ͔ w ୯ಠ։ൃ͔։ൃϝϯόʔ͸ଟ͘ྲྀಈత͔ w αʔόଆͷϦιʔε͕े෼Ͱ$MJFOU͸γϯϓϧʹͰ͖Δ͔ w $MJFOUଆͰෳࡶͳϩδοΫΛ࣋ͨ͟ΔΛಘͳ͍͔ ϓϩδΣΫτͷঢ়گ΍ϝϯόʔɺ

    αʔόଆ΋ؚΊͨશମͷγεςϜΛߟྀͯ͠
 "SDIJUFDUVSFΛબఆ͢΂͖
  15. 3 $MFBO"SDIJUFDUVSF΁ͷऔΓ૊Έ "SDIJUFDUVSFʹ͍ͭͯ 1 2 "SDIJUFDUVSFͷબఆ 2 ಺༰

  16. νʔϜͰ"SDIJU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৴ͳͲͷج൫෦ w 4UZMF6*$PNQPOFOUͷڞ௨ఆٛ w 6UJMJUZศརػೳͷू߹
  21. 'SBNFXPSLԽ ֤ϨΠϠΛ'SBNFXPSLͰ෼ׂ -BZFSؒΛૄ݁߹ɺґଘؔ܎Λ࠷খݶʹ͢ΔͨΊʹಋೖ 7JFX 6TF$BTF 5SBOTMBUPS .PEFM %BUB4UPSF &OUJUZ 3FQPTJUPSZ

    1SFTFOUFS %PNBJO %BUB $PSF 6UJMJUZ 4UZMF 7JFX
  22. 4UZMF(VJEF"QQ 'SBNFXPSLʹ͢Δ͜ͱͰڞ௨ԽͰ͖ .POFZ'PSXBSEΞϓϦʹ΋ͦͷ··࢖͑Δ Money Forward App Style Guide App Style

    Framework
  23. 4UZMF(VJEF"QQ Money Forward App Style Guide App Style Framework 'SBNFXPSLʹ͢Δ͜ͱͰڞ௨ԽͰ͖

    .POFZ'PSXBSEΞϓϦʹ΋ͦͷ··࢖͑Δ
  24. 6*$PNQPOFOUͷڞ௨Խ 4UPSZCPBSEͰઃఆ͢Δ6*$PNQPOFOUʹ௚઀ઃఆ஋ΛೖΕͨ͘ͳ͍ ͚Ͳ4UPSZCPBSE্Ͱ൓ө͞Εͯ΄͍͠ /PSJ ίʔυͰ4UPSZCPBSEͷ 7JFXΛσβΠϯ͢Δ !ZVLJBTBJ IUUQTHJUIVCDPNZVLJBTBJ/PSJ

  25. ςϯϓϨʔτͷࣗಈੜ੒ $MFBO"SDIJUFDUVSF͸ϑΝΠϧ͕ଟ͘ͳΔͷͰɺ ςϯϓϨʔτΛࣗಈੜ੒͢Δͱ͔ͳΓָ IUUQTHJUIVCDPNCBOO[BJ,VSJ ,VSJ 9DPEF1SPKFDUʹ $MFBO"SDIJUFDUVSFͷ ςϯϓϨʔτΛࣗಈੜ੒ͯ͘͠ΕΔ !CBOO[BJ

  26. $MFBO"SDIJUFDUVSF΁ͷஔ͖׵͑ Ұؾʹશͯ࡞Γ௚͠ͷΑ͏ͳϦϑΝΫλ͸ͤͣɺ ը໘୯ҐͰঃʑʹ$MFBO"SDIJUFDUVSF΁ஔ͖׵͑

  27. $MFBO"SDIJUFDUVSF΁ͷஔ͖׵͑ 7JFX 1SFTFOU 6TF$BT 5SBOTMB .PEFM %BUB4U &OUJUZ 3FQPTJU Ұؾʹશͯ࡞Γ௚͠ͷΑ͏ͳϦϑΝΫλ͸ͤͣɺ

    ը໘୯ҐͰঃʑʹ$MFBO"SDIJUFDUVSF΁ஔ͖׵͑
  28. $MFBO"SDIJUFDUVSF΁ͷஔ͖׵͑ 7JFX 1SFTFOU 6TF$BT 5SBOTMB .PEFM %BUB4U &OUJUZ 3FQPTJU Ұؾʹશͯ࡞Γ௚͠ͷΑ͏ͳϦϑΝΫλ͸ͤͣɺ

    ը໘୯ҐͰঃʑʹ$MFBO"SDIJUFDUVSF΁ஔ͖׵͑ 7JFX 1SFTFOU 6TF$BT 5SBOTMB .PEFM %BUB4U &OUJUZ 3FQPTJU
  29. $MFBO"SDIJUFDUVSF΁ͷஔ͖׵͑ 7JFX 1SFTFOU 6TF$BT 5SBOTMB .PEFM %BUB4U &OUJUZ 3FQPTJU Ұؾʹશͯ࡞Γ௚͠ͷΑ͏ͳϦϑΝΫλ͸ͤͣɺ

    ը໘୯ҐͰঃʑʹ$MFBO"SDIJUFDUVSF΁ஔ͖׵͑ 7JFX 1SFTFOU 6TF$BT 5SBOTMB .PEFM %BUB4U &OUJUZ 3FQPTJU 7JFX 1SFTFOU 6TF$BT 5SBOTMB .PEFM %BUB4U &OUJUZ 3FQPTJU
  30. ඇϑϨʔϜϫʔΫґଘ ɹ-BZFSؒΛ௒͑ΔΑ͏ͳϑϨʔϜϫʔΫʹґଘͤ͞ͳ͍ w ௨৴૚΋-BZFSͰ෼͚ͯ63-4FTTJPOΛ࢖༻ w "MBNPpSF΍"1*,JU͸ա౓ͳػೳΛ࣋ͭͷͰ࢖Θͳ͍ w 6*ܥͷϥΠϒϥϦ͸-BZFSΛ௒͑ͳ͍΋ͷʹݶΔ w ྫ֎Ͱ3Y4XJGUΛಋೖ

  31. 3Y4XJGUͷ1SPT$POT ɹQSPT w 6TF$BTF૚Ͱͷ1SPNJTFॲཧͷهड़͕༰қ w 3FQPTJUPSZ૚ҎԼͷ*'ΛετϦʔϜͰهड़ w ը໘ؒ&WFOU௨஌ͷ.VMUJ$BTUΛετϦʔϜͰ࣮૷Մ
 DPOT w

    ࠜװ෦Λ3Y4XJGUͷෆ۩߹΍ϝϯςφϯεঢ়گʹґଘ w 3Y4XJGUࣗମͷֶशίετ
  32. 1SPUPDPM0SJFOUFE1SPHSBNNJOH ɹ1SPUPDPM0SJFOUFE1SPHSBNNJOHΛҙࣝ͢Δ w QSPUPDPMΛ࢖ͬͨ*'ʹΑΔ࠷খݶͷґଘؔ܎ w QSPUPDPMʹ४ڌ࣮ͨ͠૷͸FYUFOTJPOͰهड़ w DMBTT͸ۃྗ࢖ΘͣTUSVDUͰ࣮૷͢Δ

  33. 1SPUPDPM0SJFOUFE1SPHSBNNJOH ɹ1SPUPDPM0SJFOUFE1SPHSBNNJOHΛҙࣝ͢Δ w QSPUPDPMΛ࢖ͬͨ*'ʹΑΔ࠷খݶͷґଘؔ܎ w QSPUPDPMʹ४ڌ࣮ͨ͠૷͸FYUFOTJPOͰهड़ w DMBTT͸ۃྗ࢖ΘͣTUSVDUͰ࣮૷͢Δ

  34. 1SPUPDPM0SJFOUFE1SPHSBNNJOH 1SFTFOUFS 6TF$BTF 5SBOTMBUPS .PEFM %BUB4UPSF &OUJUZ 3FQPTJUPSZ TUSVDU DMBTT

    7JFX ɹ1SPUPDPM0SJFOUFE1SPHSBNNJOHΛҙࣝ͢Δ w QSPUPDPMΛ࢖ͬͨ*'ʹΑΔ࠷খݶͷґଘؔ܎ w QSPUPDPMʹ४ڌ࣮ͨ͠૷͸FYUFOTJPOͰهड़ w DMBTT͸ۃྗ࢖ΘͣTUSVDUͰ࣮૷͢Δ
  35. Ϟδϡʔϧͷڞ༗ Ұ෦ͷϞδϡʔϧΛஔ͖׵͑Δ͚ͩͰ৭Μͳը໘ʹରԠՄೳ HomeTimelinePresenterImpl UserTimelinePresenterImpl 7JFX 1SFTFOUFS 6TF$BTF 5SBOTMBUPS .PEFM %BUB4UPSF

    &OUJUZ 3FQPTJUPSZ 1SFTFOUFSͷΈϞδϡʔϧ͕ҟͳΔྫ
  36. ςετͷ༰қੑ RepositoryMockImpl 7JFX 1SFTFOUFS 6TF$BTF 5SBOTMBUPS .PEFM %BUB4UPSF &OUJUZ 3FQPTJUPSZ

    QSPUPDPMʹ४ڌͨ͠.PDL΍ςετίʔυͰ
 ϨΠϠຖͷॊೈͳςετ͕Մೳ 3FQPTJUPSZΛ.PDLʹͯ͠ &OUJUZˠ.PEFMͷม׵Λςετ 6TF$BTFΛ.PDLʹͯ͠ɺ 7JFXͷ&WFOUʹର͢Δ1SFTFOUFSͷڍಈΛςετ UseCaseMockImpl
  37. ·ͱΊ

  38. ·ͱΊ %FTJHOFS OFFS "SDIJUFDUVSFʹۜͷ஄ؙ͸ͳ͍ Կ͕࠷ద͔ߟ͑ଓ͚Δ͜ͱ͕ॏཁ w "SDIJUFDUVSF͸༷ʑͳঢ়گɺશମͷߏ੒΋౿·ܾ͑ͯΊΔ w ϝϯόʔͱઃܭ΍։ൃํ਑ΛؚΊͨίϯςΩετΛڞ༗͢Δ Architecture

  39. 5IBOLZPV