Slide 1

Slide 1 text

࿨ా୎ਓʢ!U@XBEBʣ αόϯφศΓ ࣗಈςετʹؔ͢Δ࿈ࡌͰಘΒΕͨ஌ݟͷ·ͱΊ 📷🙆 🙆 'PSLXFMMจԽࡇ@" .BS

Slide 2

Slide 2 text

t-wada t_wada twada 📷🙆 📹🙅 🙆 ࣗݾ঺հ #Forkwell文化祭_A

Slide 3

Slide 3 text

ٕज़ॻͷग़൛ʹؔΘ͍ͬͯ·͢

Slide 4

Slide 4 text

αόϯφศΓʜʜʁ

Slide 5

Slide 5 text

IUUQTUXBEBIBUFOBCMPHKQFOUSZXEQSFTTTBWBOOBDPMVNO 8%#13&44ʹίϥϜΛ࿈ࡌ͍ͯ͠·͢

Slide 6

Slide 6 text

IUUQTUXBEBIBUFOBCMPHKQFOUSZXEQSFTTTBWBOOBDPMVNO 8%#13&44ʹίϥϜΛ࿈ࡌ͍ͯ͠·͢

Slide 7

Slide 7 text

ΑΖ͓͘͠ئ͍͠·͢ 📷🙆 🙆 'PSLXFMMจԽࡇ@"

Slide 8

Slide 8 text

"HFOEB࿈ࡌ֤ճͷςʔϚ ֶश༻ςετ ِཅੑͱِӄੑ ςεταΠζ ςετμϒϧ ςετϐϥϛου 🦁

Slide 9

Slide 9 text

ֶͼΛࣗಈςετͱͯ͠ॻ͘ ଈ࣌ੑͱ࠶ݱੑ

Slide 10

Slide 10 text

ֶशྫ1)1ͷ%BUF5JNFͱ%BUF5JNF*NNVUBCMF IUUQTXXXQIQOFUNBOVBMKBDMBTTEBUFUJNFJNNVUBCMFQIQ

Slide 11

Slide 11 text

/** * @test * @group learning */ public function DateTimeのaddは自身の状態を変更しつつ自身を返す(): void { $halloween = new \DateTime('2021-10-31'); $oneYear = \DateInterval::createFromDateString('1 year'); $halloween2022 = $halloween->add($oneYear); $this->assertSame($halloween, $halloween2022); $this->assertEquals('2022-10-31', $halloween->format('Y-m-d')); $this->assertEquals('2022-10-31', $halloween2022->format('Y-m-d')); } /** * @test * @group learning */ public function DateTimeImmutableのaddは自身の状態を変更せず新しい状態を伴う新しいインスタンスを返す(): void { $halloween = new \DateTimeImmutable('2021-10-31'); $oneYear = \DateInterval::createFromDateString('1 year'); $halloween2022 = $halloween->add($oneYear); $this->assertNotSame($halloween, $halloween2022); $this->assertEquals('2021-10-31', $halloween->format('Y-m-d')); $this->assertEquals('2022-10-31', $halloween2022->format('Y-m-d')); } %BUF5JNFͱ%BUF5JNF*NNVUBCMFͷҧ͍Λֶशςετʹ͢Δ ֶशςετʢֶͼ͕໨తͷςετʣΛ ݟ෼͚ΔͨΊʹ MFBSOJOHλάΛ͚͍ͭͯ·͢ ֶ͕͜͜ͼ ֶ͕͜͜ͼ

Slide 12

Slide 12 text

ٙ໰Λςετʹ͢Δ

Slide 13

Slide 13 text

/** * @test * @group learning */ public function 同じ時刻を指している場合はタイムゾーンが異なっても等価とみなされる(): void { $utc = new DateTimeImmutable('2021-12-24T15:00:00', new DateTimeZone('UTC')); $jst = new DateTimeImmutable('2021-12-25T00:00:00', new DateTimeZone('Asia/Tokyo')); $this->assertTrue($utc == $jst); } ٙ໰Λςετʹ͢Δ ςετʹฉ͍ͯΈΕ͹͍͍

Slide 14

Slide 14 text

ڻ͖Λςετʹ͢Δ ྫ͑͹ʜʜ

Slide 15

Slide 15 text

