105
Mobile Development with uPortal & Infusion Jen Bourey, Genius Portal Developer, Unicon Justin Obara, Fluid Infusion Product Manager, Adaptive Technology Resource Centre Colin Clark, Fluid Project Technical Lead, Adaptive Technology Resource Centre Tuesday, March 16, 2010

Mobile Development with uPortal and Infusion

Embed Size (px)

DESCRIPTION

A half-day, code-oriented workshop teaching developers how to build mobile applications using Infusion and the mobile Fluid Skinning System. Includes advice on performance optimization and techniques for using the open Web to reach more users on more devices.

Citation preview

Page 1: Mobile Development with uPortal and Infusion

Mobile Development with uPortal & Infusion

Jen Bourey, Genius Portal Developer, Unicon

Justin Obara, Fluid Infusion Product Manager, Adaptive Technology Resource Centre

Colin Clark, Fluid Project Technical Lead, Adaptive Technology Resource Centre

Tuesday, March 16, 2010

Page 2: Mobile Development with uPortal and Infusion

Who is Fluid?

• Is an Open Source community of

• Designers

• Developers

• Accessibility Experts

• Helps other open communities

• Consists of universities, museums, and individuals

http://fluidproject.org

Tuesday, March 16, 2010

Page 3: Mobile Development with uPortal and Infusion

What is Fluid Infusion?

• Application Framework built on top of jQuery

• Lightweight CSS Framework (FSS)

• UI Components you can reuse and adapt

• Open architecture: everything is configurable

• Designed for Usability and Accessibility

Tuesday, March 16, 2010

Page 4: Mobile Development with uPortal and Infusion

Going Mobile

Tuesday, March 16, 2010

Page 5: Mobile Development with uPortal and Infusion

Big Question:

What platforms should we support?

Tuesday, March 16, 2010

Page 6: Mobile Development with uPortal and Infusion

Everything?

Tuesday, March 16, 2010

Page 7: Mobile Development with uPortal and Infusion

Everything?JavaObjective-C C++

Android SDKCocoa Touch Carbide

Tuesday, March 16, 2010

Page 8: Mobile Development with uPortal and Infusion

Only One?

Tuesday, March 16, 2010

Page 9: Mobile Development with uPortal and Infusion

Only One?

Tuesday, March 16, 2010

Page 10: Mobile Development with uPortal and Infusion

Mobile: Embrace the Web

• Phones now have great browsers built in

• Web design is ubiquitous and familiar

• Use standard HTML, CSS, and JavaScript

• Blends seamless into existing sites

• Thin native apps provide access to interactive features (camera, bluetooth)

Tuesday, March 16, 2010

Page 11: Mobile Development with uPortal and Infusion

Mobile Web appsHTML, CSS, JS

Browser

Tuesday, March 16, 2010

Page 12: Mobile Development with uPortal and Infusion

The Open Web Today

• Multi-touch gestures

• Audio and video

• Vector graphics and animation

• Great accessibility

• All work on mobile today!

• Stable and deeply interoperable

• Everyone knows it

Tuesday, March 16, 2010

Page 13: Mobile Development with uPortal and Infusion

A Growing Approach

Google LatitudeTuesday, March 16, 2010

Page 14: Mobile Development with uPortal and Infusion

Mobile Web Pain Points

• Sparse documentation

• Few successful Open Source examples

• Existing frameworks have limitations

Tuesday, March 16, 2010

Page 15: Mobile Development with uPortal and Infusion

Sparse Documentation

Tuesday, March 16, 2010

Page 16: Mobile Development with uPortal and Infusion

Existing Frameworks

• Reusability of content?

• JavaScript Footprint?

• Flexibility of themes?

jQTouch iUI WebApp.Net Magic Framework

Tuesday, March 16, 2010

Page 17: Mobile Development with uPortal and Infusion

Hybrid Apps

• Most platforms have support for embedding browsers in native apps

• Can render user interfaces with HTML

• Write all your code in JavaScript

• Access native hardware with a bridge

Tuesday, March 16, 2010

Page 18: Mobile Development with uPortal and Infusion

PhoneGap

Tuesday, March 16, 2010

Page 19: Mobile Development with uPortal and Infusion

Tuesday, March 16, 2010

Page 20: Mobile Development with uPortal and Infusion

Migrating to Mobile

• Great mobile apps are carefully designed

