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

API First (ZendCon 2013)

API First (ZendCon 2013)

A recent theme among web creators is the notion of mobile first. It's the idea that we should design first for the mobile experience. Throw in the concepts of progressive enhancement and responsive design, and we have some excellent approaches to interface design and development. But where does that leave the overall software design? How do we get all the data to the interface and manipulate it without building a lot of back-end scripts to drive the various front-end incarnations? A centralized API will solve these problems, but we're often scrambling to implement the "mobile first" strategy on top of existing code. For good web software design, it's time to start thinking in terms of API first. In this talk, Ben Ramsey pulls from his experience making APIs to discuss how you can begin projects with an API-centric mindset and use this to your advantage to deliver software quickly, more efficiently, and with higher quality. If you already have projects that began life without APIs, then have no fear. Ben will also share how to use the same principles to convert existing web applications to API-backed software with some elbow grease, of course.

Ben Ramsey
PRO

October 10, 2013
Tweet

More Decks by Ben Ramsey

Other Decks in Programming

Transcript

  1. API First
    Ben Ramsey

    View Slide

  2. View Slide

  3. View Slide

  4. 6 billion mobile subscriptions globally

    View Slide

  5. 6 BILLION!!!

    View Slide

  6. View Slide

  7. View Slide

  8. Website
    MVC Templates
    Static Assets
    Database

    View Slide

  9. 6 BILLION!!!

    View Slide

  10. Website & Mobile
    MVC
    Templates
    Static Assets
    Database
    Mobile
    Templates
    Separate Mobile
    MVC Templates
    Static Assets
    Database
    Website & Mobile
    MVC Templates
    Static Assets
    Database
    Mobile
    Templates
    Mobi
    MVC

    View Slide

  11. Mobile
    MVC Templates
    Static Assets
    Website
    MVC Templates
    Static Assets
    Database

    View Slide

  12. View Slide

  13. Mobile
    MVC Templates
    Static Assets
    Website
    MVC Templates
    Static Assets
    Database
    Native App API
    Native App

    View Slide

  14. View Slide

  15. Mobile
    MVC Templates
    Static Assets
    Website
    MVC Templates
    Static Assets
    Database
    Native App API
    Native App

    View Slide

  16. Mobile
    MVC Templates
    Static Assets
    Website
    MVC Templates
    Static Assets
    Database
    Native App API
    Native App

    View Slide

  17. Mobile
    MVC Templates
    Static Assets
    Website
    MVC Templates
    Static Assets
    Database
    Native App API
    Native App

    View Slide

  18. Mobile
    MVC Templates
    Static Assets
    Website
    MVC Templates
    Static Assets
    Database
    Native App API
    Native App

    View Slide

  19. View Slide

  20. “A big ball of mud is haphazardly structured, sprawling,
    sloppy, duct-tape and bailing wire, spaghetti code jungle.
    We’ve all seen them. These systems show unmistakable
    signs of unregulated growth, and repeated, expedient
    repair. Information is shared promiscuously among
    distant elements of the system, often to the point where
    nearly all the important information becomes global or
    duplicated. The overall structure of the system may never
    have been well defined. If it was, it may have eroded
    beyond recognition.”
    — Brian Foote and Joseph Yoder, laputan.org/mud

    View Slide

  21. Start with the API first

    View Slide

  22. Mobile
    MVC Templates
    Static Assets
    Website
    MVC Templates
    Static Assets
    Database
    Native App API
    Native App

    View Slide

  23. Start with the API first

    View Slide

  24. 1. Separation of concerns

    View Slide

  25. API Layer
    UI 1 UI 2 UI 3

    View Slide

  26. 2. Scalable

    View Slide

  27. 2a. Team

    View Slide

  28. 2b. Product

    View Slide

  29. 2c. Business

    View Slide

  30. 2d. Technology

    View Slide

  31. API Layer
    UI 1 UI 2 UI 3
    Users Assets Products Trx

    View Slide

  32. 3. Extensible

    View Slide

  33. 4. Seamless

    View Slide

  34. 5. Evolvable

    View Slide

  35. SOLID

    View Slide

  36. 1. Single responsibility

    View Slide

  37. 2. Open/closed

    View Slide

  38. 3. Liskov substitution

    View Slide

  39. Client Service 1 Service 2
    Service 3

    View Slide

  40. Client Service 1 Service 2
    Service 3

    View Slide

  41. 4. Interface segregation

    View Slide

  42. 5. Dependency inversion

    View Slide

  43. Client Service 1 Service 2
    Service 3

    View Slide

  44. Service-oriented architecture

    View Slide

  45. Representational State
    Transfer (REST)

    View Slide

  46. 1. Client-server
    2. Stateless
    3. Cacheable
    4. Layered system
    5. Code on demand
    6. Uniform interface

    View Slide

  47. View Slide

  48. API Layer
    Native
    App Website Mobile
    Users Assets Products Trx
    Database

    View Slide

  49. What about “legacy” code?

    View Slide

  50. Mobile
    MVC Templates
    Static Assets
    Website
    MVC Templates
    Static Assets
    Database
    Native App API
    Native App

    View Slide

  51. Mobile
    MVC Templates
    Static Assets
    Website
    MVC Templates
    Static Assets
    Database
    API Layer
    Native App

    View Slide

  52. Mobile
    MVC Templates
    Static Assets
    Website
    MVC Templates
    Static Assets
    Database
    API Layer
    Native App

    View Slide

  53. But how do we “sell” it within
    our company?

    View Slide

  54. 1. Show how it adds value, increases
    throughput, and decreases time to
    implement change requests and new
    features
    2. Demo a working prototype
    3. Do this with a presentation
    4. Tell a convincing story
    5. Create a roadmap
    6. Get help from a co-worker, boss, or
    mentor

    View Slide

  55. Ben Ramsey
    benramsey.com
    @ramsey
    joind.in/9094
    Thank you

    View Slide

  56. API First
    Copyright © Ben Ramsey. Some rights reserved.
    This work is licensed under a Creative Commons Attribution-NonCommercial-
    NoDerivs 3.0 Unported.
    For uses not covered under this license, please contact the author.
    Ramsey, Ben. “API First.” ZendCon. Santa Clara Convention Center, Santa Clara, CA.
    10 Oct. 2013. Conference Presentation.

    View Slide

  57. Photo Credits
    1. “Samsung to Launch Smart Feature Phone ‘REX Series’ in Emerging Markets” by Samsung Tomorrow,
    flickr.com/photos/samsungtomorrow/8475665954
    2. “Danger D'Avalanche” by Peter Dutton, flickr.com/photos/joeshlabotnik/375149668
    3. “Favela da Rocinha” by Scott Hadfield, flickr.com/photos/hadsie/3289716114
    4. “Wrapping paper and bow” by Jonathan, flickr.com/photos/metabrilliant/4805163439

    View Slide