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

ベンチャーでドメイン駆動設計をやるとどうなるか? #genbadeDDD

ベンチャーでドメイン駆動設計をやるとどうなるか? #genbadeDDD

Tsuyoshi Yasunishi

May 11, 2019
Tweet

More Decks by Tsuyoshi Yasunishi

Other Decks in Programming

Transcript

  1. ϕϯνϟʔͰ
    υϝΠϯۦಈઃܭΛ΍Δͱ
    Ͳ͏ͳΔ͔ʁ
    ʙ1ZUIPOͰܕʹ׬શʹ౗ͯ͠Έͨʙ
    2019.05.11
    גࣜձࣾνʔϜϘοΫε ҆੢ ߶

    View full-size slide

  2. νʔϜϘοΫεͬͯʁ

    View full-size slide

  3. ৽αʔϏεͱػցֶशʹΑΔ෼ੳγεςϜ΋։ൃத

    View full-size slide

  4. ձࣾͷ࣌୅എܠ

    View full-size slide

  5. ˠ࣌୅
    ʢ೥૑ۀʣ

    View full-size slide

  6. ҰਓͰ࡞ͬͨ

    View full-size slide

  7. ͘͞Β714্ʹ1ZUIPO

    View full-size slide

  8. ࣄۀ͕͏·͘ߦ͖ͩͨ͠

    View full-size slide

  9. ˠ࣌୅
    ʢ೥ʣ

    View full-size slide

  10. 1ZUIPO͔
    ͣͬͱଓ͘
    αʔϏεʹ͍ͨ͠ͳ͊

    View full-size slide

  11. Ϣʔβ؅ཧ͕྆ํʹ͋Δ͜ͱʹؾͮ͘

    View full-size slide

  12. Ϣʔβ؅ཧΛ෼཭͠Α͏

    View full-size slide

  13. 4QSJOH#PPU,PUMJOͰ࡞ͬ
    ͨ

    View full-size slide

  14. ͜ΕʹՃ͑ͯ৽αʔϏεΛ࡞Ζ͏ʂ

    View full-size slide

  15. 1ZUIPO΍ͬͨ͜ͱແ͍͠
    ڷʹೖΕ͹ڷʹै͑
    ·ͣ΍ͬͯΈΑ͏

    View full-size slide

  16. ͕͢͞ʹ.7$͚ͩ͸͖͍ͭ
    ·ͣ͸ϨΠϠʔυΞʔΩςΫνϟ
    ʢͱ͍͏໊ͷ෼͚͚ͨͩʣ

    View full-size slide

  17. 6*ʢ1SFTFOUBUJPOʣ
    "QQMJDBUJPO
    %PNBJO
    *OGSBTUSVDUVSF
    ˔ ϞσϦϯά͸͋·Γ͍ͯ͠ͳ͍
    ˔ υϝΠϯ૚͸ಠཱ͍ͯ͠ͳ͍ʢଞͷ૚ʹґ
    ଘ͍ͯ͠Δʣ

    View full-size slide

  18. ϨΠϠʔΛ෼͚Έͯ
    (PPEʂ
    %#΍"1*ΞΫηεͷॲཧΛͲ͜ʹॻ͚͹͍͍͔͕Θ͔Δ
    B ଞͷਓ͕ॻ͍ͨίʔυͰ΋Ͳ͜ʹॻ͍ͯ͋Δ͔͸Θ͔Δ
    03ϚούʔͷϞσϧ͔ΒϏδωεϩδοΫ͸ഉআͰ͖ͨ
    #BEʂ
    ϏδωεϩδοΫͷډॴ͕ᐆດɻॻ͖ํ΋ਓ΍ػೳʹΑͬͯมΘΔɻ
    B υϝΠϯϞσϧශ݂঱ঢ়ଶ
    ͦ͏ͳΔͱ݁Ռతʹ$POUSPMMFS͕ଠΓɺ4FSWJDFͱ͍͏ಾͷDMBTT͕Ͱ͖࢝Ί
    Δ

    View full-size slide

  19. த్൒୺͸͋·ΓޮՌ͕ͳ͍
    ʢ࣮ײʣ

    View full-size slide

  20. υϝΠϯϞσϦϯάΛ͍ͨ͠
    ΍ΔͳΒܕ͕΄͍͠ͳ͊ʜ

    View full-size slide

  21. ("&ͷ1ZUIPOΛ
    ʹ্͛ͨΑʂ
    $50߱ྟ

    View full-size slide

  22. ͜Ε͸5ZQF)JOU͕
    ࢖͑Δ͡Όͳ͍͔ʜ

    View full-size slide

  23. 1ZUIPOͰܕʹ
    ౗࣮͢ݧͯ͠ΈΑ͏Αʂ
    ͓લͦΕͩͬͨΒ
    +BWBͰ͑͑΍Μʂ
    https://www.irasutoya.com/2017/08/blog-post_54.html

    View full-size slide

  24. ؟ͷલʹ͋Δͷ͸1ZUIPOͰ͋Δ
    1ZUIPOͰܕʹ౗ͯ͠ΈΑ͏ʂ
    ʢ࣮͸ڵຯຊҐʣ

    View full-size slide

  25. 引数の型指定
    戻り値の型指定
    コメントで型指定

    View full-size slide

  26. جຊతʹ5ZQF)JOU͸
    ͜Ε͚ͩͰ0,
    ʢ(FOFSJDTͱ͔͸ඞཁແ͠ʣ

    View full-size slide

  27. 1ZDIBSNʢ*OUFMMJK*%&"ʣ
    ͜ͷิ׬͕ͳ͍ͱແཧ

    View full-size slide

  28. NZQZ
    ܕΛνΣοΫͯ͘͠Ε·͢
    1ZDIBSNʹ΋ઃఆ͢ΔͱΑΓྑ͍

    View full-size slide

  29. little_hand_s さんのqiitaより引用
    https://qiita.com/little_hand_s/items/ebb4284afeea0e8cc752
    υϝΠϯ૚Λ
    ಠཱͤ͞Δ
    ʲج४ʳ
    υϝΠϯ૚ʹ
    ଞͷ૚ͷJNQPSUจ͕ແ͍

    View full-size slide

  30. little_hand_s さんのqiitaより引用
    https://qiita.com/little_hand_s/items/ebb4284afeea0e8cc752
    "QQMJDBUJPO4FSWJDF͔
    Β
    *OGSBTUSVDUVSF
    ʢ%#ΞΫηεʣ
    Λݺͼ͍ͨ
    Ͱ΋໼ҹ͕ٯʹͳΔ

    View full-size slide

  31. *OUFSGBDF͕ແ͍ͷͰɺܧঝͰදݱ

    View full-size slide

  32. ɾܕΛCJOE͢Δ
    ɾ%*Ͱ"QQMJDBUJPO4FSWJDFΛJOKFDU͢Δ
    ɾ"QQMJDBUJPO4FSWJDFͰ͸*OUFSGBDFͷܕͰݺͼग़͢

    View full-size slide

  33. little_hand_s さんのqiitaより引用
    https://qiita.com/little_hand_s/items/ebb4284afeea0e8cc752
    ͍͑ʔ͍
    ґଘؔ܎͕
    ٯ޲͍ͨʂ

    View full-size slide

  34. ઃܭͯ͠ΈΑ͏

    View full-size slide

  35. खॱ
    ᶃॳظͷυϝΠϯϞσϧΛ࡞Δ
    ໊લͱৼΔ෣͍Λநग़
    ίʔυʹམͱͯ͠ΈΔ
    ϦϑΝΫλϦϯά͍ͯ͘͠
    ᶄυϝΠϯ૚Ҏ֎Λ࡞͍ͬͯ͘

    View full-size slide

  36. ᶃॳظͷυϝΠϯϞσϧΛ࡞Δ

    View full-size slide

  37. Ϣʔεέʔε΍࢓༷Λ༻ҙͯ͠

    View full-size slide

  38. ෇ᝦͰग़͢
    ˞ΠϝʔδͰ͢

    View full-size slide

  39. ॳظͷυϝΠϯϞσϧΛ࣮૷ͯ͠ΈΔ
    7BMVF0CKFDUΛ࡞ͬͯΈΔ
    ͔͜͜Β࣮૷։࢝
    ˞ύοέʔδҠಈΛߟྀͯ͠DMBTT͝ͱʹϑΝ
    ΠϧΛ෼͚ͯΈͨɻ͕ɺ͜Ε͸ࣦഊɻ

    View full-size slide

  40. "QQMJDBUJPO૚
    *OGSBTUSVDUVSF૚
    σʔλϞσϧઃܭ
    Λ࡞͍ͬͯ͘

    View full-size slide

  41. 6*ʢ1SFTFOUBUJPOʣ
    "QQMJDBUJPO
    %PNBJO
    *OGSBTUSVDUVSF

    View full-size slide

  42. little_hand_s さんのqiitaより引用
    https://qiita.com/little_hand_s/items/ebb4284afeea0e8cc752
    υϝΠϯ૚Λ
    ಠཱͤ͞Δ
    ʲج४ʳ
    υϝΠϯ૚ʹ
    ଞͷ૚ͷJNQPSUจ͕ແ͍

    View full-size slide

  43. ᶃݱ࣮ͷݴ༿Λͦͷ··
    ίʔυʹམͱ͢
    ʢϢϏΩλεݴޠʣ

    View full-size slide

  44. ࢓༷ॻ͚ͩͰͳ͘ɺ
    ීஈ࢖͍ͬͯΔݴ༿ʹײ౓ΛߴΊΔ

    View full-size slide

  45. ᶄσʔλϞσϧ͸
    υϝΠϯϞσϧͷޙʹઃܭ
    ʢυϝΠϯϞσϧ͕σʔλϞσϧʹӨڹ͞ΕΔͷ
    Ͱʣ

    View full-size slide

  46. ᶅϞσϧΛҭͯΔ

    View full-size slide

  47. いったり来たり
    俯瞰 詳細

    View full-size slide

  48. Ϟσϧʹ౴͑͸ͳ͍ɻ

    View full-size slide

  49. ΍ͬͯΈͯ
    Ͳ͏͔ͩͬͨʁ

    View full-size slide

  50. ͳ͔ͥͱ͍͏ͱɺߏ଄Λઌʹ࡞ΔͷͰ
    ϩδοΫʹͨͲΓண͘ͷ͕࠷ޙͷํͰ
    ΋Ͳ͔͠͞Λײͨ͡ͷͰ͸ͳ͔Ζ͏͔
    ᶃ࠷ॳ͸গ͠ख͕͔͔ؒΔ
    ײ͕͢͡Δ
    ౰ࣾൺ

    View full-size slide

  51. ᶄͲ͜ʹԿ͕͋Δ͔͕
    Θ͔Γ΍͍͢
    ଞਓɺաڈͷࣗ෼͕ॻ͍ͨίʔυɺͲͪΒͰ΋
    ߏ଄ͱ໊લ͕໌֬ͳͷͰɺͨͲΓ΍͍͢

    View full-size slide

  52. ᶅมߋ͕҆৺
    ࠷ߴʹؾ͕͍͍࣋ͪɻ
    ݁ߏେ͖ͳमਖ਼΋҆৺ײ͕͋Δ

    View full-size slide

  53. ᶆ5ZQF)JOUͰ΋ͦͦ͜͜େৎ

    ܕ͕͋Δݴޠ࢖͑Αɺͱ͍͏࿩͕ͩɺ
    ʢͩͬͯ໨ͷલʹ1ZUIPO͕͋ͬͨΜͩ΋ͷʣ
    1ZUIPOͰ΋*%&͕ิ׬ͯ͘͠ΕΔͷͰॆ෼Ͱ͖Δ
    1)1Ͱ΋͍͚ΔͷͰ͸ͳ͍ͩΖ͏͔

    View full-size slide

  54. ᶇ։ൃʹ౷Ұੑ͕ੜ·ΕΔ
    υϝΠϯϞσϧΛআ͘ͱ͋Δఔ౓ɺܗ͸Ͱ͖Δ
    Ϟσϧͷձ࿩Λଓ͚Ε͹
    ίϛϡχέʔγϣϯίετ͕গͳ͍

    View full-size slide

  55. ᶈDMBTT͝ͱͳͲ
    ࡉ͔͍ςετ͕ඞཁͳͦ͞͏
    ܕ͕୲อͯ͘͠ΕΔ
    ઃܭ͕͔ͬ͠Γ͍ͯ͠Ε͹ɺෳࡶͳܭࢉ΍
    "QQMJDBUJPO4FSWJDF΍$POUSPMMFS͝ͱͰ୲อ͠΍͍͢

    View full-size slide

  56. ࠓޙͷ՝୊

    View full-size slide

  57. ᶃͦ͜·ͰϞσϧ͕ҭͬͯͳ͍
    ΋ͬͱϦϑΝΫλϦϯά͠ͳ͚Ε͹

    View full-size slide

  58. ᶄ΍Γ͗ͨ͢ͱ͜Ζʁ
    DMBTT͝ͱʹϑΝΠϧΛ෼͚ͨͷ͸ࣦഊɻ͍͔ͭ໭͢
    ʢ*OUFMMJK*%&"Ͱมߋ͕஗͘ͳͬͨʜʣ
    ͋Εɺଞʹ͸ແ͍ͳʁʁʁ

    View full-size slide

  59. ᶅ1ZUIPOΤϯδχΞ͕ೖͬͨ
    Β
    ࠔ࿭͢ΔͷͰ͸ͳ͔Ζ͏͔
    ࿩ͤ͹Θ͔Δͱ৴͍ͯ͡Δ

    View full-size slide

  60. ˠˠˠˠ㱣
    探そう 探しつつ
    伸ばそう
    もっと
    伸ばそう
    もっともっと
    伸ばそう

    View full-size slide

  61. 複雑度(変更コスト)が指数関数的に上がっていく
    ˠˠˠˠ㱣
    サクッと
    作って検証
    人が増えてきた
    なんか開発が
    遅い感じがする
    あぁ辛い
    作り直したい
    厳しい
    辛すぎる
    もう無理だ…

    View full-size slide

  62. ˠˠˠˠ㱣
    ここに不可逆な
    境界線が????

    View full-size slide

  63. ˠˠˠˠ㱣
    ここで
    大幅に設計をしなおすことが
    大事なのではないか

    View full-size slide

  64. ͜Ε͕ͦͷޙͷมߋίετΛ
    େ෯ʹԼ͛Δ

    View full-size slide

  65. ここが最も価値がある

    View full-size slide

  66. ৽͍͠΋ͷΛ௥Ճͭͭ͠΋
    ෳࡶͳ΋ͷΛ੔ཧ͠ଓ͚Δ

    View full-size slide

  67. ෳࡶͳ΋ͷΛෳࡶͳ··ѻ͏
    ෳࡶͳ΋ͷ͕୯७ʹͳΔຐ๏͸
    ͳ͍

    View full-size slide

  68. ͦͷͱ͖ʹυϝΠϯۦಈઃܭΛ
    બ୒͢Δͱྑ͍ͱࢥ͏

    View full-size slide

  69. ஥ؒΛେେืूதͰ͢ʂ
    ˔ ෭ۀɾϑϦʔϥϯεΤϯδχΞืूʂ
    ˓ ࣌ؒ΋৔ॴ΋࢓ࣄ಺༰΋ࣗ༝
    ˓ ݁Ռతʹ࢓ࣄ͠ͳͯ͘΋͍͍ͷͰɺҰ୴4MBDLʹೖΖ͏ʂ
    ˓ 1ZUIPOɺ7VFKTɺ,PUMJOɺJ04ͳͲ
    ˔ ΤϯδχΞࣾһืूʂ
    ˓ ਓͷ੒௕ʹڵຯ͕͋Δํ
    ˓ ಇ͘৔ॴɺ࣌ؒࣗ༝
    ˓ ձٞ΋৘ใ΋Φʔϓϯ
    ˓ ෭ۀࣗ༝
    ͓ؾܰʹ͝࿈བྷ͍ͩ͘͞ʂ
    IUUQTXXXXBOUFEMZDPNQSPKFDUT

    View full-size slide