ί ϯ ε τ ϥ Ϋ λ ͸ Ұ ճ ͠ ͔ ݺ ΂ ͳ ͍ ͱ ࡨ ֮ ͠ ͯ ͍ ͨ ʁ ㅟ ㅟ ㅟ ㅟ ㅟ ㅟ ㅟ ㅟ ㅟ ㅟ ㅟ ㅟ ㅟ ㅟ ㅟ Ұ ମ ͍ ͭ ͔ Β ŠŠŠŠŠŠ

Slide 16

Slide 16 text

/** * @test * @group learning */ public function コンストラクタをもう一度呼ぶと破壊的変更ができてしまう(): void { $dt = new \DateTimeImmutable('2021-12-24'); $this->assertSame('2021-12-24', $dt->format('Y-m-d')); $dt->__construct('2022-01-01'); $this->assertSame('2022-01-01', $dt->format('Y-m-d')); } ͳΜʜʜͩͱʜʜʂʁ ໌ࣔతʹݺ΂ͯ͠·͏ ༨ஊ͜ͷςετίʔυΛ͖͔͚ͬʹQIQTSDʹJTTVFͱͯ͠ใࠂ͞Εɺٞ࿦͕ߦΘΕ·ͨ͠ɻ IUUQTHJUIVCDPNQIQQIQTSDJTTVFT ༨ஊ͜ͷςετίʔυΛ͖͔͚ͬʹ੩తղੳπʔϧ1)14UBOͱ1TBMNʹػೳఏҊ͕ߦΘΕɺ 1)14UBOʹ!NVOP@͞Μ͕࡞੒ͨ͠QVMMSFRVFTU͕࠾༻͞ΕɺϦϦʔε͞Ε·ͨ͠ɻ IUUQTHJUIVCDPNQIQTUBOQIQTUBOTSDQVMM

Slide 17

Slide 17 text

"HFOEB࿈ࡌ֤ճͷςʔϚ ֶश༻ςετ ِཅੑͱِӄੑ ςεταΠζ ςετμϒϧ ςετϐϥϛου 🦁

Slide 18

Slide 18 text

ࣗಈςετͷ৴པੑΛ Ή͠͹Ήݱ৅Λཧղ͢Δ

Slide 19

Slide 19 text

