Slide 1

Slide 1 text

1)1ΧϯϑΝϨϯεؔ੢ !TIJOY ந৅Խͱ͍͏ࢥߟͷπʔϧ ཧղͱ׆༻

Slide 2

Slide 2 text

D .BTBTIJ4IJOCBSB!TIJOY !TIJOY ৽ݪʢ͠Μ͹Βʣխ࢘ େࡕͰ8FCγεςϜ։ൃ΍ٕज़αϙʔτΛߦ͍ͬͯ·͢ɻ ਆށग़਎Ͱ͢ʂ wCMPH IUUQTCMPHTIJOYDPN w1PEDBTU1)1ͷݱ৔ IUUQTQIQHFOCBTIJOYDPN

Slide 3

Slide 3 text

D .BTBTIJ4IJOCBSB!TIJOY ͸͡Ίʹ 👉͜ͷࢿྉ͸ެ։͠·͢ɻ  👉ந৅Խʹؔ͢ΔࢲͳΓͷߟ͑ํΛ͝঺հ͠·͢ɻ ͜͏͍͏ߟ͑ํ΋͋Δͷͩͳͱฉ͍͍ͯͩ͘͞ɻ 👉ײ૝ɺϑΟʔυόοΫ͓଴͍ͪͯ͠·͢ʂ QIQLBOTBJPSGPSUFFϑΟʔυόοΫϖʔδ ͸͡Ίʹ

Slide 4

Slide 4 text

D .BTBTIJ4IJOCBSB!TIJOY "HFOEB w ந৅Խͷཧղ w ந৅Խͷ׆༻

Slide 5

Slide 5 text

D .BTBTIJ4IJOCBSB!TIJOY ந৅Խͷཧղ

Slide 6

Slide 6 text

D .BTBTIJ4IJOCBSB!TIJOY ந৅Խͱ͸ w ந৅ ந৅ԽͰ࡞ΒΕͨ֓೦ʢந৅Խͱ͍͏ߦҝʹ࢖͏έʔε΋͋Δʣ w ࣺ৅ ର৅͔ΒෆཁͳཁૉΛࣺͯΔ͜ͱɺࣺͯͨ΋ͷ ର৅ʢ۩ମʣ͔Βຊ࣭తʹॏཁͳཁૉΛऔΓग़ͯ͠ Ұͭͷ֓೦ͱͯ͠ఆٛ͢Δ͜ͱ

Slide 7

Slide 7 text

D .BTBTIJ4IJOCBSB!TIJOY ந৅Խྫͦ͹Ί͠ ͦ͹Ί͠ w ৯ࣄ w ͦ͹ w ͝൧ w ೑ w ιʔε w ᖱΊΔ w ਆށൃ঵ w ϑΝʔετϑʔυ w ͍҆ w FUD

Slide 8

Slide 8 text

D .BTBTIJ4IJOCBSB!TIJOY ͦ͹Ί͠ w ৯ࣄ w ͦ͹ w ͝൧ w ιʔε w ᖱΊΔ w ਆށൃ঵ w ϑΝʔετϑʔυ w ͍҆ w FUD ͦ͹Ί͠Ϩγϐ w ͦ͹ w ͝൧ w ᖱΊΔ w ιʔε ந৅Խྫͦ͹Ί͠ จ຺ͦ͹Ί͠Λ࡞Δ จ຺ʹଈͨ֓͠೦

Slide 9

Slide 9 text

D .BTBTIJ4IJOCBSB!TIJOY ͦ͹Ί͠ w ৯ࣄ w ͦ͹ w ͝൧ w ιʔε w ᖱΊΔ w ਆށൃ঵ w ϑΝʔετϑʔυ w ͍҆ w FUD ͦ͹Ί͠Ϩγϐ w ͦ͹ w ͝൧ w ᖱΊΔ w ιʔε ந৅Խྫจ຺ʹΑͬͯந৅͸ҟͳΔ จ຺#ڃάϧϝಛू #ڃάϧϝ w ϑΝʔετϑʔυ w ਆށൃ঵ w ஍ݩͰਓؾ จ຺ͦ͹Ί͠Λ࡞Δ

Slide 10

Slide 10 text

