$30 off During Our Annual Pro Sale. View Details »

A simple plan

Chris Vannoy
September 14, 2016

A simple plan

Exploring various languages and framework to build a simple web API. Bonus: Intense pluggable for Indy's PLIBMTTBHGATY

Chris Vannoy

September 14, 2016
Tweet

More Decks by Chris Vannoy

Other Decks in Technology

Transcript

  1. A Simple Plan
    Building a small web API in something
    new

    View Slide

  2. The Reason
    I'm hosting a get-together in a few weeks* for folks
    to experiment with non-typical programming languages.
    I wanted to experiment as well.
    * - More on this later.

    View Slide

  3. The API
    GET /attendees - All the attendees
    POST /attendees - Create an attendee
    GET /attendee/:id - Get a single attendee
    GET /languages - Get all the languages
    GET /languages/:lang - All the attendees interested

    View Slide

  4. The options
    » Crystal & Kemal
    » Rust & Iron
    » Swift & Vapor
    » A few other attempts in Elixir, Haskell ... but
    let's not talk about those

    View Slide

  5. Crystal
    It's like compiled, statically-typed Ruby. With type-
    inference.
    Most Ruby exercism solutions can move over with just
    a few tweaks.
    Love.
    puts "Hello World!"

    View Slide

  6. Kemal
    Sinatra, but in Crystal.
    require "kemal"
    get "/" do
    "Hello World!"
    end
    This might become a theme.

    View Slide

  7. Downfall
    » This thing is young and everything is in a
    perpetual state of semi-broken right now.
    » As a Rubyist, writing it really isn't a stretch at
    all.
    » Did I mention everything is kinda broken?

    View Slide

  8. Rust
    A systems programming language sponsored by Mozilla.
    Also statically-typed and compiled with type-
    inference.
    fn main() {
    println!("Hello World!");
    }

    View Slide

  9. Iron
    Um. Kinda Sinatra in Rust.
    extern crate iron;
    use iron::prelude::*;
    use iron::status;
    fn main() {
    fn hello_world(_: &mut Request) -> IronResult {
    Ok(Response::with((status::Ok, "Hello World!")))
    }
    let _server = Iron::new(hello_world).http("localhost:3000").unwrap();
    println!("On 3000");
    }

    View Slide

  10. Downfall
    » Docs. Ugh. Docs, man.
    » Big, big jump to persistence ... because, docs.
    » unwrap() literally everywhere.

    View Slide

  11. Swift
    Not just for phones! Compiled, type-inference ... but
    closures!
    print("Hello, world!")

    View Slide

  12. Vapor
    A web framework for running Swift on the server -
    including Linux servers. And Heroku!
    import Vapor
    import HTTP
    let drop = Droplet()
    drop.get("hello") { request in
    return "Hello, world!"
    }
    let port = drop.config["app", "port"]?.int ?? 80
    drop.serve()

    View Slide

  13. Bonuses
    » Better docs than most.
    » Built-in ORM - with relationships!
    » Built-in deployment pipeline to Heroku
    » Type-safe routing(!)

    View Slide

  14. Downsides
    » Moving target
    » vapor new includes a lot of garbage
    » MySQL only at the moment (unless you roll your
    own)

    View Slide

  15. The Plug

    View Slide

  16. PLIBMTTBHGATY

    View Slide

  17. Programming

    View Slide

  18. Languages

    View Slide

  19. I've

    View Slide

  20. Been

    View Slide

  21. Meaning

    View Slide

  22. To

    View Slide

  23. Try

    View Slide

  24. But

    View Slide

  25. Haven't

    View Slide

  26. Gotten

    View Slide

  27. Around

    View Slide

  28. To

    View Slide

  29. Yet.

    View Slide

  30. September 24, 2016
    The Iron Yard
    475 East Market Street
    Lite Breakfast & Lunch provided

    View Slide


  31. View Slide

  32. Thanks!

    View Slide