mobile apps with coldfusion

Post on 20-May-2015

3.796 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

CFAir synch

TRANSCRIPT

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Terry Ryan | EvangelistBuilding ColdFusion Powered Mobile Applications

Developer Week June 20 – June 24, 2011

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Assumptions

You know a little ColdFusion

You know a little Flex

You know what AIR is

You’ve heard about AIR on Mobile Devices

2

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

What is this about?

“Building ColdFusion Powered Mobile Applications”

More specifically

ColdFusion support for data in mobile apps.

3

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Review

4

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

ColdFusion - Do you know what a CFC is?

ColdFusion Component

Collection of Functions

Functions

Have “Scope” remote, public, package, and private

Remote means accessible to the world remotely through a webservice

Remote Access

Plain Text

WDDX

JSON

AMF or Flash Remoting

5

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Flex – Do you know what a remote object is?

RemoteObject

Remote Server call

Uses AMF

AMF

Client requests data

Server converts from server objects to ActionScript objects

Server transmits binary objects to requesting client

6

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Mobile Apps = AIR

7

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

AIR for Devices

app.bar

app.apk

app.ipa

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

AIR and SQLite

AIR uses SQLite for offline data access

SQLite is tiny footprint database

Used in

Native IOS

Native Android

9

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Application We are building

Staff information for my immediate team

1 table

Person information

10

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Demo – Backend Code

11

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Approaches to Mobile Data

Mobile only (Not Covered)

Network Only

Read only cache

Sync-able cache

12

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Network Only

Backend Server has database

User requests data

Mobile App requests data

Mobile App presents it directly to user

13

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Network Only

14

RemoteObject

Service

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Demo – Network Only

15

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Network Only

Pros

Easy to write Simple Apps

Cons

Good For

Demo apps Proof of Concepts Stale data worse then

no data

Have to be connected to network

No interactivity

Take away

You just turned your app in to a dumbed down browser

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Read Only Cache

Backend Server has database

Mobile App has database

User requests data

Mobile app presents data from its database

Mobile App requests data

Mobile App overwrites all its data.

17

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Read Only Cache

18

RemoteObject

DAOService

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Demo – Read Only Cache

19

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Read only Cache

Pros

Moderately easy to write

Allows offline access

Cons

Good For

Consumption apps Stop gap app

No interactivity

Take aways

Better then network only

Still limited Might be right for your

users

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Synch-able Cache

Backend Server has database

Mobile App has database

User requests/alters data

Mobile app presents/alters data from/for its database

Mobile App synchs all its data.

Mobile app and server manage conflicts

21

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

CF AIR Synch

ColdFusion 9 Introduced AIR Offline support

You write a sychmanager that matched ISynchmanager interface

You include cfair.swc in your Flex

22

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Synch-able Cache

23

MainSynchManager

Service

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Demo – Synch-able Cache

24

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Synch-able Cache

Pros

This is a real app Much easier then

writing all of that code

Cons

Good For

Real apps

So complex to write, simplified version is still complex

Code is obscured

Take aways

Might work for you Still might have to roll

your own

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Tips

26

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 27

Sometimes you have to manually cast

DAO

CFAIR Synch

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Watch out for circular references

ORM with relationships

Copy ColdFusion ORM and remove relationships

28

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

App should only present local

All app data should be displayed from local

App should only synch to server

29

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Prepare databases

Ship apps with prepopulated databases

30

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Use Asynchronous Database calls

Little harder then you are used to

But allows for responsive apps.

31

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 32

Download adobe.com/go/try_flashbuilderadobe.com/go/coldfusion

Learn adobe.com/devnet/flexadobe.com/devnet/coldfusion

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 33

Code http://bitly.com/bundles/tpryan/2

© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

top related