Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

A Brief

Slide 3

Slide 3 text

Incomplete

Slide 4

Slide 4 text

Mostly Wrong

Slide 5

Slide 5 text

A Brief, Incomplete, & Mostly Wrong History of Databases on iOS

Slide 6

Slide 6 text

Let's face it Databases are boring

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Me JP Simard @simjp [email protected]

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

iOS State Of Persistence

Slide 11

Slide 11 text

» NSKeyedArchiver/plists/files » SQLite/FMDB* » FCModel* » Core Data* » YapDatabase* » CouchbaseLite* » LevelDB/MongoDB & other backend ports » Realm * Built on SQLite

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

SQLite

Slide 15

Slide 15 text

SQLite » Main author: Richard Hipp » Released v1 in 2000 » Released v3 in 2004 » Currently v3.8.6 » v4 was announced in 2012, but was never publicly updated » Led by consortium of Adobe, Bloomberg, mozilla & Oracle

Slide 16

Slide 16 text

Q: What was SQLite designed for?

Slide 17

Slide 17 text

Q: What's the biggest thing ever to have run SQLite?

Slide 18

Slide 18 text

Q: What's the scariest thing ever to have run SQLite?

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Freaking

Slide 21

Slide 21 text

Freaking Missile

Slide 22

Slide 22 text

Freaking Missile Destroyers

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

SQLite » Designed for guided missile destroyers for the US Navy » Bedrock of iOS persistence » Relational, embedded, ACID, SQL-like » Public domain » sqlite.org

Slide 25

Slide 25 text

FMDB » Popular Objective-C SQLite wrapper » Written by Gus Mueller of Flying Meat Software » Gus built this for accessing SQLite in his apps (VoodooPad & Acorn) » Adds 10%-20% performance overhead over raw SQLite » github.com/ccgus/fmdb

Slide 26

Slide 26 text

FCModel » Recent (2013) SQLite ORM in Objective-C » An alternative to Core Data for people who like having direct SQL access » Written by Marco Arment of Instapaper and Overcast » Uses FMDB under the hood » Models defined directly as classes and properties » github.com/marcoarment/FCModel

Slide 27

Slide 27 text

Core Data » By far most popular persistence choice on iOS » Released in 2005 for OSX 10.4 Tiger & 2009 for iOS SDK 3.0 » Evolved from Enterprise Objects Framework (EOF)

Slide 28

Slide 28 text

Enterprise Objects Framework » ORM for Microsoft SQL Server & Oracle in early 90's (92-94) » Built by team at NeXT in Objective-C for OpenStep » Starting point for Core Data » Worked on by Craig Federighi, a.k.a. Hair Force One

Slide 29

Slide 29 text

YapDatabase » Key-Value Store built on SQLite » Built by Robbie Hanson of Yap Studios » github.com/yapstudios/YapDatabase

Slide 30

Slide 30 text

Couchbase Lite » Evolved from TouchDB » Apache CouchDB compatible » Now at Couchbase » NoSQL-like, built on SQLite » Lightweight, embedded, syncable, NoSQL- like

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

Realm Genesis

Slide 34

Slide 34 text

Realm Genesis » Alexander Stigsen at Nokia early 2000's » Need to fit data on very limited devices. Low storage, memory & processing power » Compression not an option » Solution: Intelligent bit-packing, ARM vectorization, efficient table layout » YCombinator S11, Launched on iOS 2014

Slide 35

Slide 35 text

Realm » Fast, embedded database (zero-copy, not an ORM) » True NoSQL (not just interface) » Full ACID transactions » Well defined threading model (GCD) » Cross-platform C++ core with many language bindings (only Objective-C & Swift released)

Slide 36

Slide 36 text

Open Source github.com/realm/ realm-cocoa

Slide 37

Slide 37 text

Resources » This talk: github.com/jpsim/talks » SQLite: The Definitive Guide to SQLite & SQLite 4 Design » Core Data: History and Genesis » Enterprise Objects Framework (EOF): EOF History » Realm: realm.io » Michael Bay Gifs: r/michaelbaygifs

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Let's Build Better Tools Together

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

Gracias! @simjp, [email protected]