We don’t need no stinkin app server! Building a Two-Tier Mobile App

Uploaded on

Slides from my 5/23/2012 Gluecon 2012 session.

Slides from my 5/23/2012 Gluecon 2012 session.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide
  • The traditional 3-tier architecture – web server, app server, database.
  • Back in the days of Web 1.0, we served up web pages to browsers…
  • …this required lots of code on the app server to retrieve data from the database and render it into those web pages, but very little code in the browser.
  • Web 2.0 brought Ajax, so the amount of code in the browser increased as JavaScript retrieved data from the app server. Code on the app server shrank, since it was easier to return data than render a page.
  • Now, websites such as Twitter use the page as a vehicle for a complete JavaScript web app that does all the retrieval and rendering of data. The back end shrinks again.
  • Mobile enters the mix, and mobile apps running on the device do away with web pages altogether…
  • …so you no longer need the web tier. The app server is reduced to marshalling data in and out of the database. What if the database itself spoke JSON over HTTP?
  • This is the basis of the 2-tier architecture – app executing on the device interacting directly with a Database-as-a-Service. Still some code in the back-end for data validation, actions on triggers etc.
  • Technology on the device is iOS or Android. I’ve heard there are other alternatives, but I rarely see them!
  • A plethora of choices for the back end. These are all online services that talk JSON-over-HTTP.
  • Every element of data and metadata in database.com is accessible by an HTTP operation on a URL.
  • Native apps look great, perform well, but are more difficult to write than web apps. Web apps, on the other hand, can’t access device functionality such as the camera. Hybrid mobile app platforms such as PhoneGap offer a middle way – write your app in HTML/CSS/JS, but get access to device features, and package the app for distribution via the AppStore.
  • https://github.com/forcedotcom/SalesforceMobileSDK-iOShttps://github.com/forcedotcom/SalesforceMobileSDK-Androidhttps://github.com/forcedotcom/SalesforceMobileSDK-Samples


  • 1. We Don’t Need No Stinkin’ App Server! Building a Two-Tier Mobile App Pat Patterson @metadaddy Principal Developer Evangelist salesforce.com
  • 2. Safe HarborSafe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may containforward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or ifany of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the resultsexpressed or implied by the forward-looking statements we make. All statements other than statements of historicalfact could be deemed forward-looking, including any projections of subscriber growth, earnings, revenues, or otherfinancial items and any statements regarding strategies or plans of management for future operations, statements ofbelief, any statements concerning new, planned, or upgraded services or technology developments and customercontracts or use of our services.The risks and uncertainties referred to above include – but are not limited to – risks associated with developing anddelivering new functionality for our service, our new business model, our past operating losses, possible fluctuations inour operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures,the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, andmotivate our employees and manage our growth, new releases of our service and successful customer deployment,and utilization and selling to larger enterprise customers. Further information on potential factors that could affect thefinancial results of salesforce.com, inc. is included in our annual report on Form 10-K filed on March 9, 2012 and inother filings with the Securities and Exchange Commission. These documents are available on the SEC Filings section ofthe Investor Information section of our Web site.Any unreleased services or features referenced in this or other press releases or public statements are not currentlyavailable and may not be delivered on time or at all. Customers who purchase our services should make the purchasedecisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does notintend to update these forward-looking statements.
  • 3. Agenda• Database-as-a-Service• Hybrid Mobile App Frameworks• Combining the two approaches for rapid mobile app development
  • 4. Agenda• Database-as-a-Service• Hybrid Mobile App Frameworks• Combining the two approaches for rapid mobile app development
  • 5. 3-Tier Architecture
  • 6. 3-Tier Architecture
  • 7. 3-Tier Architecture
  • 8. 3-Tier Architecture
  • 9. 3-Tier Architecture
  • 10. 3-Tier Architecture
  • 11. 3-Tier Architecture
  • 12. 2-Tier Architecture
  • 13. 2-Tier Architecture iOSAndroid
  • 14. 2-Tier Architecture database.com iOS SimpleDB/DynamoDBAndroid GAE Datastore CouchDB MongoDB …
  • 15. RESTful Database APIResource Name URI DescriptionVersions / List of supported API versionsResources by /vXX.X/ Available resources for this versionVersionDescribe Global /vXX.X/sobjects/ Available objects and metadataSObject Basic Info /vXX.X/sobjects/SObject/ Metadata for objectSObject Describe /vXX.X/sobjects/SObject/describe/ Metadata for object fields etcSObject Rows /vXX.X/sobjects/SObject/id/ Access record by native IDSObject Rows by /vXX.X/sobjects/SObject/fieldName/fieldValue Access record by external IDExternal IDUser Password /vXX.X/sobjects/User/userId/password Set/reset user passwordQuery /vXX.X/query/?q=soql SOQL querySearch /vXX.X/search/?s=sosl SOSL query http://www.salesforce.com/us/developer/docs/dbcom_api_rest/index.htm
  • 16. Agenda• Database-as-a-Service• Hybrid Mobile App Frameworks• Combining the two approaches for rapid mobile app development
  • 17. Agenda• Database-as-a-Service• Hybrid Mobile App Frameworks• Combining the two approaches for rapid mobile app development
  • 18. Mobile App Spectrum Native Hybrid Web HTML5 + HTML5 +Objective C / CSS + CSS + Java JavaScript JavaScript
  • 19. Atwood’s Law“Any application that can be written inJavaScript, will eventually be written in JavaScript.” http://www.codinghorror.com/blog/2007/07/the-principle-of-least-power.html
  • 20. Proof Point: LinkedIn iPad App “Yes, only one screen in the entire LinkedIn iPad app is actually native. The rest is good ol’ HTML5-basedmobile web technology, running in the browser.” http://venturebeat.com/2012/05/02/linkedin-ipad-app-engineering/
  • 21. Hybrid Mobile App Platforms• Apache Cordova (aka [Adobe] PhoneGap)• Trigger.io• Appcelerator Titanium• Ansca Corona• Many, many, more – http://en.wikipedia.org/wiki/Mobile_application_development
  • 22. Salesforce Mobile SDK• Hybrid support built on PhoneGap 1.2 + OAuth 2.0 built in + JavaScript binding to database.com REST API• Current Version 1.1 – Added Secure Offline API, more flexible OAuth 2.0 and more• Version 1.2 coming soon – Adds PIN protection, session timeout and more 2012 1.0 1.1 1.2 Dec 2011 Mar 2012 Soon! • And…
  • 23. It’s 100% open source
  • 24. Agenda• Database-as-a-Service• Hybrid Mobile App Frameworks• Combining the two approaches for rapid mobile app development
  • 25. Agenda• Database-as-a-Service• Hybrid Mobile App Frameworks• Combining the two approaches for rapid mobile app development
  • 26. Code Time…http://bit.ly/gc12-mobile-demo
  • 27. Conclusion• Database-as-a-Service can dramatically simplify your web app’s back end• Frameworks such as Apache Cordova accelerate mobile app development• Combine the two for rapid mobile app development
  • 28. Thank You! Pat Patterson @metadaddy Principal Developer Evangelist salesforce.com