Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

Adrian Kosmaczewski

Slide 3

Slide 3 text

akosma software

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

My Software Passion

Slide 7

Slide 7 text

People

Slide 8

Slide 8 text

Team members, users, clients, society in general

Slide 9

Slide 9 text

Software is a process

Slide 10

Slide 10 text

Software is a social process

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

One Problem

Slide 13

Slide 13 text

Several Solutions

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Questions

Slide 16

Slide 16 text

Web Developers?

Slide 17

Slide 17 text

iOS Developers?

Slide 18

Slide 18 text

API Designers or Developers?

Slide 19

Slide 19 text

Server-side Technologies?

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

1 The Problem

Slide 22

Slide 22 text

Database

Slide 23

Slide 23 text

Many Questions

Slide 24

Slide 24 text

Formats?

Slide 25

Slide 25 text

Libraries?

Slide 26

Slide 26 text

“Best” approaches?

Slide 27

Slide 27 text

2 The Solutions

Slide 28

Slide 28 text

Bad news

Slide 29

Slide 29 text

Far too many

Slide 30

Slide 30 text

REST vs SOAP

Slide 31

Slide 31 text

XML vs JSON

Slide 32

Slide 32 text

Synchronous vs. Asynchronous

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

Good News

Slide 35

Slide 35 text

Introducing iPhoneWebServicesClient

Slide 36

Slide 36 text

http://github.com/akosma/ iPhoneWebServicesClient

Slide 37

Slide 37 text

2 parts

Slide 38

Slide 38 text

1 PHP server app

Slide 39

Slide 39 text

2 iOS client

Slide 40

Slide 40 text

Many formats

Slide 41

Slide 41 text

XML

Slide 42

Slide 42 text

JSON

Slide 43

Slide 43 text

(duh)

Slide 44

Slide 44 text

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

Slide 45

Slide 45 text

Extensible

Slide 46

Slide 46 text

(add more formats and libraries if you want)

Slide 47

Slide 47 text

Variable sized dataset

Slide 48

Slide 48 text

(from 1 to 5000 items per call)

Slide 49

Slide 49 text

Heterogenous Data Source

Slide 50

Slide 50 text

(the same data in different formats)

Slide 51

Slide 51 text

XML Libraries

Slide 52

Slide 52 text

(lots of them)

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

3 Demo

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

4 The Tests

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

5 Results

Slide 60

Slide 60 text

Easier to implement on the iOS side?

Slide 61

Slide 61 text

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

Slide 62

Slide 62 text

Easier to implement on the PHP side?

Slide 63

Slide 63 text

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

Slide 64

Slide 64 text

Smaller Payload

Slide 65

Slide 65 text

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

Slide 66

Slide 66 text

Fastest Deserialization Speed

Slide 67

Slide 67 text

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

Slide 68

Slide 68 text

More Portable?

Slide 69

Slide 69 text

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

Slide 70

Slide 70 text

More Readable?

Slide 71

Slide 71 text

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

Slide 72

Slide 72 text

Less Memory Consumption?

Slide 73

Slide 73 text

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

Slide 74

Slide 74 text

Some raw, deeply flawed comparisons?

Slide 75

Slide 75 text

• 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

Slide 76

Slide 76 text

The “Best”?

Slide 77

Slide 77 text

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

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

6 Next Steps

Slide 80

Slide 80 text

Test with other server-side technologies

Slide 81

Slide 81 text

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

Slide 82

Slide 82 text

Test with other Cocoa networking libraries

Slide 83

Slide 83 text

• 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/

Slide 84

Slide 84 text

Test with other serialization systems

Slide 85

Slide 85 text

• 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

Slide 86

Slide 86 text

Test with different data sets

Slide 87

Slide 87 text

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

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

Thanks!

Slide 90

Slide 90 text

Questions?

Slide 91

Slide 91 text

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