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.

88dd97cf2dc7f06cc51a01d450f0b1e5?s=128

Adrian Kosmaczewski
PRO

October 04, 2010
Tweet

Transcript

  1. Integrating iOS Applications with Backend REST Services Monday, October 4th

    - JAOO - Århus, Denmark
  2. Adrian Kosmaczewski

  3. akosma software

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

  5. None
  6. My Software Passion

  7. People

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

  9. Software is a process

  10. Software is a social process

  11. None
  12. One Problem

  13. Several Solutions

  14. None
  15. Questions

  16. Web Developers?

  17. iOS Developers?

  18. API Designers or Developers?

  19. Server-side Technologies?

  20. None
  21. 1 The Problem

  22. Database

  23. Many Questions

  24. Formats?

  25. Libraries?

  26. “Best” approaches?

  27. 2 The Solutions

  28. Bad news

  29. Far too many

  30. REST vs SOAP

  31. XML vs JSON

  32. Synchronous vs. Asynchronous

  33. None
  34. Good News

  35. Introducing iPhoneWebServicesClient

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

  37. 2 parts

  38. 1 PHP server app

  39. 2 iOS client

  40. Many formats

  41. XML

  42. JSON

  43. (duh)

  44. • XML • 8 libraries • JSON • 2 parsers

    • YAML • CSV • SOAP • Property List • XML • Binary • Protocol Buffers
  45. Extensible

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

  47. Variable sized dataset

  48. (from 1 to 5000 items per call)

  49. Heterogenous Data Source

  50. (the same data in different formats)

  51. XML Libraries

  52. (lots of them)

  53. None
  54. 3 Demo

  55. None
  56. 4 The Tests

  57. • Local • Wifi • 3G • EDGE • All

    Combinations • Different dataset sizes each time
  58. None
  59. 5 Results

  60. Easier to implement on the iOS side?

  61. 1. JSON + Property Lists + CSV 2. XML (DOM)

    + Protocol Buffers 3. XML (SAX) 4. SOAP + YAML
  62. Easier to implement on the PHP side?

  63. 1. JSON + YAML 2. Property List + CSV +

    XML 3. Protocol Buffers 4. SOAP
  64. Smaller Payload

  65. 1. CSV + Protocol Buffers + Binary Plist 2. JSON

    + YAML 3. XML 4. SOAP
  66. Fastest Deserialization Speed

  67. 1. Property Lists + TBXML 2. SOAP + libxml (DOM)

    + Google XML 3. JSON 4. YAML + CSV + APXML
  68. More Portable?

  69. 1. XML + JSON 2. Protocol Buffers + YAML +

    CSV 3. SOAP 4. Property Lists
  70. More Readable?

  71. 1. JSON + YAML 2. XML + XML Property Lists

    3. Protocol Buffers 4. Binary Property Lists
  72. Less Memory Consumption?

  73. 1. Binary Property List + Protocol Buffers 2. CSV +

    JSON + TBXML 3. XML 4. SOAP + APXML
  74. Some raw, deeply flawed comparisons?

  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
  76. The “Best”?

  77. 1. JSON + Property Lists 2. TBXML + Protocol Buffers

    3. Other XML parsers + CSV 4. YAML + SOAP + APXML
  78. None
  79. 6 Next Steps

  80. Test with other server-side technologies

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

  82. Test with other Cocoa networking libraries

  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/
  84. Test with other serialization systems

  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
  86. Test with different data sets

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

  88. None
  89. Thanks!

  90. Questions?

  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/