ςετࣗಈԽͱاۀͷۀ੷ͷҼՌؔ܎ IUUQTXXXBNB[PODPKQEQ ςετͷࣗಈԽʹ͓͍ͯɺ*5ύϑΥʔϚϯεͷ༧ଌई౓ͱͳΓ͏Δ ͜ͱ͕൑໌ͨ͠ͷ͸࣍ͷͭ ৴པੑͷߴ͍ࣗಈςετΛඋ͑Δ͜ͱ ։ൃऀओମͰड͚ೖΕςετΛ࡞੒ɾ؅ཧ͠ɺ 
 खݩͷ։ൃ؀ڥͰ؆୯ʹ࠶ݱɾमਖ਼Ͱ͖Δ͜ͱ ʰ-FBOͱ%FW0QTͷՊֶʱQʢ˞༁ΛҰ෦มߋʣ

Slide 20

Slide 20 text

IUUQTXXXBNB[PODPKQEQ ςετʹ߹֨ͨ͠ιϑτ΢ΣΞͰ͋Ε͹ϦϦʔεՄೳɺෆ߹֨Ͱ͋Ε͹ॏେͳ ෆ۩߹͕͋ΔɺͱνʔϜ͕֬৴Ͱ͖ΔΑ͏ͳςετΛ࣮ࢪ͍ͯ͠Δ͜ͱ ޡݕ஌ʢِཅੑGBMTFQPTJUJWFʣ΍ݟಀ͠ʢِӄੑGBMTFOFHBUJWFʣ͕ଟ ͘ɺ৴པੑʹ͚ܽΔςετεΠʔτ͕͋·Γʹ΋ଟ͗͢Δ ৴པ౓ͷߴ͍ςετεΠʔτΛ࡞Γ্͛Δܧଓతͳ౒ྗͱ౤ࢿ͸Ձ஋͕͋Δ ʰ-FBOͱ%FW0QTͷՊֶʱQʢ˞༁ΛҰ෦มߋʣ ৴པੑͷߴ͍ࣗಈςετΛඋ͑Δ͜ͱ

Slide 21

Slide 21 text

ِཅੑͱِӄੑ IUUQTHJIZPKQNBHB[JOFXEQSFTTBSDIJWFWPM

Slide 22

Slide 22 text

ِཅੑͱِӄੑͷύλʔϯ w ِཅੑ w ੬͍ςετ CSJUUMFUFTU GSBHJMFUFTU w ৴པෆೳςετ fl BLZUFTU w ِӄੑ w ۭৼΓ w ΧόϨοδෆ଍ w ςετର৅ϩδοΫͷςετίʔυ΁ͷ࿙Εग़͠

Slide 23

Slide 23 text

// プロダクトコード class Item { // コンストラクタ割愛 tax_amount() { const rate = (this.tax_rate / 100); return (this.price / (1 + rate)) * rate; } } // テストコード it('税込価格から税額を返す', () => { const item = new Item('技評茶', 130, 8); const expected = (130 / (1 + (8 / 100))) * (8 / 100); assert.equal(item.tax_amount(), expected); }); ྫςετର৅ϩδοΫͷςετίʔυ΁ͷ࿙Εग़͠ ԁະຬͷ୺਺͕ൃੜ͢Δ όά͕͋Δ ςετίʔυͷํ΋ಉ͡ϩδοΫͰ ظ଴஋Λܭࢉ͍ͯ͠ΔͷͰ ςετ͕੒ޭͯ͠͠·͏

Slide 24

Slide 24 text

৴པෆೳੑʢ fl BLJOFTTʣ͕ʹ઀ۙ͢Δͱɺςετ͸Ձ஋Λࣦ͍࢝ΊΔ IUUQTXXXPSFJMMZDPKQCPPLT ʰ(PPHMFͷιϑτ΢ΣΞΤϯδχΞϦϯάʱQ

Slide 25

Slide 25 text

"HFOEB࿈ࡌ֤ճͷςʔϚ ֶश༻ςετ ِཅੑͱِӄੑ ςεταΠζ ςετμϒϧ ςετϐϥϛου 🦁

Slide 26

Slide 26 text

ࣗಈςετͱ$*ʹϑΟοτ͢Δ ໌֬ͳςετ෼ྨج४

Slide 27

Slide 27 text

օ͞Μʹ͓࢕͍͠·͢ 🙋🙋🙋 wσʔλϕʔεʹΞΫηε͢Δͷ͸Ϣχοτςετ :FT/P wωοτϫʔΫʹΞΫηε͢Δͷ͸Ϣχοτςετ :FT/P wϑΝΠϧʹΞΫηε͢Δͷ͸Ϣχοτςετ :FT/P wݱࡏ࣌ࠁʹΞΫηε͢Δͷ͸Ϣχοτςετ :FT/P wґଘઌͷΫϥεʹຊ෺Λ࢖͏ͷ͸Ϣχοτςετ :FT/P

Slide 28

Slide 28 text

IUUQTNBSUJOGPXMFSDPNCMJLJ6OJU5FTUIUNM 6OJU5FTUͷ6OJUͬͯԿʁ

Slide 29

Slide 29 text

5FTU4J[FΑΓᐆດ͞ͷগͳ͍෼ྨ

Slide 30

Slide 30 text

IUUQTUFTUJOHHPPHMFCMPHDPNUFTUTJ[FTIUNM 5FTU4J[F

Slide 31

Slide 31 text

4NBMM 
 ʢ୯Ұϓϩηεʣ .FEJVN 
 ʢ୯ҰϚγϯʣ -BSHF 
 ʢ੍໿ͳ͠ʣ 6OJU ൺ཰ େ͍ʹਪ঑ ආ͚͍͕ͨ ͔ͨ͠ͳ͍ͱ͖΋ ࠷ѱ͕ͩ Α͘ݟ͔͚Δ *OUFHSBUJPO ൺ཰ ॻ͚ΔͳΒ ίεύྑ͠ ී௨ Ͱ͖Ε͹ ආ͚͍ͨ && ൺ཰ ݪཧ্ෆՄೳʹ͍͕ۙ খ͍͞γεςϜͳΒՄೳʁ খ͍͞γεςϜ ͳΒՄೳ ී௨͔ͭ $6+ʹߜΓ͍ͨ 5FTU4DPQF 5FTU4J[F 5FTU4DPQFͱ5FTU4J[F

Slide 32

Slide 32 text

4NBMM 
 ʢ୯Ұϓϩηεʣ .FEJVN 
 ʢ୯ҰϚγϯʣ -BSHF 
 ʢ੍໿ͳ͠ʣ 6OJU ൺ཰ େ͍ʹਪ঑ ආ͚͍͕ͨ ͔ͨ͠ͳ͍ͱ͖΋ ࠷ѱ͕ͩ Α͘ݟ͔͚Δ *OUFHSBUJPO ൺ཰ ॻ͚ΔͳΒ ίεύྑ͠ ී௨ Ͱ͖Ε͹ ආ͚͍ͨ && ൺ཰ ݪཧ্ෆՄೳʹ͍͕ۙ খ͍͞γεςϜͳΒՄೳʁ খ͍͞γεςϜ ͳΒՄೳ ී௨͔ͭ $6+ʹߜΓ͍ͨ 5FTU4DPQF 5FTU4J[F 5FTU4DPQFͱ5FTU4J[F ίεύྑ͠ ίεύѱ͠

Slide 33

Slide 33 text

"HFOEB࿈ࡌ֤ճͷςʔϚ ֶश༻ςετ ِཅੑͱِӄੑ ςεταΠζ ςετμϒϧ ςετϐϥϛου 🦁

Slide 34

Slide 34 text

஧࣮ੑͱܾఆੑͷ τϨʔυΦϑΛཧղ͢Δ

Slide 35

Slide 35 text

IUUQYVOJUQBUUFSOTDPN5FTU%PVCMFIUNM 5FTU%PVCMFࣗಈςετ༻ͷِ෺

Slide 36

Slide 36 text

IUUQYVOJUQBUUFSOTDPN5FTU%PVCMFIUNM 5FTU%PVCMFͷ෼ྨʢ࿈ࡌͷϖʔδʹऩ·Βͣʜʜʣ

Slide 37

Slide 37 text

ςετμϒϧͷར఺ͱ஫ҙ఺ IUUQTXXXBNB[PODPKQEQ w ར఺ w ςετ͠ʹ͍͘΋ͷΛςετՄೳʹ͢Δ w ςετͷ଎౓ͱܾఆੑΛ޲্ͤ͞Δ w ஫ҙ఺ w ςετ͕੬͘ͳΓɺมߋΛ๦͛Δʢར఺ͷཪฦ͠ʣ w ςετͷِӄੑΛট͘ʢࣗ࡞ࣗԋςετʣ

Slide 38

Slide 38 text

"HFOEB࿈ࡌ֤ճͷςʔϚ ֶश༻ςετ ِཅੑͱِӄੑ ςεταΠζ ςετμϒϧ ςετϐϥϛου 🦁

Slide 39

Slide 39 text

ࣗಈςετͷ৴པੑΛ த௕ظతʹอͭ ࠷దͳόϥϯε

Slide 40

Slide 40 text

Ϣχοτ ΠϯςάϨʔγϣϯ && ίετ ஧࣮ੑ ଎౓ ςετέʔε਺ ߴ ௿ ௿ ߴ ܾఆੑ ςετϐϥϛου

Slide 41

Slide 41 text

ςετϐϥϛουͱΞΠεΫϦʔϜίʔϯΞϯνύλʔϯ IUUQTXBUJSNFMPOCMPHJOUSPEVDJOHUIFTPGUXBSFUFTUJOHJDFDSFBNDPOF

Slide 42

Slide 42 text

ࠞཚ͸ղऍͷϒϨ͔Βੜ͕ͪ͡

Slide 43

Slide 43 text

͜Ε·Ͱͷ஌ݟΛ·ͱΊΔͱ ֶश༻ςετ ِཅੑͱِӄੑ ςεταΠζ ςετμϒϧ ςετϐϥϛου 🦁 🦁 🦁 🦁

Slide 44

Slide 44 text

4NBMM .FEJVN -BSHF ίετ ஧࣮ੑ ଎౓ ςετέʔε਺ ߴ ௿ ௿ ߴ ܾఆੑ ·ͱΊςετμϒϧͰαΠζμ΢ϯͯ͠ɺ֤αΠζΛϐϥϛουܕʹ഑ஔ͠ɺςετશମͷ৴པੑΛҡ࣋͢Δ ςετμϒϧ ςετμϒϧ ςετ༰қੑઃܭ υϝΠϯઃܭ

Slide 45

Slide 45 text

͓ΘΓʹ

Slide 46

Slide 46 text

ࣦ৬ͷةػྑॻ͗͢Δ IUUQTCPPLNZOBWJKQFDQSPEVDUTEFUBJMJE

Slide 47

Slide 47 text

ࣦ৬ͷةػ͍͔ʹ΋ࢲͷݴ͍ͦ͏ͳ͜ͱΛݴ͏"* IUUQTUXJUUFSDPNLBXBTJNBTUBUVT

Slide 48

Slide 48 text

͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ 📷🙆 🙆 'PSLXFMMจԽࡇ@"