D .BTBTIJ4IJOCBSB!TIJOY ந৅ԽͷϝϦοτ w ཧղ͠΍͘͢ͳΔɺѻ͍΍͘͢ͳΔɺ఻͑΍͘͢ͳΔ ৘ใྔΛݮΒͤΔɺ۩ମʢৄࡉʣΛແࢹͰ͖Δɺຊ࣭ʹ୯७Խ w ύλʔϯԽͯ͠஌ࣝΛ࠶ར༻Ͱ͖Δ ෳ਺ͷ۩ମΛಉ͡ύλʔϯͰѻ͑Δ w ৽ͨͳൃ૝ΛಘΒΕΔ ၆ᛌͯ͠ݟΔ͜ͱͰࢥߟΛ੔ཧͰ͖Δ

Slide 11

Slide 11 text

D .BTBTIJ4IJOCBSB!TIJOY ޷͖ͳந৅ϑΝΠϧ w PQFO w SFBE w XSJUF w DMPTF QBUIUPJNBHFKQH ϑΝΠϧσʔλ͕ೖ͍ͬͯΔ ϑΝΠϧ

Slide 12

Slide 12 text

D .BTBTIJ4IJOCBSB!TIJOY ӬଓԽσόΠεʢ)%%ɺ44%౳ʣΠϝʔδ      B C D E F w σόΠε্ͷ෺ཧҐஔʹอଘ w ಉ͡ϑΝΠϧͷσʔλ΋෼ׂ͞ΕΔ w C C EΛಡΜͰ࿈݁͢Δ w ϑΝΠϧσʔλ΋ϝλσʔλ΋ಉ͡σʔλ JNBHFKQHϑΝΠϧσʔλ ϑΝΠϧϝλσʔλ

Slide 13

Slide 13 text

D .BTBTIJ4IJOCBSB!TIJOY ϑΝΠϧʹந৅Խ      B C D E F ϑΝΠϧ QBUIUPJNBHFKQH

Slide 14

Slide 14 text

D .BTBTIJ4IJOCBSB!TIJOY ϑΝΠϧʹந৅Խ      B C D E F ϑΝΠϧ QBUIUPJNBHFKQH

Slide 15

Slide 15 text

D .BTBTIJ4IJOCBSB!TIJOY ཧղ΍͍͢ɺѻ͍΍͍͢ɺ఻͑΍͍͢ ϑΝΠϧ ӬଓԽσόΠε w ӬଓԽσόΠεΛ஌Βͳͯ͘ྑ͍ w ϑΝΠϧͱͯ͠ѻ͑Δ

Slide 16

Slide 16 text

D .BTBTIJ4IJOCBSB!TIJOY ϑΝΠϧ 44% )%% /FUXPSL 4UPSBHF σόΠε͕ҟͳͬͯ΋ૢ࡞Ͱ͖Δ ύλʔϯԽͯ͠஌ࣝΛ࠶ར༻Ͱ͖Δ

Slide 17

Slide 17 text

D .BTBTIJ4IJOCBSB!TIJOY ৽ͨͳൃ૝ΛಘΒΕΔ ϑΝΠϧ ӬଓԽσόΠε w ϑΝΠϧҎ֎ͷର৅Λ ϑΝΠϧͷΑ͏ʹѻ͑Δ w FY w IUUQ w GUQ w T w QIQ 1)1TUSFBN

Slide 18

Slide 18 text

D .BTBTIJ4IJOCBSB!TIJOY ந৅౓ʢந৅Ϩϕϧʣ w ந৅ͱ۩ମ͸૬ରత ͋Δந৅͸ΑΓߴ࣍ͷந৅͔Β͸۩ମ w ந৅౓ந৅ͷ౓߹͍Λࣔ͢΋ͷ ந৅౓͕ߴ͍ΑΓߴ࣍ͷந৅ w ந৅౓ʹ΋จ຺ʢ࣠ʣ͕͋Δ

Slide 19

Slide 19 text

D .BTBTIJ4IJOCBSB!TIJOY ந৅౓ྫ &MPRVFOU%PDUSJOF 1%0 ந৅ ʢந৅౓͕ߴ͍ʣ NZTRM@OE TRMJUF֦ு QHTRM֦ு ۩ମ ʢந৅౓͕௿͍ʣ

Slide 20

Slide 20 text

