Slide 1

Slide 1 text

Rhodes jonathan.wallace Tuesday, February 5, 13

Slide 2

Slide 2 text

About Me http://www.san-smith.com/ Tuesday, February 5, 13

Slide 3

Slide 3 text

github: wallace Tuesday, February 5, 13

Slide 4

Slide 4 text

twitter: jonathanwallace Tuesday, February 5, 13

Slide 5

Slide 5 text

blog: blog.jonathanrwallace.com Tuesday, February 5, 13

Slide 6

Slide 6 text

work: highgroove.com Tuesday, February 5, 13

Slide 7

Slide 7 text

About Rhodes Tuesday, February 5, 13 let’s talk about rhodes: cross platform smart phone app development framework but first! a quick tangent

Slide 8

Slide 8 text

lots of reasons to get into web development Tuesday, February 5, 13

Slide 9

Slide 9 text

money! http://www.flickr.com/photos/epsos/5394616925/ Tuesday, February 5, 13

Slide 10

Slide 10 text

fame! Tuesday, February 5, 13

Slide 11

Slide 11 text

power! http://www.flickr.com/photos/75905404@N00/490945925/ Tuesday, February 5, 13

Slide 12

Slide 12 text

cross-platform!!!!!!! Tuesday, February 5, 13 you can build on mac, windows or linux. to build for specific devices, you have to have the device SDK installed. in other words, you must have xcode, and therefore mac os x, installed for an iphone build targeted towards enterprise apps. what’s that mean? its not good for games or graphic intensive apps or platform-specific native UI controls. if you were planning to build the next angry birds, you can leave now.

Slide 13

Slide 13 text

Required software • Ruby 1.8.6 or 1.8.7 • RubyGems 1.3.5 or greater • GNU make 3.8 Tuesday, February 5, 13 what extensions need to be built?

Slide 14

Slide 14 text

Web server in an app! • MVC • user interface is HTML/CSS • UI rendered in native browser UI control embedded in your phone app Tuesday, February 5, 13 wehn you run the rake task to build your application, you get a web server in an app

Slide 15

Slide 15 text

What you need to know • html • css • javascript • ruby Tuesday, February 5, 13 so i’m telling you that you only need to know web development skills to build an iphone, android, or windows mobile app?

Slide 16

Slide 16 text

What’s it mean to be native? Tuesday, February 5, 13 talk about how you can have a link on your iphone screen to a web app

Slide 17

Slide 17 text

Native App Pros • submit to app marketplace Tuesday, February 5, 13

Slide 18

Slide 18 text

Native App Cons • sign up for each app marketplace Tuesday, February 5, 13 this also means you need an computer environment to set up the SDK. i.e., mac for iphone, windows for windows mobile, etc.

Slide 19

Slide 19 text

Details • blackberry: compiled to Java bytecode • iPhone, Android, and Windows Mobile: compiled to ruby 1.9 bytecode; small ruby executor included w/app • Rhodes ruby is a subset of 1.9 Tuesday, February 5, 13

Slide 20

Slide 20 text

NO EVAL • why? • iPhone App Store’s Rule 3.3.2 • “An Application may not itself install or launch other executable code by any means, including without limitation through the use of a plug-in architecture, calling other frameworks, other APIs or otherwise. No interpreted code may be downloaded and used in an Application except for code that is interpreted and run by Apple’s Published APIs and built-in interpreter(s).” (www.rhomobile.com/blog/2009/05/29/iphone-app-store- rules-and-guidelines-on-use-of-frameworks/) Tuesday, February 5, 13

Slide 21

Slide 21 text

Differences from Rails • no model directory; each model is its own directory • no validations • must compile code and run in a simulator/ device to execute it • much smaller and simpler Tuesday, February 5, 13

Slide 22

Slide 22 text

latest version: 2.3.2 http://docs.rhomobile.com/rhodes/device-caps Tuesday, February 5, 13

Slide 23

Slide 23 text

RHOM • mini object-mapper • “property bag” database • local device-side db like SQLite or HSQLDB Tuesday, February 5, 13

Slide 24

Slide 24 text

Example Tuesday, February 5, 13 Pros • Simple to use, it doesn’t require specifying attributes. • Data migrations are not necessary. • Attributes can be added or removed without modifying the database schema. Cons: • db size: For some applications, the database size may be significantly larger than fixed schema. This is because each attribute is indexed for fast lookup. • slower Sync: process may be slightly slower because inserts are performed at attribute level.

Slide 25

Slide 25 text

Property bag model (Entity-Attribute-Value) http://docs.rhomobile.com/rhodes/rhom Tuesday, February 5, 13

Slide 26

Slide 26 text

Fixed Schema http://docs.rhomobile.com/rhodes/rhom Tuesday, February 5, 13 each model has a separate table

Slide 27

Slide 27 text

Shared Features http://docs.rhomobile.com/rhodes/rhom Tuesday, February 5, 13

Slide 28

Slide 28 text

http://docs.rhomobile.com/rhodes/rhom Share Features (cont’d) Tuesday, February 5, 13

Slide 29

Slide 29 text

Fixed Schema features http://docs.rhomobile.com/rhodes/rhom Tuesday, February 5, 13 Fixed Schema Advantages • Smaller database size, indexes can be specified only on specific attributes. • Sync process may perform faster because whole objects are inserted at a time. Fixed Schema Disadvantages • Schema changes must be handled with data migrations. • Database performance may be slow unless you specify proper indexes. When the application starts the first time after an update, the database will be (re)created if theapp_db_version in rhoconfig.txt is different from what existed before. If the database is recreated, the existing database is removed along with all data. on_migrate_source(old_version, new_src)

Slide 30

Slide 30 text

Rhom API • CRUD (create, update, destroy, delete_all, update_attributes, save) • paginate • find(*args) (:all, :first, :count, :conditions, :order, :orderdir, :select, :per_page, :offset) • find_by_sql <-- only for fixed schema Tuesday, February 5, 13 find_by_sql is SLOW! only works for fixed schema

Slide 31

Slide 31 text

Tuesday, February 5, 13

Slide 32

Slide 32 text

Associations • only used for managing synchronization between sync models Tuesday, February 5, 13

Slide 33

Slide 33 text

Rhom API Sync • sync • set_notification callback • can_modify <-- per object • changed? <-- per object • clear_notification <-- per object Tuesday, February 5, 13

Slide 34

Slide 34 text

Web services? • Oh yes, use RhoSync • or direct via: • JavaScript • Ruby net/http • Rho:AsyncHttp Tuesday, February 5, 13 • <-- how you gonna handle the response w/native controls? • <-- not reasonable

Slide 35

Slide 35 text

Threading? • Three main threads • Main UI thread • Ruby thread • Sync thread • Auxiliary threads (notifications, geolocation, client registration and push) ^-- short lived Tuesday, February 5, 13

Slide 36

Slide 36 text

The View • Uses a layout.erb like rails • Custom CSS framework • Modified JQTouch (version 1, beta 2) Tuesday, February 5, 13

Slide 37

Slide 37 text

Let’s look at some code and talk about: • App initialization • App structure • Views Tuesday, February 5, 13

Slide 38

Slide 38 text

Questions? Tuesday, February 5, 13

Slide 39

Slide 39 text

Credits • http://en.wikipedia.org/wiki/Cross-platform • http://www.apress.com/9781430228684 ^--- pro smartphone cross platform development • http://www.san-smith.com/ • http://docs.rhomobile.com/ Tuesday, February 5, 13