Download pptx - Mobile Apps with ColdFusion

Transcript
Page 1: Mobile Apps with ColdFusion

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

Terry Ryan | EvangelistBuilding ColdFusion Powered Mobile Applications

Developer Week June 20 – June 24, 2011

Page 2: Mobile Apps with ColdFusion

© 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

Page 3: Mobile Apps with ColdFusion

© 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

Page 4: Mobile Apps with ColdFusion

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

Review

4

Page 5: Mobile Apps with ColdFusion

© 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

Page 6: Mobile Apps with ColdFusion

© 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

Page 7: Mobile Apps with ColdFusion

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

Mobile Apps = AIR

7

Page 8: Mobile Apps with ColdFusion

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

AIR for Devices

app.bar

app.apk

app.ipa

Page 9: Mobile Apps with ColdFusion

© 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

Page 10: Mobile Apps with ColdFusion

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

Application We are building

Staff information for my immediate team

1 table

Person information

10

Page 11: Mobile Apps with ColdFusion

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

Demo – Backend Code

11

Page 12: Mobile Apps with ColdFusion

© 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

Page 13: Mobile Apps with ColdFusion

© 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

Page 14: Mobile Apps with ColdFusion

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

Network Only

14

RemoteObject

Service

Page 15: Mobile Apps with ColdFusion

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

Demo – Network Only

15

Page 16: Mobile Apps with ColdFusion

© 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

Page 17: Mobile Apps with ColdFusion

© 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

Page 18: Mobile Apps with ColdFusion

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

Read Only Cache

18

RemoteObject

DAOService

Page 19: Mobile Apps with ColdFusion

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

Demo – Read Only Cache

19

Page 20: Mobile Apps with ColdFusion

© 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

Page 21: Mobile Apps with ColdFusion

© 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

Page 22: Mobile Apps with ColdFusion

© 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

Page 23: Mobile Apps with ColdFusion

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

Synch-able Cache

23

MainSynchManager

Service

Page 24: Mobile Apps with ColdFusion

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

Demo – Synch-able Cache

24

Page 25: Mobile Apps with ColdFusion

© 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

Page 26: Mobile Apps with ColdFusion

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

Tips

26

Page 27: Mobile Apps with ColdFusion

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

Sometimes you have to manually cast

DAO

CFAIR Synch

Page 28: Mobile Apps with ColdFusion

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

Watch out for circular references

ORM with relationships

Copy ColdFusion ORM and remove relationships

28

Page 29: Mobile Apps with ColdFusion

© 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

Page 30: Mobile Apps with ColdFusion

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

Prepare databases

Ship apps with prepopulated databases

30

Page 31: Mobile Apps with ColdFusion

© 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

Page 32: Mobile Apps with ColdFusion

© 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

Page 33: Mobile Apps with ColdFusion

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

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

Page 34: Mobile Apps with ColdFusion

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


Recommended