Slide 1

Slide 1 text

Generative Programming in Swift Presented by @kaneshin 08/20/2016 iOSDC

Slide 2

Slide 2 text

@kaneshin (Shintaro Kaneko) - Principal Engineer / Manager - Gopher, Vimmer, Photographer, Mathematician

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Unleashing the real power of Core Data with the elegance and safety of Swift

Slide 5

Slide 5 text

ੜ੒తϓϩάϥϛϯά Generative Programming

Slide 6

Slide 6 text

࣮ફ͍ͯ͠Δਓ

Slide 7

Slide 7 text

Generative Programming - Generics struct Something { let with: T }

Slide 8

Slide 8 text

Generative Programming - Generics struct Something { let with: T }

Slide 9

Slide 9 text

࣮ફ͍ͯ͠Δਓ

Slide 10

Slide 10 text

ੜ੒తϓϩάϥϛϯά ͱ͸ʁ

Slide 11

Slide 11 text

ੜ੒తϓϩάϥϛϯά: Generative programming δΣωϦοΫͳΫϥεɺϓϩτλΠϓϕʔεɺςϯϓϨʔτɺΞε ϖΫτɺίʔυੜ੒ͳͲͷٕ๏Λ࢖ͬͯιʔείʔυ࡞੒ΛࣗಈԽ ͠ɺϓϩάϥϚͷੜ࢈ੑΛ޲্ͤ͞ΔϓϩάϥϛϯάͷελΠϧͰ ͋Δɻ ιϑτ΢ΣΞίϯϙʔωϯτͳͲͷίʔυ࠶ར༻ͷٕ๏ͱ΋࿈ܞ͠ ͯ࢖༻͞ΕΔɻ

Slide 12

Slide 12 text

ੜ੒తϓϩάϥϛϯά: Generative programming δΣωϦοΫͳΫϥεɺϓϩτλΠϓϕʔεɺςϯϓϨʔτɺΞε ϖΫτɺίʔυੜ੒ͳͲͷٕ๏Λ࢖ͬͯιʔείʔυ࡞੒ΛࣗಈԽ ͠ɺϓϩάϥϚͷੜ࢈ੑΛ޲্ͤ͞ΔϓϩάϥϛϯάͷελΠϧͰ ͋Δɻ ιϑτ΢ΣΞίϯϙʔωϯτͳͲͷίʔυ࠶ར༻ͷٕ๏ͱ΋࿈ܞ͠ ͯ࢖༻͞ΕΔɻ δΣωϦΫεϓϩάϥϛϯά΋ ੜ੒తϓϩάϥϛϯάͷҰछ

Slide 13

Slide 13 text

Generics Programming

Slide 14

Slide 14 text

"Dynamic, highly parameterized software is harder to understand and build than more static software." (Gang of Four 1995:21)

Slide 15

Slide 15 text

Generics are a trade off between programmer time, compilation time, and execution time. See https://github.com/golang/proposal/blob/master/design/15292-generics.md

Slide 16

Slide 16 text

ੜ੒తϓϩάϥϛϯά: Generative programming δΣωϦοΫͳΫϥεɺϓϩτλΠϓϕʔεɺςϯϓϨʔτɺΞε ϖΫτɺίʔυੜ੒ͳͲͷٕ๏Λ࢖ͬͯιʔείʔυ࡞੒ΛࣗಈԽ ͠ɺϓϩάϥϚͷੜ࢈ੑΛ޲্ͤ͞ΔϓϩάϥϛϯάͷελΠϧͰ ͋Δɻ ιϑτ΢ΣΞίϯϙʔωϯτͳͲͷίʔυ࠶ར༻ͷٕ๏ͱ΋࿈ܞ͠ ͯ࢖༻͞ΕΔɻ

Slide 17

Slide 17 text

Code Generation

Slide 18

Slide 18 text

JSON Hyper Schema + HTTP Request

Slide 19

Slide 19 text

JSON Hyper Schema Swagger prmd

Slide 20

Slide 20 text

HTTP Request Alamofire APIKit

Slide 21

Slide 21 text

Code Generation • Demo (If enough time to introduce) • https://github.com/kaneshin/genkit (golang, ver. 0.0.1) • JSON Hyper Schema - prmd • HTTP Request - APIKit

Slide 22

Slide 22 text

Thank you Credit: NASA Earth Observatory/NOAA NGDC