D .BTBTIJ4IJOCBSB!TIJOY ίϯϐϡʔλγεςϜ͸ந৅ͷմ w ݱ࣮ੈքʢυϝΠϯʣͷந৅ ݱ࣮ͷ׆ಈʢϏδωε౳ʣΛιϑτ΢ΣΞจ຺Ͱந৅Խ w ϋʔυ΢ΣΞͷந৅ ϋʔυ΢ΣΞͷಈ࡞Λந৅Խʢ04ҎԼͷ࢓ࣄʣ w ࣮ߦ؀ڥͷந৅ 041)1 ;FOE&OHJOF 1)1ίʔυ ͳͲ

Slide 21

Slide 21 text

D .BTBTIJ4IJOCBSB!TIJOY ந৅Խͷ׆༻

Slide 22

Slide 22 text

D .BTBTIJ4IJOCBSB!TIJOY ந৅Λ࡞Δ w ؼೲతʢϘτϜΞοϓʣ w ԋ៷తʢτοϓμ΢ϯʣ

Slide 23

Slide 23 text

D .BTBTIJ4IJOCBSB!TIJOY ந৅Λ࡞ΔؼೲతʢϘτϜΞοϓʣ w ந৅ͷ໨తɺར༻ํ๏Λఆٛ ཁૉͷԿΛ࢒͔͢ʢࣺͯΔ͔ʣͷ൑அج४͕ඞཁ w ۩ମ͔Β໨తʹ߹͏ந৅Λݟग़͢ طଘͷந৅ΛࢀߟʹͰ͖Δέʔε΋͋Δ w ந৅͕໨తʹଈ͍ͯ͠Δ͔Λݕূ ந৅͔Β͍͔ͭ͘ͷ۩ମΛ૝ఆͯ͠ݕূɺඞཁͳΒந৅Λߋ৽

Slide 24

Slide 24 text

D .BTBTIJ4IJOCBSB!TIJOY ۀ຿ͷந৅Խ w ݱ࣮ͷۀ຿ΛγεςϜԽ͢ΔͨΊʹந৅Խ w จ຺ʹΑͬͯந৅͸มΘΔ จ຺ʹଈͨ͠ཁૉΛநग़͠ɺෆཁͳཁૉ͸ࣺͯΔ w ந৅Խͷྫ FYۀ຿ϑϩʔۀ຿Πϕϯτ΍ۀ຿ϓϩηεɺଞۀ຿ͱͷؔ࿈ͳͲ FYσʔλϞσϧۀ຿σʔλͷछྨɺߏ଄ɺؔ࿈ͳͲ

Slide 25

Slide 25 text

D .BTBTIJ4IJOCBSB!TIJOY ۀ຿ΞϓϦέʔγϣϯ։ൃʹ͓͚Δந৅Խ ݱ࣮ͷۀ຿ ۀ຿֓೦ υΩϡϝϯτ ΞϓϦέʔγϣϯ ந৅Խ ۩ମԽ ۩ମԽ

Slide 26

Slide 26 text

D .BTBTIJ4IJOCBSB!TIJOY ந৅Λ࡞Δԋ៷తʢτοϓμ΢ϯʣ w ໨తʹଈͨ͠ந৅Λ࡞Δ σβΠϯύλʔϯ΍ݪଇͳͲطଘͷந৅Λ࢖͏͜ͱ΋͋Δ w ۩ମʹద༻͍ͯ͘͠ʢ۩ମΛ࡞Δʣ ந৅͔Β͍͔ͭ͘ͷ۩ମΛ૝ఆͯ͠ݕূɻඞཁͳΒந৅Λमਖ਼ɻ w ྫந৅Խͨ͠ۀ຿֓೦ઃܭ࣮૷ w ྫࣾੋ໨ඪߦಈ

Slide 27

Slide 27 text