• The transition to mobile takes time

• Incremental: reuse as much as possible

• Re-skin, re-style, and adapt existing UIs

Tuesday, March 16, 2010

Page 21: Mobile Development with uPortal and Infusion

How Infusion Can Help

• Loose coupling DOM Agnosticism

• Unobtrusive and template-driven

• Fast and flexible styling with FSS

Tuesday, March 16, 2010

Page 22: Mobile Development with uPortal and Infusion

DOM Agnosticism

Component code is maximally unaware of the details of the markup layout that it operates on.

Tuesday, March 16, 2010

Page 23: Mobile Development with uPortal and Infusion

DOM Binder

Relaxes the relationship between code and markup

Tuesday, March 16, 2010

Page 24: Mobile Development with uPortal and Infusion

DOM Binder

• Uses named selectors

• Explicit selectors never appear in code

• Code is free of baked dependences on markup

• Attached to a component with call to fluid.initView

Tuesday, March 16, 2010

Page 25: Mobile Development with uPortal and Infusion

DOM Binder

fluid.defaults(“fliquor.imageViewer”, { selectors: { searchButton: “.flc-fliquor-searchButton”, searchBox: “.flc-fliquor-search”, template: “.flc-fliquor-template”, images: “.flc-fliquor-images”, }});

that.locate(“searchBox”).fluid(“activatable”, that.search);

that.locate(“searchButton”).click(function (evt) { that.search(); return false;});

configuration

usage

Tuesday, March 16, 2010

Page 26: Mobile Development with uPortal and Infusion

Unobtrusive Templates

• Components render using pure HTML templates

• Code shouldn’t break if the markup changes

• Code is not in markup, markup is not in code

Tuesday, March 16, 2010

Page 27: Mobile Development with uPortal and Infusion

HTML Template

<body class="flc-fliquor fl-theme-coal"> <div class="fl-centered fl-navbar fl-table search-bar"> ... <div class="fl-centered results"> <ol class="flc-fliquor-images fl-list-menu fl-list-thumbnails fl-thumbnails-expanded"> <li class="flc-fliquor-template"> <a href="#"> <span class="wrapper"> <span class="flc-fliquor-item-title fl-fliquor-item-title">Title</span> <img title="Title" alt="Alt" src="#" class="fl-icon" /> </span> </a> </li> </ol> </div> ...</body>

Tuesday, March 16, 2010

Page 28: Mobile Development with uPortal and Infusion

Infusion Templates

• Fully customizable

• As semantic as possible

• Advanced accessibility added via JavaScript

• Presentation class names separated from Javascript selector names

Tuesday, March 16, 2010

Page 29: Mobile Development with uPortal and Infusion

Rapid CSS using FSS

• Modular, extensible class-name CSS system

• Easy to read class names

• Plays nice with other CSS systems (jQuery themes, other frameworks, etc)

• Modularity means it’s meant for you to hack

• Lots of support, fully cross browser

Tuesday, March 16, 2010

Page 30: Mobile Development with uPortal and Infusion

FSS Applied

Reset

normalize the little things for a consistent starting point

Tuesday, March 16, 2010

Page 31: Mobile Development with uPortal and Infusion

FSS Applied

Layout

placement & containers

Tuesday, March 16, 2010

Page 32: Mobile Development with uPortal and Infusion

FSS Applied

Themes

style, colors and graphics

Tuesday, March 16, 2010

Page 33: Mobile Development with uPortal and Infusion

Mobile FSS

• Highly focused on target platforms

• Follows basic touchscreen UI guidelines from Apple and Android dev centres

• Repurposes FSS class names, enabling multi-platform content

Tuesday, March 16, 2010

Page 34: Mobile Development with uPortal and Infusion

Mobile FSS Applied

=

.fl-theme-coal .fl-theme-iphone

Tuesday, March 16, 2010

Page 35: Mobile Development with uPortal and Infusion

Make it your own.fl-theme-myTheme

Tuesday, March 16, 2010

Page 36: Mobile Development with uPortal and Infusion

Case Study: Fluid Engage

Tuesday, March 16, 2010

Page 37: Mobile Development with uPortal and Infusion

Fluid Engage

• Open source collaboration with museums

• Visitor engagement: learn and contribute

• Use phones visitors bring into the museum

• Mobile apps and in-gallery kiosks

