34
ITALIAN RUBY DAY, 10 GIUGNO 2011 Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra Matteo Collina Daniele Bottillo @matteocollina @cribcaged7

Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Designing and developingmobile web applications withMockup, Sencha Touch and Sinatra

Matteo Collina

Daniele Bottillo

@matteocollina

@cribcaged7

Page 2: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Who is Mavigex

Mavigex is an academic spin-off of the University of Bologna which focuseson:

• Mobile applications

• Digital signage

• VoIP applications

• Mobile broadcasting

Page 3: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Who We Are

Daniele Bottillo:

Web mobile designer and developer

@cribcaged7

Matteo Collina:

Software Engineer

Ph.D. Candidate @ UoB

@matteocollina

Page 4: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Mobile Web Apps?

Page 5: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

vs

HTML5 and CSS3:

Look & Feel similar tonative applications

Advanced graphicseffects (gradients, fades, slides…)

Page 6: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

vs

Javascript:

Everybody think theyknow it :-)

Powerful language just like Java and Obj-C

Several frameworks formobile development

Page 7: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

vs

Native Applications:

Full control of the Hardware

Maximum Performance

IDEs (Xcode, Eclipse)

Page 8: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

vs

PhoneGap:

Allows to reach AppStores with Mobile Web Apps

Full hardware access

Mixed Native/Web code

Limited performances

Page 9: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Write

Test

Build

Development Process

Write

Test

Build

Native Approach

Write

Test

Build Build

Hybrid Approach

Less Work =

Less €

More Work =

More €

Page 10: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Javascript Frameworks

Page 11: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

• enhanches existing mobile web sites

• has unobtrusive behaviour

• is not structured enough for a full applicationdevelopment

• has small Javascript & CSS Files

• supports many devices

• is in alpha status

Page 12: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

• derives from ExtJS

• has MVC structure

• has the Look & Feel of native applications

• has big Javascript & CSS files

• is stable (but not bug free, and you?)

Page 13: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Backend Technologies

Page 14: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Frontend + Backend

Native Apps

The frontend and the backend are

developed separately

Often there is no backend

When backend

functionality isneeded, the integration is complex

Mobile Web Apps

Frontend and Backendare tightly bound

As often as not there

is a backend

Easy sharing of data between the browser

and the JSON APIs

Page 15: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Backend Requirements

REST principles

Exposure of JSON APIs

Fast-Fast development

Easy HTTP caching

Easy testing

Easy deployment

Page 16: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Ruby + Sinatra

REST is just built-in

JSON conversion is just a method callaway

Really flexible APIs for HTTP caching

Community mad with testing

Page 17: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Ruby + Sinatra

require 'sinatra'

get '/hi' do

"Hello World!"

end

Page 18: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

An IntegratedDevelopment Process

Page 19: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Development ProcessProblem

Definition

Mockups

JSON API definition

DevelopmentTesting

Deployment

Refactoring

Page 20: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Problem DefinitionGeoReview

A simple geo localized App to reviewlocations. A user can:

Enter a star-based review of some coordinates

View all the reviews in a map

View the review details of a point

Page 21: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

GeoReview

The GeoReview App

is available at: georeview.mavigex.com

is downloadable from the Android Market

is open source software, and the repository are on github: App PhoneGapIntegration

is not bug free, but who it is?

Page 22: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

MockupsGeoReview

Page 23: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

MockupsGeoReview

Page 24: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

JSON APIsGeoReview

• POST /reviews

– params:

{ review:{ name: “Pippo”, stars:

3, comment: “the comment”,

location: “…” } }

– response:

{ result: true }

Page 25: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

JSON APIsGeoReview

• GET /reviews– params:

{ lat: “..”, lng: “..”, radius: “..”}

– response:{ status: true,

reviews:

[ { items:

[ { name:"rff", comment:"fff", stars:4} ],

total:1, lng:11.35, lat:44.49},

{ items:

[ { name: “gggg", comment:"Ggg",

stars: 5 } ],

total: 1, lng :11.35, lat:44.49 } ] }

Page 26: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Developing with SenchaGeoReview

Getting started:

• Download Sencha Touch

• Create an empty index.html

• Include the JS+CSS libraries

Page 27: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Developing with SenchaGeoReview

Sencha Touch is a MVC framework,

what does it mean?

• Views and models are separated

• Controllers perform actions

• Every component has its own definition

Page 28: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Developing with SenchaGeoReview

Viewport

MapContainer

Map

InsertReview

ListReviewAbout

Organization views:

Page 29: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

CSS GenerationGeoReview

Sencha Touch allows to becustomized by regeneratingits CSS:

to change the ‘basecolor’

to bundle only the partsyou need

to do some crazy CSS personalization, like inliningimages

Page 31: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

DeploymentGeoReview

We deployed our mobile web app on Heroku:

heroku create

heroku addons:add mongohq:free

git push heroku

Page 32: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Testing

We have a full department of testers!

Page 33: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Links

• Mavigex: http://www.mavigex.com

• GeoReview: http://georeview.mavigex.com

• Sencha: http://www.sencha.com

• Sinatra: http://www.sinatrarb.com

• Ruby: http://www.ruby-lang.org

• Compass: http://compass-style.org/

• Heroku: http://www.heroku.com

• MongoDB: http://www.mongodb.org

Page 34: Designing and developing mobile web applications with Mockup, Sencha Touch and Sinatra @RubyDay

ITALIAN RUBY DAY, 10 GIUGNO 2011

Thank You!