Slide 1

Slide 1 text

!QJDUJOZ 1SF4DBMB.BUTVSJ -JHIUOJOH5BML 4DBMBॳ৺ऀ͸ ̋̋̋ʹϝιουΛ ੜ΍͍ͨ͠ͱߟ͑ͨ

Slide 2

Slide 2 text

2020.08.30 2

Slide 3

Slide 3 text

2020.08.30 3 4DBMBະܦݧͰΞϧϓೖࣾ 4DBMBྺ೥൒

Slide 4

Slide 4 text

2020.02.16 4 ςΫϊϩδʔͷྗͰ اۀͷܦࡁ׆ಈΛ ࢧ͑ɺ֦ு͢Δɻ

Slide 5

Slide 5 text

2020.08.30 5 ʮαϒεΫϦϓγϣϯϏδωεʹ͓͚Δ
 શۀ຿ΛҰؾ௨؏ͰΧόʔʯ
 ɾϓϥΠγϯά ɾ঎඼؅ཧ
 ɾސ٬؅ཧ ɾܖ໿؅ཧ ɾ੥ٻॻͷൃߦˍૹ෇
 ɾΫϨδοτΧʔυܾࡁ
 ɾ֤छσʔλ෼ੳ ɾ࢓༁ొ࿥ɺձܭॲཧ ɹɹɹɹɹɹɹɹɹɹɹetc…

Slide 6

Slide 6 text

2020.02.16 6

Slide 7

Slide 7 text

2020.02.16 7 %%%

Slide 8

Slide 8 text

2020.08.30 8 Ξϧϓɺ%%%΍ͬͯΔΑ ɹɹɹɹɹɹɹ͸αϒεΫϦϓγϣϯྖҬͷ4BB4 ෳࡶ౓͕ඇৗʹߴ͍ ͦͷͨΊ։ൃॳظ͔Β%%%Λಋೖ શࣾతʹ࣮ફ

Slide 9

Slide 9 text

2020.08.30 9 ͔͜͜Βࠓ೔ͷ࿩ ˞ίʔυ͸αϯϓϧͰ͢

Slide 10

Slide 10 text