• All built with open source Web technology

Tuesday, March 16, 2010

Page 38: Mobile Development with uPortal and Infusion

Our Mobile Approach

• No hard intrusions on your content

• Don’t subvert good Web idioms

• Your choice: native-like or webbish

Tuesday, March 16, 2010

Page 39: Mobile Development with uPortal and Infusion

Infusion Mobile

• mFSS: themes for iPhone, Android, more

• Components designed for the mobile Web

• ScreenNavigator: unobtrusive mobile navigation

Tuesday, March 16, 2010

Page 40: Mobile Development with uPortal and Infusion

Museum Components

• Image Gallery

• Podcasts and video

• My Museum/My Collection

• Comments, Discussion, Stories

• Collection Browse and Search

• Tagging?

Tuesday, March 16, 2010

Page 41: Mobile Development with uPortal and Infusion

Engage’s Architecture

• Simple, lightweight, and approachable

• JSON data feeds everywhere

• Client-side markup rendering

• Infusion wires it all together

Tuesday, March 16, 2010

Page 42: Mobile Development with uPortal and Infusion

Components + Services

!!!!"##!$%!&"'%()*$+,

-)$*&".$-)$*&".$/,!0"1+

!"#$!234

%&$&'()$*+,-(.&,#*'/&$*"0$(*+,-(.+1222*254

3(44+,'$!264

-)$*&".$!*1"7+2.8*.9":8+4

,+0#!$%!&)*+0#

;<<=>!6=$?!.+0$()@A09!%0!B"B+)66CD!E!;DC6!.1F*&$!%&!G*.?")#!H*88%I

