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

Generative Programming in Swift

Generative Programming in Swift

JSON Schema + APIKit Generator
https://github.com/kaneshin/genkit

A75c909334d4dc6c7dca7bd915eebdbf?s=128

Shintaro Kaneko

August 20, 2016
Tweet

Transcript

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

  2. @kaneshin (Shintaro Kaneko) - Principal Engineer / Manager - Gopher,

    Vimmer, Photographer, Mathematician
  3. None
  4. Unleashing the real power of Core Data with the elegance

    and safety of Swift
  5. ੜ੒తϓϩάϥϛϯά Generative Programming

  6. ࣮ફ͍ͯ͠Δਓ

  7. Generative Programming - Generics struct Something<T> { let with: T

    }
  8. Generative Programming - Generics struct Something<T> { let with: T

    }
  9. ࣮ફ͍ͯ͠Δਓ

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

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

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

    ੜ੒తϓϩάϥϛϯάͷҰछ
  13. Generics Programming

  14. "Dynamic, highly parameterized software is harder to understand and build

    than more static software." (Gang of Four 1995:21)
  15. 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
  16. ੜ੒తϓϩάϥϛϯά: Generative programming δΣωϦοΫͳΫϥεɺϓϩτλΠϓϕʔεɺςϯϓϨʔτɺΞε ϖΫτɺίʔυੜ੒ͳͲͷٕ๏Λ࢖ͬͯιʔείʔυ࡞੒ΛࣗಈԽ ͠ɺϓϩάϥϚͷੜ࢈ੑΛ޲্ͤ͞ΔϓϩάϥϛϯάͷελΠϧͰ ͋Δɻ ιϑτ΢ΣΞίϯϙʔωϯτͳͲͷίʔυ࠶ར༻ͷٕ๏ͱ΋࿈ܞ͠ ͯ࢖༻͞ΕΔɻ

  17. Code Generation

  18. JSON Hyper Schema + HTTP Request

  19. JSON Hyper Schema Swagger prmd

  20. HTTP Request Alamofire APIKit

  21. 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
  22. Thank you Credit: NASA Earth Observatory/NOAA NGDC