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

ドメイン駆動設計の紹介

83579d17f780c8712ac17fa800efbbbb?s=47 haljik
September 27, 2018

 ドメイン駆動設計の紹介

83579d17f780c8712ac17fa800efbbbb?s=128

haljik

September 27, 2018
Tweet

More Decks by haljik

Other Decks in Programming

Transcript

  1. υϝΠϯۦಈઃܭͷ঺հ େਖ਼(FFL/JHIU7PM !IBMKJL

  2. ࣗݾ঺հ w ͸Δͬ͘͡ w 5XJUUFS!IBMKJL w ϑϦʔϥϯε w +BWBϓϩάϥϚʔ w

    ̍ࣇͷ෕਌ w ϚΠΫϩαʔϏε͕Θ͔Γ· ͤΜ
  3. ࢲͷυϝΠϯۦಈઃܭྺ w ೥ژ౎%%%ಡॻձʹࢀՃͨ͠ͷ͕࠷ॳ w ݱࡏ·Ͱখن໛ͭɺதن໛ͷͭͷϓϩδΣΫτͰυϝΠ ϯۦಈઃܭΛ࣮ફ w ΄΅8FCΞϓϦͷΈ w ҰԠશγεςϜ͕ݱ໾Ͱར༻͞Ε͍ͯΔঢ়گ

    w ͏·͍͍ͬͯ͘Δͱ͜Ζ΋͋Δ͕ɺਂ͍Ϟσϧʹ౸ୡͰ͖ ͳ͍··ऴΘΓɺطʹϞσϧͷҙਤ͕௠෗Խͯ͠Δ΋ͷ΋
  4. %%%ʹର͢Δࢲͷݱঢ় w ׬શʹཧղͨ͠ w ͳʹ΋Θ͔Βͳ͍ w ͪΐͬͱͰ͖Δ w ͳʹ΋Θ͔Βͳ͍͜͜

  5. ΤϦοΫɾΤϰΝϯεͷ
 υϝΠϯۦಈઃܭ͔Β w ·͕͖͑ʙୈ෦υϝΠϯϞσϧΛػೳͤ͞Δ w ·͕͖͑ w ୈষɿ஌ࣝΛ͔Έࡅ͘ w ୈষɿίϛϡχέʔγϣϯͱݴޠͷ࢖͍ํ

    w ୈষɿϞσϧͱ࣮૷Λ݁ͼ͚ͭΔ w ୈ෦Ϟσϧۦಈઃܭͷߏ੒ཁૉ w ୈষɿυϝΠϯΛִ཭͢Δ w ୈষɿιϑτ΢ΣΞͰදݱ͞ΕͨϞσϧ w ୈষɿݴޠΛ࢖༻͢Δ w ୈ෦ΑΓਂ͍ಎ࡯΁޲͔͏ϦϑΝΫλϦϯά w ୈষɿ͠ͳ΍͔ͳઃܭ͔Βʮ֓೦ͷྠֲʯ w ୈ෦ઓུతઃܭ w ୈষɿڥք͚ͮΒΕͨίϯςΩετ w ୈষɿৠཹ
  6. ஫ҙ ͔ͬ͜ॻ͖ ʜ ͷத͸ࢲݟͰ͢

  7. ·͕͖͑ʙୈ̍෦ υϝΠϯϞσϧΛػೳͤ͞Δ w ·͕͖͑ w ୈ̍ষɿ஌ࣝΛ͔Έࡅ͘ w ୈ̎ষɿίϛϡχέʔγϣϯͱݴޠͷ࢖͍ํ w ୈ̏ষɿϞσϧͱ࣮૷Λ݁ͼ͚ͭΔ

  8. ·͕͖͑ w ෳࡶ͕͞՝୊Ͱ͋Δ w ར༻ऀͷ׆ಈʹؔ܎͢Δ໰୊Λղܾ͢Δͷ͕ιϑτ΢Σ Ξͷ֩৺
 ͦΕҎ֎͸ͲΕ΄Ͳʮॏཁʯͩͱͯ͠΋ͦΕΛࢧ͑Δ ΋ͷͰ͔͠ͳ͍ w ։ൃ͕ΠςϨʔςΟϒͰ͋Δલఏ

    w ։ൃऀͱυϝΠϯΤΩεύʔτ͕ີ઀ʹؔΘ͍ͬͯΔ લఏ
  9. ୈ̍ষ ஌ࣝΛ͔Έࡅ͘ w ΄ͱΜͲ஌͕ࣝͳ͍୯७ͳϞσϧ͔Βձ࿩Λ࢝ΊΔ w ։ൃऀͷ࣭໰ʹ౴͑Δ͜ͱͰυϝΠϯΤΩεύʔτ͸஌ࣝͷཧղ͕ਫ਼៛ʹͳΔ w ։ൃऀ΋΋ͪΖΜ஌͕ࣝ૿͑Δ w ॏཁͳ΋ͷΛϞσϧʹಋೖ͠ɺಉ࣌ʹෆཁͳৄࡉΛল͘


    ୈষৠཹ΁ͭͳ͕Δ w ͦͷϞσϧΛݩʹ·ͨձ࿩Λ͢Δ w ͜ΕΒΛ܁Γฦ͢ w Ӆ͞Εͨ֓೦Λൃݟ͠ਂ͍Ϟσϧʹ౸Δ
  10. ୈ̎ষ ίϛϡχέʔγϣϯͱݴޠͷ࢖͍ํ w ٕज़༻ޠ͸࢖Θͳ͍ w ͍ͭͰ΋Ͳ͜Ͱ΋ϢϏΩλεݴޠ w ੠Λग़ͯ͠ϞσϦϯά͢Δ w ҧ࿨ײ΍͍͋·͍͞Λݕ஌

    w ಉ͡ҙຯͷΑ͏ʹฉ͑͜Δҧ͏ݴ༿Λݕ஌
 ʢ΋͔ͨ͠͠Β࢖ΘΕΔจ຺͕ҧ͏͔΋͠Εͳ͍ʣ w ̍ͭͷνʔϜʹ̍ͭͷݴޠ
 ίϯ΢ΣΠͷ๏ଇͱ͔̐ষͷڥք෇͚ΒΕͨίϯςΩετʹͭͳ͕Δ
  11. ୈ̏ষ Ϟσϧͱ࣮૷Λ݁ͼ͚ͭΔ w ෼ੳϞσϧͱ࣮૷ΛҰகͤ͞Δ w ϞσϦϯάύϥμΠϜΛαϙʔτ͢ΔݴޠͰ࣮૷͠Α͏ w ࣮ફతϞσϥɿ෼ੳऀͱ࣮૷ऀ͸ಉ͡ਓ

  12. ·͕͖͑ʙୈ̍෦ͷ·ͱΊ w ·͕͖͑͸ෳࡶ͞ͱ͍͏՝୊Λఏ͍ࣔͯ͠Δ w ୈ̍෦ͷϢϏΩλεݴޠΛ࢖ͬͨϞσϧۦಈઃܭ͸υϝΠ ϯۦಈઃܭͷओͳ׆ಈ w ୈ෦Ҏ߱͸͢΂ͯୈ̍෦Ͱඳ͔Εͨ׆ಈͷதͰΤϦοΫɾ ΤϰΝϯε͕࣮ࡍʹ௚໘ͨ͠՝୊ʹର͢ΔιϦϡʔγϣϯ

  13. ୈ෦ Ϟσϧۦಈઃܭͷߏ੒ཁૉ w ୈষɿυϝΠϯΛִ཭͢Δ w ୈষɿιϑτ΢ΣΞͰදݱ͞ΕͨϞσϧ w ୈষɿݴޠΛ࢖༻͢Δ

  14. ୈষ υϝΠϯΛִ཭͢Δ w ΠϯϑϥετϥΫνϟ΍6*͔ΒυϝΠϯΛִ཭ͯ͠ɺूத Ͱ͖ΔΑ͏ʹ͠Α͏
 ʢϨΠϠʔυΞʔΩςΫνϟ͚ͩͲɺυϝΠϯ͕Πϯϑϥ ετϥΫνϟʹґଘ͍ͯ͠Δਤʹͳͬͯͯྲྀੴʹݹ͍ʣ

  15. ୈষ ιϑτ΢ΣΞͰදݱ͞ΕͨϞσϧ w ΤϯςΟςΟɺ஋ΦϒδΣΫτɺαʔϏεͰදݱ͢Δ
 ʢαʔϏε͸࢖ͬͯͳ͍ʣ w ؔ࿈ w ؔ࿈ͷํ޲͸ॏཁ౓Λද͢͜ͱ͕͋Δ
 ྫʮຊʯͱͦͷʮ࡞ՈʯͰͲͪΒ͔Βؔ࿈ΛҾ͘ʁ

    w ؔ࿈Λ੍ݶͯ͠දݱ͞ΕΔ஌ࣝΛ૿΍͢ w Ұํ௨ߦ w ݶఆ w ຊ࣭తͰͳ͍ؔ࿈͸আڈ
  16. ΤϯςΟςΟ lͦΕΏ͑ɿz·Ͱ͕ΉͪΌͪ͘Ό௕͍ʜ  w ࡶʹݴ͏ͱɺಉҰੑͷࣝผ͕ඞཁͳέʔε͍Ζ͍Ζ͋Δ ͦΕΏ͑ɺࣝผ͕ඞཁͳΒࣝผ͢Δ੹຿Λ΋ͬͨϞσϧΛ ࡞Δͷͩͱ͍͏Α͏ͳ͜ͱ͕ॻ͔Ε͍ͯΔ w γϯϓϧʹอͬͯࣝผʹूத͢Δ
 ʢྑ͘Ͱ͖ͨͱײͨ͡ΤϯςΟςΟͷଐੑ͸ࣝผʹඞཁͳ

    ΋ͷͱ஋ΦϒδΣΫτ͚ͩৼΔ෣͍͸ࣝผͷͨΊͷ΋ͷ ͔ͬͨ͠ʣ
  17. ஋ΦϒδΣΫτ w ԿͰ͋Δ͔Λهड़͢ΔΦϒδΣΫτ
 ୭Ͱ͋Δ͔ɺͲΕͰ͋Δ͔͸ؾʹ͠ͳ͍ w Ұաੑͷૢ࡞ͷͨΊʹੜ੒͞Εͯ͸ഁغ͞ΕΔ͜ͱ΋͋Δ w ෆมʹ͢Δ ʢҰ൪ཻ౓ͷখ͍͞ཁૉͰՃ޻΍ܭࢉͱ͍ͬͨzυϝΠϯ ϩδοΫzͷஔ͖৔ॴʹͳΔʣ

  18. ୈষ ݴޠΛ࢖༻͢Δ w ϞσϧۦಈઃܭΛߦ͍ͬͯ͘தͰɺग़͖ͯͨ໰୊ʹͲ͏ύλʔϯΛద༻͍͔͕ͯ͘͠ඳ͔Ε ͍ͯΔ w ߦΘΕ͍ͯΔҰ࿈ͷαΠΫϧ υϝΠϯΛִ཭͢Δ ΤϯςΟςΟͱ஋ΦϒδΣΫτΛ۠ผ͢Δ ؔ࿈Λઃܭ͢Δ

    ू໿ͷڥքͱϦϙδτϦΛબ୒ʢ͜Ε͸ೖग़ྗͷؔ৺ࣄ৭͕ڧ͍ͷͰॳظͷϞσϧͰ͸ؾʹ͠ͳ ͯ͘Α͍͔ͳʣ γφϦΦΛ΢ΥʔΫεϧʔ͢Δʢ੠ʹͩͯ͠ϞσϦϯάʣ ϦϑΝΫλϦϯά ৽ػೳಋೖ ૯߹ԋशతͳ಺༰ɻ͜ΕΛΠςϨʔςΟϒʹ΍Δ
  19. ୈ෦ ΑΓਂ͍ಎ࡯΁޲͔͏ϦϑΝΫλϦϯά wୈষɿ͠ͳ΍͔ͳઃܭ

  20. ୈষ ͠ͳ΍͔ͳઃܭ w ֓೦ͷྠֲ 1 
 ৽ͨͳཁٻ͕དྷΔͨͼɺͦͷ࣌఺ͷϞσϧͰ͸͗ͪ͜ͳ͔͘͠දݱͰ͖ͳ͔ͬ ͨΓɺ͋ͪͪ͜Λมߋ͠ͳ͚Ε͹ରԠͰ͖ͳ͔ͬͨΓ͢Δ෦෼Λɺදݱ͕γ ϯϓϧʹɺมߋ͕؆୯Ͱ҆શʹͳΔΑ͏ʹϦϑΝΫλϦϯάΛ܁Γฦ͢ɻ݁ Ռͱͯͦ͠ͷ෦෼͕͠ͳ΍͔ʹͳ͍ͬͯ͘ɻͦͷաఔͰ֓೦ͷྠֲ͕ݟ͑ͯ

    ͘Δʢ͋Δ͍͸ݟ͚ͭʹ͍͘ʣ w มߋ͕Ԡٸॲஔʹ͗͢ͳ͍ͷ͔ɺ҉໧తͳར༻ऀͷؔ৺ࣄ΍ɺߏ଄Λൃݟ ͢Δ͖͔͚ͬʹͳΔ΋ͷͳͷ͔Λࣗ໰͢Δ ʢʮୈ̕ষ҉໧తͳ֓೦Λ໌ࣔతʹ͢Δʯ΍ɺʮୈষৠཹʯʹ΋ͭͳ͕ Δɻ୯७ʹॏෳΛল͍ͨΓ͢Δٕज़తͳϦϑΝΫλϦϯάͰ͸ͳ͘υϝΠϯ ͷݴ༿ʹͳΓ͏Δ֓೦Λݟ͚ͭग़͢ॏཁͳϓϥΫςΟεɻίʔυ͔ΒͷϑΟʔ υόοΫΛಘΔखஈɻʣ
  21. ୈ෦ ઓུతઃܭ w ୈষɿڥք͚ͮΒΕͨίϯςΩετ w ୈষɿৠཹ

  22. ୈষ ڥք͚ͮΒΕͨίϯςΩετ w ॏෳͨ֓͠೦ɺِಉ଒ޠͷݕ஌ʢձ࿩ॏཁʣ w ݱ࣮ੈքͷಉ͡΋ͷΛҟͳΔଆ໘͔ΒΈͨͱ͖ʹ໊લ΋͘͠͸ ໾ׂ͕มΘΔɻ͜ΕΒΛಉ͡Ϟσϧͱͯ͠ѻ͏ͷ͔Ͳ͏͔ݕ౼͢ Δ w ୯ҰϞσϧମܥͷதͰ୯ʹݺͼ෼͚ΒΕͨΓҟͳΔ֓೦ͱͯ͠ந

    ग़Ͱ͖ΔέʔεͱɺଞͷཁૉΛҾ͖࿈ΕͯผͷϞσϧମܥ͕΋͏ ̍ηοτͰ͖͕͋ΔΑ͏ͳέʔε͕͋Δ w ผͷϞσϧମܥ͕ग़དྷΔέʔε͕ڥք͚ͮΒΕͨίϯςΩετʜ ͜ͷຊͷதͰ͸ۤ೑ͷࡦͬΆ͍ॻ͔ΕํΛ͍ͯ͠ΔΑ͏ʹݟ͑Δ
  23. ୈ̍̑ষ ৠཹ w υϝΠϯϏδϣϯ੠໌จͰํ޲෇͚ w ڧௐ͞ΕͨίΞʹΑΓίΞυϝΠϯͷ಺༰Λࢦఆ͢Δ w ύοέʔδϯά͠௚ͯ͠ίΞΛִ཭͢Δ w ίΞυϝΠϯͷअຐΛ͠ͳ͍Α͏ʹ൚༻αϒυϝΠϯΛ੾

    Γग़͢ w ίΞυϝΠϯͷअຐΛ͠ͳ͍Α͏ʹڽू͞ΕͨϝΧχζϜ Λ੾Γग़͢