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

Integrating iOS Applications with Backend REST Services

Integrating iOS Applications with Backend REST Services

Presentation given at JAOO 2010, Århus, Denmark.

Adrian Kosmaczewski

October 04, 2010
Tweet

More Decks by Adrian Kosmaczewski

Other Decks in Technology

Transcript

  1. Integrating iOS
    Applications with
    Backend REST
    Services
    Monday, October 4th - JAOO - Århus, Denmark

    View Slide

  2. Adrian
    Kosmaczewski

    View Slide

  3. akosma software

    View Slide

  4. akosma.com
    github.com/akosma
    linkedin.com/in/akosma
    formspring.me/akosma
    twitter.com/akosma
    slideshare.com/akosma

    View Slide

  5. View Slide

  6. My Software Passion

    View Slide

  7. People

    View Slide

  8. Team members, users, clients, society in general

    View Slide

  9. Software is a process

    View Slide

  10. Software is a social
    process

    View Slide

  11. View Slide

  12. One Problem

    View Slide

  13. Several Solutions

    View Slide

  14. View Slide

  15. Questions

    View Slide

  16. Web Developers?

    View Slide

  17. iOS Developers?

    View Slide

  18. API Designers or
    Developers?

    View Slide

  19. Server-side
    Technologies?

    View Slide

  20. View Slide

  21. 1
    The Problem

    View Slide

  22. Database

    View Slide

  23. Many Questions

    View Slide

  24. Formats?

    View Slide

  25. Libraries?

    View Slide

  26. “Best” approaches?

    View Slide

  27. 2
    The Solutions

    View Slide

  28. Bad news

    View Slide

  29. Far too many

    View Slide

  30. REST vs SOAP

    View Slide

  31. XML vs JSON

    View Slide

  32. Synchronous vs.
    Asynchronous

    View Slide

  33. View Slide

  34. Good News

    View Slide

  35. Introducing
    iPhoneWebServicesClient

    View Slide

  36. http://github.com/akosma/
    iPhoneWebServicesClient

    View Slide

  37. 2 parts

    View Slide

  38. 1
    PHP server app

    View Slide

  39. 2
    iOS client

    View Slide

  40. Many formats

    View Slide

  41. XML

    View Slide

  42. JSON

    View Slide

  43. (duh)

    View Slide

  44. • XML
    • 8 libraries
    • JSON
    • 2 parsers
    • YAML
    • CSV
    • SOAP
    • Property List
    • XML
    • Binary
    • Protocol Buffers

    View Slide

  45. Extensible

    View Slide

  46. (add more formats and libraries if you want)

    View Slide

  47. Variable sized
    dataset

    View Slide

  48. (from 1 to 5000 items per call)

    View Slide

  49. Heterogenous Data
    Source

    View Slide

  50. (the same data in different formats)

    View Slide

  51. XML Libraries

    View Slide

  52. (lots of them)

    View Slide

  53. View Slide

  54. 3
    Demo

    View Slide

  55. View Slide

  56. 4
    The Tests

    View Slide

  57. • Local
    • Wifi
    • 3G
    • EDGE
    • All Combinations
    • Different dataset
    sizes each time

    View Slide

  58. View Slide

  59. 5
    Results

    View Slide

  60. Easier to implement
    on the iOS side?

    View Slide

  61. 1. JSON + Property Lists + CSV
    2. XML (DOM) + Protocol Buffers
    3. XML (SAX)
    4. SOAP + YAML

    View Slide

  62. Easier to implement
    on the PHP side?

    View Slide

  63. 1. JSON + YAML
    2. Property List + CSV + XML
    3. Protocol Buffers
    4. SOAP

    View Slide

  64. Smaller Payload

    View Slide

  65. 1. CSV + Protocol Buffers + Binary Plist
    2. JSON + YAML
    3. XML
    4. SOAP

    View Slide

  66. Fastest
    Deserialization
    Speed

    View Slide

  67. 1. Property Lists + TBXML
    2. SOAP + libxml (DOM) + Google XML
    3. JSON
    4. YAML + CSV + APXML

    View Slide

  68. More Portable?

    View Slide

  69. 1. XML + JSON
    2. Protocol Buffers + YAML + CSV
    3. SOAP
    4. Property Lists

    View Slide

  70. More Readable?

    View Slide

  71. 1. JSON + YAML
    2. XML + XML Property Lists
    3. Protocol Buffers
    4. Binary Property Lists

    View Slide

  72. Less Memory
    Consumption?

    View Slide

  73. 1. Binary Property List + Protocol
    Buffers
    2. CSV + JSON + TBXML
    3. XML
    4. SOAP + APXML

    View Slide

  74. Some raw, deeply
    flawed comparisons?

    View Slide

  75. • Binary Plists are 3 to 4 times faster to
    deserialize than JSON
    • iPod touch 2nd Gen is ~25% faster than
    iPhone 3G
    • iPhone 4 is ~300% faster than iPhone 3G
    • JSON is 45% of its equivalent XML plist
    • Binary plist is 35% of its equivalent XML
    plist

    View Slide

  76. The “Best”?

    View Slide

  77. 1. JSON + Property Lists
    2. TBXML + Protocol Buffers
    3. Other XML parsers + CSV
    4. YAML + SOAP + APXML

    View Slide

  78. View Slide

  79. 6
    Next Steps

    View Slide

  80. Test with other
    server-side
    technologies

    View Slide

  81. (J2EE, ASP.NET, Ruby on Rails, Django...)

    View Slide

  82. Test with other Cocoa
    networking libraries

    View Slide

  83. • AsyncSocket
    http://akos.ma/0x37v
    • IP*Works! for Mac OS X
    http://www.nsoftware.com/portal/macos/
    • OmniNetworking
    http://akos.ma/0q
    • ThoMoNetworking
    http://hci.rwth-aachen.de/thomonet
    • ConnectionKit
    http://github.com/karelia/ConnectionKit/

    View Slide

  84. Test with other
    serialization systems

    View Slide

  85. • MessagePack
    http://msgpack.org/
    • Apache Thrift
    http://incubator.apache.org/thrift/
    • BERT
    http://bert-rpc.org/
    • Apache Avro
    http://avro.apache.org/
    • ONC RPC aka Sun RPC
    http://akos.ma/va
    Open Network
    Computing Remote
    Procedure Call

    View Slide

  86. Test with different
    data sets

    View Slide

  87. (sport results, weather, financial data, hyerarchical
    data, binary data, etc...)

    View Slide

  88. View Slide

  89. Thanks!

    View Slide

  90. Questions?

    View Slide

  91. These slides are released under a
    Creative Commons Attribution-No Derivative
    Works 3.0 Unported License
    http://creativecommons.org/licenses/by-nd/3.0/

    View Slide