J%)+1!*B,(1!#%8%)!,*$!"1+$>!.%0,+.$+$()CCC

561&(78&1+(!264

9+0"'+1*(:-+;'$!254

3"))&+) <=>?@*AB

Artifact Data Feed

Tags Service

Media Service

Artifact Component

Tagging Component

Image Gallery Component

Tuesday, March 16, 2010

Page 43: Mobile Development with uPortal and Infusion

Data Import

Exhibit Data Feed

mFSS

Components

Devices

Content/CollectionsSystems

Exhibit Presenter

Tuesday, March 16, 2010

Page 44: Mobile Development with uPortal and Infusion

Kettle: Server-side JS

• Built on top of the JSGI server spec

• Don’t need lots of new APIs on server

• Envjs provides a full browser

• Infusion as application framework

• Choose where markup gets rendered

• Natural, familiar environment for Web developers and designers

Tuesday, March 16, 2010

Page 45: Mobile Development with uPortal and Infusion

Code!https://source.fluidproject.org/svn/scratchpad/mobile-workshop/trunk/

Tuesday, March 16, 2010

Page 46: Mobile Development with uPortal and Infusion

WebKit-Specific Features

Tuesday, March 16, 2010

Page 47: Mobile Development with uPortal and Infusion

Adding a Home Screen Icon

<link rel="apple-touch-icon" href="engage-apple-touch-icon.png"/>

• Adds the linked icon to the iPhone home screen

• Icons must be 57 x 57 px

• iPhone will add rounded corners & reflection for you

Tuesday, March 16, 2010

Page 48: Mobile Development with uPortal and Infusion

Run As a Webapp

<meta name="apple-mobile-web-app-capable" content="yes" />

• Removes browser chrome

• All page transitions will cause Safari to pen

• Use Screen Navigator or window.location to intercept page transitions

Tuesday, March 16, 2010

Page 49: Mobile Development with uPortal and Infusion

Setting a fixed size<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />

• Sets the width of page to screen size

• Turns off zooming with pinch/pan

Tuesday, March 16, 2010

Page 50: Mobile Development with uPortal and Infusion

Removing Behaviour

<style type="text/css"><!—- * { -webkit-touch-callout: none; }--></style>

• Prevents opening links in a new window

• Prevents saving images

Tuesday, March 16, 2010

Page 51: Mobile Development with uPortal and Infusion

Building with mFSS

Tuesday, March 16, 2010

Page 52: Mobile Development with uPortal and Infusion

mFSS: iPhone Theme

<head> <link type="text/css" rel="stylesheet" href="fss-mobile-layout.css" /> <link type="text/css" rel="stylesheet" href="fss-mobile-theme-iphone.css" /></head>

<body class=”fl-theme-iphone”>

</body>

Tuesday, March 16, 2010

Page 53: Mobile Development with uPortal and Infusion

mFSS: Android Theme

<head> <link type="text/css" rel="stylesheet" href="fss-mobile-layout.css" /> <link type="text/css" rel="stylesheet" href="fss-mobile-theme-android.css" /></head>

<body class=”fl-theme-android”>

</body>

Tuesday, March 16, 2010

Page 54: Mobile Development with uPortal and Infusion

mFSS: Desktop

<head> <link type="text/css" rel="stylesheet" href="fss-layout.css" /> <link type="text/css" rel="stylesheet" href="fss-theme-rust.css" /></head><body class=”fl-theme-rust”>

</body>

Tuesday, March 16, 2010

Page 55: Mobile Development with uPortal and Infusion

mFSS: Tabs

<ul class="fl-tabs"> <li class="fl-tabs-active"> <a href="#">Go Back</a> </li>  <li> <a href="#">Go Back</a> </li>  <li> <a href="#">Go Back</a> </li></ul>

Tuesday, March 16, 2010

Page 56: Mobile Development with uPortal and Infusion

mFSS: Buttons

<a class="fl-button fl-button-white" href="../index.html"> Go Back</a><a class="fl-button fl-button-green" href="../index.html"> Go Back</a><a class="fl-button fl-button-blue" href="../index.html"> Go Back</a><a class="fl-button fl-button-black" href="../index.html"> Go Back</a>

Tuesday, March 16, 2010

Page 57: Mobile Development with uPortal and Infusion

mFSS: Back Button

<a href="../mobile.html" class="fl-button fl-backButton"> <span class="fl-button-inner">Back Button</span></a>

Tuesday, March 16, 2010

Page 58: Mobile Development with uPortal and Infusion

mFSS: Lists

<ul class="fl-list-menu"> <li> <a href="#">Link Text</a> </li>  <li> <a href="#">Link Text</a> </li>  <li> <a href="#">Link Text</a> </li></ul>

Tuesday, March 16, 2010

Page 59: Mobile Development with uPortal and Infusion

mFSS: Image Grids

<ul class="fl-list-menu fl-list-thumbnails fl-grid"> <li>  <a href="20.png">    <img class="fl-icon" src="20.png" alt="twisty icon" />    </a>  </li>  <li>  <a href="2.png">    <img class="fl-icon" src="2.jpg" alt="round icon" />    </a> </li></ul>

Tuesday, March 16, 2010

Page 60: Mobile Development with uPortal and Infusion

Infusion Mobile Components

Tuesday, March 16, 2010

Page 61: Mobile Development with uPortal and Infusion

Mobile Components

• Provide intuitive mobile interactions

• Navigation List, Cabinet, Screen Navigator

• A small but growing set: share yours!

• Goal: use them on both mobile and desktop

• Two key types: markup- and data-driven

Tuesday, March 16, 2010

Page 62: Mobile Development with uPortal and Infusion

Markup-Driven Components

• Progressive Enhancement style of JavaScript

• You provide the markup, we add the richness

• No assumptions about your data or content

Tuesday, March 16, 2010

Page 63: Mobile Development with uPortal and Infusion

Cabinet Illustrated

Tuesday, March 16, 2010

Page 64: Mobile Development with uPortal and Infusion

About the Cabinet

• Like an accordion...

• Has the ability to open multiple “drawers” at once

• Any HTML content can go inside

• Helps keep a page simple by hiding things until the user wants to see them

Tuesday, March 16, 2010

Page 65: Mobile Development with uPortal and Infusion

Cabinet: StructureDrawer

Tuesday, March 16, 2010

Page 66: Mobile Development with uPortal and Infusion

Cabinet: StructureHandleDrawer

Tuesday, March 16, 2010

Page 67: Mobile Development with uPortal and Infusion

Cabinet: StructureHandle

Content

Drawer

Tuesday, March 16, 2010

Page 68: Mobile Development with uPortal and Infusion

Cabinet: Markup

<div class=”flc-cabinet”> <div class="flc-cabinet-drawer"> <div class="flc-cabinet-handle"> Can Cats Drink Beer? </div> <div class="flc-cabinet-contents"> <!-- Your markup goes here --> </div>

</div></div>

Drawer

Tuesday, March 16, 2010

Page 69: Mobile Development with uPortal and Infusion

Cabinet: Markup

<div class=”flc-cabinet”> <div class="flc-cabinet-drawer"> <div class="flc-cabinet-handle"> Can Cats Drink Beer? </div> <div class="flc-cabinet-contents"> <!-- Your markup goes here --> </div>

</div></div>

HandleDrawer

Tuesday, March 16, 2010

Page 70: Mobile Development with uPortal and Infusion

Cabinet: Markup

<div class=”flc-cabinet”> <div class="flc-cabinet-drawer"> <div class="flc-cabinet-handle"> Can Cats Drink Beer? </div> <div class="flc-cabinet-contents"> <!-- Your markup goes here --> </div>

</div></div>

Handle

Content

Drawer

Tuesday, March 16, 2010

Page 71: Mobile Development with uPortal and Infusion

Creating a Cabinet

fluid.cabinet(“.flc-cabinet”, options);

Tuesday, March 16, 2010

Page 72: Mobile Development with uPortal and Infusion

Cabinet Options

{ events: { afterOpen: null, afterClose: null }, startOpen: false }

Tuesday, March 16, 2010

Page 73: Mobile Development with uPortal and Infusion

Model-Driven Rendering

• Data feed-oriented

• Model, View, no controller

• You give us JSON, we render it for you

• Template and styles are fully customizable

Tuesday, March 16, 2010

Page 74: Mobile Development with uPortal and Infusion

Navigation List Illustrated

Tuesday, March 16, 2010

Page 75: Mobile Development with uPortal and Infusion

Navigation List: StructureComponent’s Container

Tuesday, March 16, 2010

Page 76: Mobile Development with uPortal and Infusion

Navigation List: StructureComponent’s Container

List Item

Tuesday, March 16, 2010

Page 77: Mobile Development with uPortal and Infusion

Navigation List: StructureComponent’s Container

Thumbnail

List Item

Tuesday, March 16, 2010

Page 78: Mobile Development with uPortal and Infusion

Navigation List: StructureComponent’s Container

ThumbnailTitle

List Item

Tuesday, March 16, 2010

Page 79: Mobile Development with uPortal and Infusion

Navigation List: Markup<div class="flc-navigationList"> <ul class="flc-navigationList-listGroup fl-navigationList-container fl-list fl-list-menu fl-list-thumbnails">    <li class="flc-navigationList-items">        <div class="flc-navigationList-linkContainer">            <a class="flc-navigationList-link fl-engage-badged-thumbnail">                <img class="flc-navigationList-image fl-icon"/>                <div class="fl-navigationList-textContainer">                <span class="flc-navigationList-titleText fl-navigationList-title"> Title </span>

<span class="flc-navigationList-descriptionText fl-link-summary fl-navigationList-description">

Description </span>                </div>                </a>            </div>        </li> </ul></div>

Component’s Container

Tuesday, March 16, 2010

Page 80: Mobile Development with uPortal and Infusion

Navigation List: Markup<div class="flc-navigationList"> <ul class="flc-navigationList-listGroup fl-navigationList-container fl-list fl-list-menu fl-list-thumbnails">    <li class="flc-navigationList-items">        <div class="flc-navigationList-linkContainer">            <a class="flc-navigationList-link fl-engage-badged-thumbnail">                <img class="flc-navigationList-image fl-icon"/>                <div class="fl-navigationList-textContainer">                <span class="flc-navigationList-titleText fl-navigationList-title"> Title </span>

<span class="flc-navigationList-descriptionText fl-link-summary fl-navigationList-description">

Description </span>                </div>                </a>            </div>        </li> </ul></div>

Component’s Container

List item template

Tuesday, March 16, 2010

Page 81: Mobile Development with uPortal and Infusion

Navigation List: Markup<div class="flc-navigationList"> <ul class="flc-navigationList-listGroup fl-navigationList-container fl-list fl-list-menu fl-list-thumbnails">    <li class="flc-navigationList-items">        <div class="flc-navigationList-linkContainer">            <a class="flc-navigationList-link fl-engage-badged-thumbnail">                <img class="flc-navigationList-image fl-icon"/>                <div class="fl-navigationList-textContainer">                <span class="flc-navigationList-titleText fl-navigationList-title"> Title </span>

<span class="flc-navigationList-descriptionText fl-link-summary fl-navigationList-description">

Description </span>                </div>                </a>            </div>        </li> </ul></div>

Component’s Container

List item template

Thumbnail

Tuesday, March 16, 2010

Page 82: Mobile Development with uPortal and Infusion

Navigation List: Markup<div class="flc-navigationList"> <ul class="flc-navigationList-listGroup fl-navigationList-container fl-list fl-list-menu fl-list-thumbnails">    <li class="flc-navigationList-items">        <div class="flc-navigationList-linkContainer">            <a class="flc-navigationList-link fl-engage-badged-thumbnail">                <img class="flc-navigationList-image fl-icon"/>                <div class="fl-navigationList-textContainer">                <span class="flc-navigationList-titleText fl-navigationList-title"> Title </span>

<span class="flc-navigationList-descriptionText fl-link-summary fl-navigationList-description">

Description </span>                </div>                </a>            </div>        </li> </ul></div>

Component’s Container

List item template

Thumbnail Title

Tuesday, March 16, 2010

Page 83: Mobile Development with uPortal and Infusion

Navigation List: Markup<div class="flc-navigationList"> <ul class="flc-navigationList-listGroup fl-navigationList-container fl-list fl-list-menu fl-list-thumbnails">    <li class="flc-navigationList-items">        <div class="flc-navigationList-linkContainer">            <a class="flc-navigationList-link fl-engage-badged-thumbnail">                <img class="flc-navigationList-image fl-icon"/>                <div class="fl-navigationList-textContainer">                <span class="flc-navigationList-titleText fl-navigationList-title"> Title </span>

<span class="flc-navigationList-descriptionText fl-link-summary fl-navigationList-description">

Description </span>                </div>                </a>            </div>        </li> </ul></div>

Component’s Container

List item template

Thumbnail

Description

Title

Tuesday, March 16, 2010

Page 84: Mobile Development with uPortal and Infusion

Nav List’s Model

[{image: “http://myServer.org/pic.png”,target: “/viewImage?pic=12345”,title: “My Great Picture!”,description: “A picture of my moustache.”

},{image: “http://myServer.org/anotherPic.png”,target: “/viewImage?pic=67890”,title: “This picture, not so good.”,description: “A picture of my cat.”

}]

Tuesday, March 16, 2010

Page 85: Mobile Development with uPortal and Infusion

Domain Model: Flickr[{

"id":"4366552930", "owner":"29979136@N03", "secret":"30a7167c6a", "server":"2777", "farm":3, "title":"Town and Country Resort", "ispublic":1, "isfriend":0, "isfamily":0},

{ "id":"4365808141", "owner":"29979136@N03", "secret":"2c818b926e", "server":"4058", "farm":5, "title":"Resort Pool", "ispublic":1, "isfriend":0, "isfamily":0 }]

Tuesday, March 16, 2010

Page 86: Mobile Development with uPortal and Infusion

Transforming Your Model

var imageURLTemplate = "http://farm%farm.static.flickr.com/%server/%id_%secret_m.jpg";var userPageURLTemplate = "http://www.flickr.com/photos/%owner/%id";

var mapData = function (flickrData) { var navListModel = fluid.transform(flickrData.photos.photo, function (photo) { return { image: fluid.stringTemplate(imageURLTemplate, photo), target: fluid.stringTemplate(userPageURLTemplate, photo), title: photo.title }; });};

Tuesday, March 16, 2010

Page 87: Mobile Development with uPortal and Infusion

Creating a Nav List

var templateURL = "../../../fluid-engage-core/components/” + “navigationList/html/” + “NavigationList.html .flc-navigationList";

// Load Nav List’s HTML template via AJAXcontainer.load(templateURL, null, function () { // When the template has loaded, instantiate a Nav List var navList = fluid.navigationList(container, { model: mapData(jasigFlickrPhotos) });});

Tuesday, March 16, 2010

Page 88: Mobile Development with uPortal and Infusion

Optimizing Performance

Tuesday, March 16, 2010

Page 89: Mobile Development with uPortal and Infusion

Will My Web Site Scale?

Yes...

...and no.

Tuesday, March 16, 2010

Page 90: Mobile Development with uPortal and Infusion

Will My Web Site Scale?

jQuery Unconcatenated ConcatenatedWi-Fi

3G

2.151 3.216 2.78

5.121 6.29 4.99

2.151

3.2162.780

5.121

6.290

4.990

jQuery Unconcatenated Concatenated

Wi-Fi 3G

Tuesday, March 16, 2010

Page 91: Mobile Development with uPortal and Infusion

Mobile Performance Factors

• Great browsers make us forget the CPU

• At heart, mobile apps are heavily CPU-bound

• Connection limitations:

• Often slow (EDGE vs. 3G vs. WiFi)

• Often flakey

Tuesday, March 16, 2010

Page 92: Mobile Development with uPortal and Infusion

Performance Heuristics

• Connection speed: minimize server roundtrips

• CPU speed: minimize JavaScript evaluation

Tuesday, March 16, 2010

Page 93: Mobile Development with uPortal and Infusion

Device Constraints

How fast is your desktop computer?

Tuesday, March 16, 2010

Page 94: Mobile Development with uPortal and Infusion

Mobile Device Constraints

iPhone 3G 412 MHz

iPhone 3GS 600 MHz

Android G1 528 MHz

Motorola Droid 550 MHz

Nexus One 1 GHz

Tuesday, March 16, 2010

Page 95: Mobile Development with uPortal and Infusion

Minimize Server Roundtrips

• Minify JavaScript and CSS

• Concatenate JavaScript resources

• Use image sprites

Tuesday, March 16, 2010

Page 96: Mobile Development with uPortal and Infusion

Minimize JavaScript eval()

• Your code will start up way slower on mobile

• Don’t load the same JS over and over again

• Carefully consider dependencies

• Use an all-in-one page style: Screen Navigator

Tuesday, March 16, 2010

Page 97: Mobile Development with uPortal and Infusion

Using Screen Navigator

Tuesday, March 16, 2010

Page 98: Mobile Development with uPortal and Infusion

Screen Navigator

• All in one page idiom: no full page transitions

• Load shared dependencies up-front

• Lazily load unique dependencies

• A mini, client-side AJAX portal

• Unobtrusive: content still works like it used to

Tuesday, March 16, 2010

Page 99: Mobile Development with uPortal and Infusion

Screen Navigator Illustrated

XHR

Tuesday, March 16, 2010

Page 100: Mobile Development with uPortal and Infusion

Screen Navigator: How it Works

• Intercepts all potential page transitions

• Link clicks, form submits, etc.

• Loads the href via AJAX

• Compares scripts and links: only injects new stuff

• Injects the page’s body into a <div>

Tuesday, March 16, 2010

Page 102: Mobile Development with uPortal and Infusion

Screen Navigator: Markup<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <link rel="apple-touch-icon" href="../../../../fluid-engage-core/components/home/images/apple-touch-icon.png"/> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <title>McCord</title>

<link rel="apple-touch-icon" href="../../../../fluid-engage-core/components/home/images/apple-touch-icon.png"/>

<!-- Your stylesheets go here --><!-- Your JavaScript dependencies go here -->

<!-- Screen Navigator’s dependencies --><script type="text/javascript" src="../../../../fluid-infusion/src/webapp/lib/jquery/core/js/jquery.js"></script><script type="text/javascript" src="../../../../fluid-infusion/src/webapp/lib/json/js/json2.js"></script><script type="text/javascript" src="../../../../fluid-infusion/src/webapp/framework/core/js/Fluid.js"></script>

<script type="text/javascript" src="../../../../fluid-engage-core/framework/js/kettleCore.js"></script> <script type="text/javascript" src="../../../../fluid-engage-core/framework/js/URLUtilities.js"></script> <script type="text/javascript" src="../../../../fluid-engage-core/lib/jquery/plugins/hashchange/js/jquery.ba-hashchange.js"></script>

<!-- Screen Navigator itself --> <script type="text/javascript" src="../js/condenser.js"></script> </head> <body class="fl-theme-iphone fl-home-white-background">

<div class="flc-navigator-portal"> </div>

</body></html>

Empty Container

Shared Dependencies

Tuesday, March 16, 2010

Page 103: Mobile Development with uPortal and Infusion

Instantiating Screen Navigator

fluid.engage.screenNavigator(".flc-navigator-portal", "../app/home.html");

Tuesday, March 16, 2010

Page 104: Mobile Development with uPortal and Infusion

Fluid Engage Code Tour?

Tuesday, March 16, 2010

Page 105: Mobile Development with uPortal and Infusion

Questions?

Tuesday, March 16, 2010