2020.08.30 10 ར༻υϝΠϯ ੥ٻର৅ͱͳΔར༻ظؒΛந৅Խͨ͠ར༻ΦϒδΣΫτ 70 case class Availability ( startAt: LocalDate, // ར༻։࢝೔ endAt: LocalDate, // ར༻ऴྃ೔ billingDate: LocalDate, // ੥ٻ೔ status: AvailabilityStatus // εςʔλε )

Slide 11

Slide 11 text

2020.08.30 11 ྫɿܞଳճઢͷܖ໿ ֤݄ͷར༻͝ͱʹ੥ٻ͕ൃੜ͢Δ ೥ܖ໿ͰճઢΛܖ໿͢Δͱɺϲ݄෼ͷར༻͕ੜ͡Δ ੥ٻ͕׬ྃ͢Δͱର৅ͷར༻ͷঢ়ଶ͕ ʮະ੥ٻʯ͔Βʮ੥ٻࡁΈʯʹͳΔ

Slide 12

Slide 12 text

2020.08.30 12 ܖ໿υϝΠϯ ܖ໿Λந৅Խͨ͠ܖ໿ΦϒδΣΫτ &OUJUZ ͸ར༻Λෳ਺࣋ͭ case class Contract ( id: ContractId, // ܖ໿ID availabilities: Seq[Availability], // ར༻ status: ContractStatus, // εςʔλε pricing: …, // ྉۚઃఆ … )

Slide 13

Slide 13 text

2020.08.30 13 ະ੥ٻͷར༻ΛٻΊΔ ར༻ͷεςʔλε͕ະ੥ٻͳ΋ͷ case class Contract (…) { def unBilledAvailabilities: Seq[Availability] = availabilities.filter(_.status = UnBilled) // ະ੥ٻͷར༻ }

Slide 14

Slide 14 text

2020.08.30 14 ࣍ճͷ੥ٻ೔ΛٻΊΔ ະ੥ٻͷར༻ͷ͏ͪɺ੥ٻ೔͕࠷΋͍ۙ΋ͷ case class Contract (…) { def nextBillingDate(today: LocalDate): LocalDate = availabilities.filter(_.status = UnBilled) // ະ੥ٻͷར༻Ͱ .filter(_.billingDate > today) // ੥ٻ೔͕ࠓ೔ΑΓະདྷͰ .minBy(_.billingDate.toEpochDay) // ੥ٻ೔͕࠷΋աڈͷ΋ͷ .billingDate }

Slide 15

Slide 15 text

2020.08.30 15 ࠓ೔੥ٻ͢Δར༻ΛٻΊΔ ະ੥ٻͷར༻ͷ͏ͪɺ੥ٻ೔͕ࠓ೔ͷ΋ͷ case class Contract (…) { def shouldCreateBilling(today: LocalDate): Seq[Availability] = availabilities.filter(_.status = UnBilled) // ະ੥ٻͷར༻Ͱ .filter(_.billingDate = today) // ੥ٻ೔͕ࠓ೔ }

Slide 16

Slide 16 text

2020.08.30 16

Slide 17

Slide 17 text

2020.08.30 17 ͍ͭ΋ಉ͡pMUFSͯ͠ͳ͍ʁ

Slide 18

Slide 18 text

2020.08.30 18 ϦϑΝΫλ ར༻͕ܖ໿಺ʹ͔͠ొ৔͠ͳ͍ͳΒ͜ΕͰ΋͍͍͕ʜ case class Contract (…) { def unBilledAvailabilities: Seq[Availability] = availabilities.filter(_.status = UnBilled) // ະ੥ٻͷར༻ def nextBillingDate(today: Localdate): LocalDate = unBilledAvailabilities .filter(_.billingDate > today) // ੥ٻ೔͕ࠓ೔ΑΓະདྷͰ .minBy(_.billingDate.toEpochDay) // ੥ٻ೔͕࠷΋աڈͷ΋ͷ .billingDate }

Slide 19

Slide 19 text

2020.08.30 19 ੥ٻΛൃੜͤ͞Δ ੥ٻίϯςΩετͰར༻Λ৮ͬͨΓ΋͢Δ case class Billing(…) object Billing { def createBilling(today: LocalDate, contract: Contract): Billing = { val availabilities = contract.shouldCreateBilling(today) val billing = ??? // TODO: ར༻Λ࢖ͬͯ੥ٻΛ࡞Δ } }

Slide 20

Slide 20 text

2020.08.30 20 ͱ͍͏Θ͚Ͱ

Slide 21

Slide 21 text

2020.08.30 21 4FRʹϝιουΛੜ΍͍ͨ͠

Slide 22

Slide 22 text

!QJDUJOZ 1SF4DBMB.BUTVSJ -JHIUOJOH5BML 4DBMBॳ৺ऀ͸ ̋̋̋ʹϝιουΛ ੜ΍͍ͨ͠ͱߟ͑ͨ

Slide 23

Slide 23 text

!QJDUJOZ 1SF4DBMB.BUTVSJ -JHIUOJOH5BML 4DBMBॳ৺ऀ͸ ̋̋̋ʹϝιουΛ ੜ΍͍ͨ͠ͱߟ͑ͨ Seq

Slide 24

Slide 24 text

2020.08.30 24 4FRʹϝιουΛੜ΍͍ͨ͠ ҙຯΛ࣋ͬͨίϨΫγϣϯૢ࡞ʹ໋໊͍ͨ͠ ϩδοΫͷݟ௨͠ΛΑ͍ͨ͘͠ *%&ͷίʔυิ׬Λޮ͔͍ͤͨ

Slide 25

Slide 25 text

2020.08.30 25 ʮͦΕJNQMJDJUͰͰ͖ΔΑʯ

Slide 26

Slide 26 text

2020.08.30 26 ☺

Slide 27

Slide 27 text

2020.08.30 27 ʮ͓͢͢Ί͠ͳ͍͚Ͳʯ

Slide 28

Slide 28 text

2020.08.30 28

Slide 29

Slide 29 text

2020.08.30 29 JNQMJDJU 4FRʹϝιουΛੜ΍ͤΔ͕ʜ ఆٛ͢Δ৔ॴ͕೉͍͠ υϝΠϯ૚ʁ Ͳ͜Ͱఆٛ͞Ε͍ͯΔ͔ ݺͼग़͠ଆ͔Β Θ͔Γʹ͍͘ υϝΠϯ஌ࣝ͸JNQMJDJUͨ͘͠ͳ͍

Slide 30

Slide 30 text

2020.08.30 30 ͡Ό͋Ͳ͏͢Δ͔

Slide 31

Slide 31 text

2020.08.30 31 υϝΠϯ஌ࣝ͸ܕʹ͠Α͏

Slide 32

Slide 32 text

2020.08.30 32 ར༻ͷίϨΫγϣϯΦϒδΣΫτԽ ܖ໿͸ར༻ίϨΫγϣϯΦϒδΣΫτΛ࣋ͭΑ͏ʹͳΔ case class Availabilities( values: Seq[Availability] ) case class Contract ( id: ContractId, availabilities: Availabilities, // ίϨΫγϣϯΦϒδΣΫτΛ࣋ͭ status: ContractStatus, pricing: …, )

Slide 33

Slide 33 text

2020.08.30 33 ະ੥ٻͷར༻ΛٻΊΔ ར༻ͷυϝΠϯ஌ࣝͱ࣮ͯ͠૷Ͱ͖Δ case class Availabilities (…) { def unBilledAvailabilities: Availabilities = Availabilities(availabilities.filter(_.status = UnBilled)) }

Slide 34

Slide 34 text

2020.08.30 34 ੥ٻΛൃੜͤ͞Δ ར༻ίϨΫγϣϯܕΛૢ࡞͢Ε͹Α͘ͳΔ case class Billing(…) object Billing { def createBilling(today: LocalDate, contract: Contract): Billing = { val availabilities: Availabilities = contract.shouldCreateBilling(today) // AvailabilitesܕΛฦ͢ val billing = ??? // TODO: ར༻Λ࢖ͬͯ੥ٻΛ࡞Δ } }

Slide 35

Slide 35 text

2020.08.30 35 ίϨΫγϣϯΦϒδΣΫτͷར఺ ϝιου͕ੜ΍ͤΔ ܕͷදݱྗ͕࢖͑Δ ϦϑΝΫλ͠΍͍͢ 'JOE6TBHFͰӨڹൣғ͕Θ͔Γ΍͍͢

Slide 36

Slide 36 text

2020.08.30 36 5JQT ඪ४తͳૢ࡞͸USBJUͰܧঝͰ͖ΔΑ͏ʹ͓ͯ͘͠ͱศར trait class CustomCollection[A] { val values: Seq[A] def isEmpty: Boolean = values.isEmpty def nonEmpty: Boolean = values.nonEmpty def length: Boolean = values.length … }

Slide 37

Slide 37 text

2020.08.30 37 ؾ෇͖ 4FRʹϝιουΛੜ΍͍ͨ͠ͱߟ͑ͨ Ͱ΋ɺ4FRʹϝιουΛੜ΍͢ͷ͸͋͘·Ͱखஈ ͳͥͦ͏ߟ͑ͨͷ͔ɺཧ༝ΛݴޠԽ͢Δ͜ͱ͕େࣄ ผͷखஈͰ໨త͕ୡ੒Ͱ͖Δ͜ͱ΋͋Δ

Slide 38

Slide 38 text

2020.08.30 38 ·ͱΊ 4FRʹϝιουΛੜ΍ͨ͘͠ͳͬͨ ίϨΫγϣϯ͕υϝΠϯϩδοΫΛ࣋ͭ͜ͱ͕͋Δ υϝΠϯϩδοΫΛ࣋ͭ΋ͷ͸ܕͱͯ͠ఆٛ͢Δͷ͕Α͍ *%&ͷԸܙ͸େ͖͍

Slide 39

Slide 39 text

2020.08.30 39 4DBMBΤϯδχΞ࠾༻த

Slide 40

Slide 40 text

2020.08.30 40