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

From iOS- to Vapor Developer (Øredev)

From iOS- to Vapor Developer (Øredev)

Diving into server-side Swift can seem straightforward at first if one knows the programming language, but it might be harder than you think since it involves developing on a new platform. I will walk you through my journey coming from iOS into Vapor, what challenges I faced, and which strengths I had coming from the iOS platform. I will talk about how these challenges can be overcome and I will share my experiences after working with Vapor in production for 6 months.

Talk given at Øredev 2017 on the 9th of November 2017.

Steffen D. Sommer

November 09, 2017
Tweet

More Decks by Steffen D. Sommer

Other Decks in Programming

Transcript

  1. From iOS- to Vapor developer
    @steffendsommer

    View Slide

  2. View Slide

  3. View Slide

  4. View Slide

  5. Pla$orm support for all Apple
    pla*orms as well as Linux

    View Slide

  6. View Slide

  7. View Slide

  8. Swi$ on the server

    View Slide

  9. View Slide

  10. !

    View Slide


  11. View Slide

  12. !"

    View Slide

  13. View Slide

  14. !"

    View Slide

  15. !

    View Slide

  16. • Swi%
    • Fast
    • Code share
    • More fullstack developers
    • Xcode
    • Big community
    • Be part of the development

    View Slide

  17. Swi$ on the server

    View Slide

  18. View Slide

  19. !

    View Slide

  20. View Slide

  21. View Slide


  22. View Slide

  23. !

    View Slide

  24. • New language
    • New package manager
    • New framework
    • Xcode
    • Limited hos9ng op9ons
    • Less libraries compared to other web frameworks

    View Slide

  25. Programming languages in the
    making

    View Slide

  26. • JavaScript (1995): 22 years
    • Java (1996): 21 years
    • Ruby (1996): 21 years
    • Swi$ (2014): 3 years

    View Slide

  27. Web frameworks in the making 1
    1 Since their version 1.0 release.

    View Slide

  28. • Spring MVC (2002): 15 years
    • Ruby on Rails (2004): 13 years
    • Express (2010): 7 years
    • Kitura/Perfect/Vapor (2016): 1 year

    View Slide

  29. The future is bright for server-side
    Swi/

    View Slide

  30. View Slide

  31. Kitura
    Perfect
    Vapor

    View Slide

  32. Kitura
    Perfect
    Vapor

    View Slide

  33. Kitura
    Perfect
    Vapor

    View Slide

  34. View Slide

  35. Hi, my name is
    Steffen D. Sommer
    !

    View Slide

  36. Steffen iOS

    View Slide

  37. Steffen

    iOS Swi*

    View Slide

  38. Swi$ as a language, not iOS as a
    pla/orm

    View Slide

  39. View Slide

  40. import Vapor
    let drop = try Droplet()
    drop.get("hello") { req in
    return "Hello, world."
    }
    try drop.run()

    View Slide

  41. View Slide

  42. View Slide

  43. iOS != Vapor

    View Slide

  44. iOS != Vapor
    Number of users

    View Slide

  45. !
    • 1

    View Slide

  46. • It's all about the requests

    View Slide

  47. iOS != Vapor
    Performance

    View Slide

  48. !
    • Not an issue

    View Slide

  49. • Users do not want to wait for requests to return

    View Slide

  50. • Users do not want to wait for requests to return
    • More performance = more money

    View Slide

  51. iOS != Vapor
    Crash handling

    View Slide

  52. !
    • "We'll fix it in the next app update"

    View Slide

  53. • Fix it now

    View Slide

  54. iOS != Vapor
    Pla$orms

    View Slide

  55. !
    • One pla(orm to rule them all

    View Slide

  56. • macOS + Linux

    View Slide

  57. iOS != Vapor
    Foundation

    View Slide

  58. !

    !

    View Slide


  59. !

    View Slide

  60. iOS != Vapor
    The Xcode project file

    View Slide

  61. !
    • Merge madness

    View Slide

  62. • .. what file?

    View Slide

  63. iOS != Vapor
    Third party frameworks

    View Slide

  64. !
    • Which one to pick?

    View Slide

  65. • Roll out your own

    View Slide

  66. iOS != Vapor
    User Interfaces

    View Slide

  67. !
    • Storyboards and auto layout

    View Slide

  68. • HTML, CSS, JavaScript & template languages

    View Slide

  69. iOS != Vapor
    Persistence

    View Slide

  70. !
    • Used to some extent

    View Slide

  71. • Used heavily

    View Slide

  72. iOS != Vapor
    Security

    View Slide

  73. !
    • Mostly handled by the OS

    View Slide

  74. • Needs to be taken care of

    View Slide

  75. iOS != Vapor
    Consumers

    View Slide

  76. !
    • None

    View Slide

  77. • "Hey backend dev, I can't get this endpoint to work.."

    View Slide

  78. iOS != Vapor
    Releasing

    View Slide

  79. !
    • iTunes Connect

    View Slide

  80. • Deploying

    View Slide

  81. Tips to overcome these challenges

    View Slide

  82. Tip #1
    RTFM & get involved

    View Slide

  83. Tip #2
    Learn about databases

    View Slide

  84. Tip #3
    Consider when to use Foundation

    View Slide

  85. Tip #4
    Start repor)ng

    View Slide

  86. Tip #5
    Setup CI or a VM

    View Slide

  87. Tip #6
    Write (API) tests

    View Slide

  88. Tip #7
    Document your APIs

    View Slide

  89. Tip #8
    Use security packages

    View Slide

  90. Tip #9
    U"lize the template language

    View Slide

  91. Tip #10
    Use Vapor Cloud

    View Slide

  92. The last 10 months in hindsight

    View Slide

  93. Challenges

    View Slide

  94. • Lots of moving targets (Swi2, Vapor, Vapor Cloud)

    View Slide

  95. • Lots of moving targets (Swi3, Vapor, Vapor Cloud)
    • Overhead in crea,ng and maintaining open source packages

    View Slide

  96. • Lots of moving targets (Swi3, Vapor, Vapor Cloud)
    • Overhead in crea?ng and maintaining open source packages
    • Lack of documenta.on

    View Slide

  97. • Lots of moving targets (Swi3, Vapor, Vapor Cloud)
    • Overhead in crea?ng and maintaining open source packages
    • Lack of documenta?on
    • Outdated resources

    View Slide

  98. • Lots of moving targets (Swi3, Vapor, Vapor Cloud)
    • Overhead in crea?ng and maintaining open source packages
    • Lack of documenta?on
    • Outdated resources
    • Few experts

    View Slide

  99. • Lots of moving targets (Swi3, Vapor, Vapor Cloud)
    • Overhead in crea?ng and maintaining open source packages
    • Lack of documenta?on
    • Outdated resources
    • Few experts
    • Lots of boilerplate

    View Slide

  100. • Lots of moving targets (Swi3, Vapor, Vapor Cloud)
    • Overhead in crea?ng and maintaining open source packages
    • Lack of documenta?on
    • Outdated resources
    • Few experts
    • Lots of boilerplate
    • Linux quirkiness

    View Slide

  101. How things have improved

    View Slide

  102. • Updates are slowing down (Swi2 and Vapor)

    View Slide

  103. • Updates are slowing down (Swi3 and Vapor)
    • Vapor Cloud reached 1.0 and is stable

    View Slide

  104. • Updates are slowing down (Swi3 and Vapor)
    • Vapor Cloud reached 1.0 and is stable
    • We don't create as many open source packages anymore

    View Slide

  105. • Updates are slowing down (Swi3 and Vapor)
    • Vapor Cloud reached 1.0 and is stable
    • We don't create as many open source packages anymore
    • Documenta*on is improving

    View Slide

  106. • Updates are slowing down (Swi3 and Vapor)
    • Vapor Cloud reached 1.0 and is stable
    • We don't create as many open source packages anymore
    • DocumentaDon is improving
    • More and more resources

    View Slide

  107. • Updates are slowing down (Swi3 and Vapor)
    • Vapor Cloud reached 1.0 and is stable
    • We don't create as many open source packages anymore
    • DocumentaDon is improving
    • More and more resources
    • Bigger community - more experts

    View Slide

  108. • Updates are slowing down (Swi3 and Vapor)
    • Vapor Cloud reached 1.0 and is stable
    • We don't create as many open source packages anymore
    • DocumentaDon is improving
    • More and more resources
    • Bigger community - more experts
    • Less boilerplate

    View Slide

  109. • Updates are slowing down (Swi3 and Vapor)
    • Vapor Cloud reached 1.0 and is stable
    • We don't create as many open source packages anymore
    • DocumentaDon is improving
    • More and more resources
    • Bigger community - more experts
    • Less boilerplate
    • Swi$ on Linux is more mature

    View Slide

  110. Our results

    View Slide

  111. • 25+ customer projects

    View Slide

  112. • 25+ customer projects
    • 30+ open source packages created

    View Slide

  113. • 25+ customer projects
    • 30+ open source packages
    • Hos$ng fees are going down

    View Slide

  114. • 25+ customer projects
    • 30+ open source packages
    • Hos7ng fees are going down
    • More and more of our iOS developers starts to catch up

    View Slide

  115. • 25+ customer projects
    • 30+ open source packages
    • Hos7ng fees are going down
    • More and more of our iOS developers starts to catch up
    • We develop faster

    View Slide

  116. • 25+ customer projects
    • 30+ open source packages
    • Hos7ng fees are going down
    • More and more of our iOS developers starts to catch up
    • We develop faster
    • Less bugs than before making the switch

    View Slide

  117. No major issues since we made the
    switch

    View Slide

  118. Resources
    • Vapor docs: h-ps:/
    /docs.vapor.codes/2.0/
    • Vapor Slack: h-p:/
    /vapor.team
    • Vapor @Nodes: h-ps:/
    /github.com/nodes-vapor
    • SwiBConf '17 @gtranchedone: h-ps:/
    /www.youtube.com/
    watch?v=IuW_hLCsIeQ

    View Slide