ந৅Λઌʹ࡞Δྫ interface UserRepositoryInterface { public function findById(int $id): ?User; public function store(User $user): void; } final class FooUseCase { public function __construct(private UserRepositoryInterface $userRepository) { } public function execute(int $id): void { $user = $this->userRepository->findById($id); // Կ͔ͷॲཧ $this->userRepository->store($user); } }

Slide 28

Slide 28 text

D .BTBTIJ4IJOCBSB!TIJOY దͨ͠ந৅Λ࡞Δʹ͸ w ໨తɺར༻๏Λ໌֬ʹ͢Δ w ஌ࣝΛಘΔɺܦݧ͢Δ w ͋͑ͯந৅౓Λม͑ͯΈΔ w ଞऀʹҙݟΛٻΊΔʢ"*ؚΉʣ

Slide 29

Slide 29 text

D .BTBTIJ4IJOCBSB!TIJOY FYશମ૾ʢந৅ʣΛνʔϜͰ࡞Δ w γεςϜߏ੒ਤΛ࡞ΔϫʔΫγϣοϓ ࡞ਤπʔϧΛը໘ڞ༗͠ͳ͕Β࡞ΔʢΈΜͳͰฤूͰ͖Δͱྑ͍ʣ w Ұॹʹ࡞Δ͜ͱͰཧղ͕ਂ·Δ ஌ࣝͷఈ্͛ɺݟฦͤΔ w ৭ʑͳந৅౓ͷਤ͕ߟ͑ΒΕΔ γεςϜߏ੒ɺόϦϡʔετϦʔϛϯάϚοϓɺϦΫΤετϨεϙϯεͳͲ

Slide 30

Slide 30 text

D .BTBTIJ4IJOCBSB!TIJOY FYγεςϜશମ૾ ؅ཧγεςϜ ঎඼ొ࿥ ൃૹॲཧ ߪೖϢʔβ "ࣾ୲౰ &$αΠτ ঎඼ߪೖ %#

Slide 31

Slide 31 text

D .BTBTIJ4IJOCBSB!TIJOY ந৅౓Λἧ͑Δ w ந৅౓͕ἧ͍ͬͯͳ͍ͱཧղͮ͠Β͍ ཧղ͢Δͷʹ෯޿͍૝ఆ͕ඞཁͳͷͰೝ஌ෛՙ͕ߴ͍ w ந৅౓Λἧ͑Δɺ߹ΘͤΔ w FYਐḿ֬ೝ ਐḿΛ֬ೝ͍͚ͨͩ͠ͳͷʹɺ࣮૷ৄࡉΛճ౴

Slide 32

Slide 32 text

D .BTBTIJ4IJOCBSB!TIJOY 4-"1୯Ұந৅౓ݪଇ w ؔ਺΍ϝιου಺͸ಉ͡ந৅౓ʹ͢Δ w ந৅౓͕ߴ͍ίʔυͱந৅౓͕௿͍ίʔυΛࠞͥͳ͍ w FYίϯτϩʔϥ όϦσʔγϣϯɺϏδωεϩδοΫ࣮ߦɺϨεϙϯεੜ੒ͳͲ࢓ࣄ͕ଟ͍ɻ ந৅౓͕ҟͳΔॲཧ͸ผϝιουʹͯ͠ɺϝιουݺͼग़͠ͷΈʹ͢Δɻ

Slide 33

Slide 33 text

❌ϝιου಺ʹҟͳΔந৅౓͕ࠞࡏ public function run(int $userId, int $value): User { // ந৅౓௿ɿDB ΞΫηε $conn = new PDO('mysql:host=localhost', 'user', 'pass'); $stmt = $conn->prepare('SELECT * FROM users WHERE id = ?'); $stmt->execute([$userId]); $user = $stmt->fetchObject(User::class); // ந৅౓ߴ: ϏδωεϩδοΫͰ஋Λܭࢉ $someValue = $user->value + $value; // Կ͔ෳࡶͳܭࢉ // ந৅౓ఈɿ஋Λอଘ $updateStmt = $conn->prepare('UPDATE users SET value = ? WHERE id = ?'); $updateStmt->execute([$someValue, $userId]); return $user; }

Slide 34

Slide 34 text

✅ϝιου಺ͷந৅౓͕ἧ͍ͬͯΔ public function run(int $userId, int $value): User { $conn = $this->getConnection(); $user = $this->findUser($conn, $userId); $someValue = $this->caluclateValue($user, $value); $this->updatePoint($conn, $user, $someValue); return $user; } ϝιουݺͼग़͠ͷΈͰॲཧϑϩʔΛهड़

Slide 35

Slide 35 text

✅ϝιου಺ͷந৅౓͕ἧ͍ͬͯΔ private function getConnection() { // ந৅౓ఈɿDB ΞΫηε } private function findUser($conn, int $userId): ?User { // ந৅౓ఈɿDB ΞΫηε } private function updatePoint($conn, $user) { // ந৅౓ఈɿDB ΞΫηε } private function caluclateValue($user, int $value) { // ந৅౓ߴɿϏδωεϩδοΫ }

Slide 36

Slide 36 text

D .BTBTIJ4IJOCBSB!TIJOY ந৅౓Λ੔ཧ͢Δ w ந৅౓ͷ্͛Լ͕͛͋Δͱ෼͔ΓͮΒ͍ w ந৅౓ߴந৅౓௿ʹฒ΂Δ w FYॻ੶ɺจষ ֓ཁ໨࣍ষઅ߲

Slide 37

Slide 37 text

D .BTBTIJ4IJOCBSB!TIJOY ͋͑ͯந৅౓Λม͑Δ w ໰୊ղܾͷͨΊʹҙਤతʹந৅౓Λม͑Δ ۩ମʹϑΥʔΧε͍͗ͯ͢͠ΔՄೳੑ w ࢹ໺Λ޿͛ΔͨΊʹந৅౓Λ্͛Δ શମ૾ΛݟΔɺ্Ґͷ໨తΛݟ௚͢ w ࣮ࡍͷέʔεΛೝࣝ͢ΔͨΊʹந৅౓ΛԼ͛Δ ໰୊ͷղ૾౓ΛߴΊΔɺ۩ମతͳࣄ৅ΛݟΔ

Slide 38

Slide 38 text

D .BTBTIJ4IJOCBSB!TIJOY FYෆ۩߹ௐࠪ w 1)1ίʔυ͚ͩΛݟͣʹશମΛݟΔ ϦΫΤετ͔ΒϨεϙϯεͷྲྀΕΛݟ௚͢ w Ծઆݕূ͠ͳ͕Βந৅౓ΛԼ͍͛ͯ͘ ݪҼՕॴΛߜ͍ͬͯ͘ʢݪҼͰ͸ແ͍ͱ͜ΖΛࢬמΓ͍ͯ͘͠ʣ w ࣠Λม͑ͯɺӨڹ౓ΛݟΔ ۀ຿ʹͲͷΑ͏ʹӨڹ͍ͯ͠Δ͔ʁࠓ΍Δ΂͖͸Կ͔ʁ

Slide 39

Slide 39 text

D .BTBTIJ4IJOCBSB!TIJOY FYෆ۩߹ௐࠪ

Slide 40

Slide 40 text

D .BTBTIJ4IJOCBSB!TIJOY FYγεςϜΛҰͭͷմʹݟΔʢந৅౓Λ্͛Δʣ γεςϜ

Slide 41

Slide 41 text

D .BTBTIJ4IJOCBSB!TIJOY FYΫϥΠΞϯτͱαʔόʹ෼͚Δʢந৅౓ΛԼ͛Δʣ αʔό ΫϥΠΞϯτͱαʔόͷͲͪΒʹ໰୊͕͋Δ͔Λ੾Γ෼͚Δ

Slide 42

Slide 42 text

D .BTBTIJ4IJOCBSB!TIJOY FYΞϓϦέʔγϣϯ·Ͱͷܦ࿏ΛݟΔ ΞϓϦέʔγϣϯ ΞϓϦέʔγϣϯ·Ͱͷܦ࿏ʹ໰୊͕͋Δ͔ݟΔ

Slide 43

Slide 43 text

D .BTBTIJ4IJOCBSB!TIJOY FYΞϓϦέʔγϣϯΛݟΔ

Slide 44

Slide 44 text

D .BTBTIJ4IJOCBSB!TIJOY ·ͱΊ

Slide 45

Slide 45 text

D .BTBTIJ4IJOCBSB!TIJOY ·ͱΊ w ந৅Խ͸਎ۙͳࢥߟπʔϧ w ໨తɺจ຺ʹԠͨ͡࢖͑Δந৅Λ࡞Δ w ந৅౓Λ੔ཧ͢Δͱ෼͔Γ΍͘͢ͳΔ w ࣌ʹ͸ҙࣝతʹந৅౓Λม͑ͯΈΔ

Slide 46

Slide 46 text

D .BTBTIJ4IJOCBSB!TIJOY ࢀߟ w ந৅Խ IUUQTLPUPCBOLKQXPSE &"#%&#"&$ w ۩ମͱந৅ IUUQTXXXBNB[PODPKQEQ#-65/* w ϓϩμΫςΟϒɾϓϩάϥϚ IUUQTXXXPSFJMMZDPKQCPPLT