SlideShare a Scribd company logo
Building Mobile Apps with
PhoneGap & Backbone
28 January 2014
Who am I?
Hi, I’m Troy. I have been developing software for over 30
years. For the last 12 years I have been focused on web,
mobile web, and mobile development. I currently work at
Kelley Blue Book as a senior software engineer. My
opinions are my own.	

!

I can be reached rockncoder@gmail.com
Free mobile tutorials with source
code @ therockncoder.blogspot.com
Want more? Follow me, new tutorials are
announced on Twitter first:
@therockncoder
Source code for my tutorials hosted on
GitHub @
https://github.com/Rockncoder
Check out my videos:
www.youtube.com/rockncoder
Agenda
• A Quick & Dirty JavaScript Overview 	

• What is PhoneGap?	

• Building PhoneGap Apps	

• Backbone	

• Underscore
Agenda
• Models	

• Collections	

• Views 	

• The Router	

• Templates	

• Chocolate Chip
Agenda
• Lists	

• Widgets	

• Look and Feel	

• Google Maps	

• Debugging	

• Summary
Quick & Dirty
JavaScript
JavaScript Best
Practices
• Avoid sloppy JavaScript	

• Avoid the Global Space	

• Encapsulate Code into Objects	

• Use Design Patterns
Avoid Sloppy JavaScript
• Use “strict” mode	

• Always use ‘===’ & ‘!==’	

• Code in JavaScript not C#, Java, Ruby, etc.	

• Use JSLint or JSHint
Avoid the Global Space
• Minimize use of global variables	

• Use Name-spacing	

• Use anonymous/immediate functions when
appropriate
Use Design Patterns
• Singleton	

• Chaining	

• Revealing Module Structure
• + many more
Functions
• Functions are a first class type	

• Like other types they can be passed and
assigned freely	


• Anonymous functions are used frequently
Objects
• Objects are some what like Key/Value
dictionaries in other languages	


• The Key can be anything when wrapped in
quotes	


• The Value can be any type including a
function
Events
• Events allow for excellent separation of
concerns	


• You can listen for system events or	

• Trigger and respond to your own	

• Many external libraries will communicate
via events
Deferred Objects
• A rather new JavaScript concept	

• Used to register multiple callbacks	

• The app uses jQuery’s version
What is PhoneGap?
• Created by Nitobi in 2009 at an Apple
Event	


• Nitobi was acquired by Adobe	

• Open sourced as Apache Cordova	

• PhoneGap is only one implementation
Other Cordova
Implementations
• appMobi	

• Convertigo	

• Icenium (Telerik)	

• ViziApps	

• Worklight (IBM)
PhoneGap
• Current release is 3.3	

• Node.js is a hard requirement since version
3.0	


• It is all command line instead of IDE	

• Recommend not upgrading your app to a
new version right away
How it Works?
• Most device APIs include an internal web
browser	


• PhoneGap uses this internal web browser
as its app canvas	


• It adds more features to the navigator via
software which bridges the gap between
the internal web and the device
Setting up your
environment
• Setup Device specific frameworks:	

• Install Xcode	

• Install Android Dev Kit	

• Install Node.js	

• Download Cordova CLI
Building PhoneGap
Apps
• cordova precedes all commands	

• cordova create	

• cordova
Underscore
• A utility belt library for JavaScript	

• Excellent at manipulating objects and
collections	


• About 5kb minified and compressed	

• Required for Backbone apps
Backbone
• A MV* Framework	

• Note: There are no controllers hence no
‘C’	


• More lightweight than Angular or Ember	

• Requires jQuery and Underscore
Models
• The base object in Backbone	

• Essentially a wrapper around a JavaScript
object	


• Use get and set command to access
properties
Collections
• A collection of models	

• Can associate a URL with a collection	

• Backbone native support of RESTful API	

• Can also use third party API
Views
• Backbone’s UI layer	

• Also does much of what a controller would
do in typical MVC
The Router
• The router controls application state	

• In a web site it would control what is in the
URL bar	


• PhoneGap apps may lack a visible URL bar,
but it still exists
Templates
• Templates render markup to the DOM in a
cookie cutter fashion	


• Especially good for render collections to a
view	


• Make it easier to create single page apps
Chocolate Chip
• A UI Framework akin to jQuery Mobile or
even Bootstrap	


• Does a great job of impersonating iOS 7,
Android 4+, and Windows Phone 8
Lists
• You will work a lot with lists in mobile apps	

• In CC, lists will have the look and feel of
the device	


• Lists typically will need a bit of code to
make them fully functional
Lists
• Lists have classes which enhance their
looks	


• Classes exists to indicate:	

• Navigation to another page	

• Navigation to a details page
Widgets
• CC uses a combo of its own stuff with
HTML5	


• For example the Range Slider is simply an
HTML5 input type=range	


• But a switch is a combination of HTML,
CSS3, and JavaScript
Look and Feel
• Switching the look and feel is easy, just
change CSS files	


• PhoneGap version 3+ automates the
process
Look and Feel
• iOS 7: chui-ios-3.5.0.css	

• Android 4+: chui-android-3.5.0.css	

• Windows Phone 8: chui-win-3.5.0.css
Look and Feel
• PhoneGap’s merges folder 	

• one directory for each supported device	

• Its contents will be copied and overwrite
during the build command	


• Name all of the css files identically 	

• Place in each appropriate folder
Location & Maps
Location
• Use HTML5 location services	

• Both location watching and current
location used in the app	


• Recommend giving users an alternative if
they prefer not sharing their location
Google Maps
• Google Maps works on both iPhone and
Android without code change	


• Google also provides reverse geocoding
API	


• Reverse geocoding turns some part of an
address into a lat/long
Debugging	

• No getting around it debugging PhoneGap
apps suck	


• Best work around I have is console.log and
using a browser	


• Some like the Ripple emulator
What We Learned
• Some JavaScript Best Practice	

• How to use PhoneGap and Backbone to
make mobile apps	


• How to use one codebase to support
multiple devices	


• How to go from web to app
Links
• http://jquery.com/ 	

• http://documentcloud.github.io/backbone/	

• http://www.chocolatechip-ui.com/	

• https://developers.google.com/maps/	

• http://blog.mediumequalsmessage.com/

promise-deferred-objects-in-javascript-pt1theory-and-semantics
The Rock n Coder
• http://therockncoder.blogspot.com	

• http://www.youtube.com/user/rockncoder	

• https://github.com/Rockncoder	

• http://www.slideshare.net/rockncoder

More Related Content

What's hot (20)

I knew there had to be a better way to build mobile apps
I knew there had to be a better way to build mobile appsI knew there had to be a better way to build mobile apps
I knew there had to be a better way to build mobile apps
Alius Petraška
 
Xamarin.Forms Bootcamp
Xamarin.Forms BootcampXamarin.Forms Bootcamp
Xamarin.Forms Bootcamp
Mike Melusky
 
Mobile Fest 2018. Илья Иванов. Как React-Native перевернул наше представление...
Mobile Fest 2018. Илья Иванов. Как React-Native перевернул наше представление...Mobile Fest 2018. Илья Иванов. Как React-Native перевернул наше представление...
Mobile Fest 2018. Илья Иванов. Как React-Native перевернул наше представление...
MobileFest2018
 
Phonegap Day 2016: Ember/JS & Hybrid Apps Tips
Phonegap Day 2016: Ember/JS & Hybrid Apps TipsPhonegap Day 2016: Ember/JS & Hybrid Apps Tips
Phonegap Day 2016: Ember/JS & Hybrid Apps Tips
Alex Blom
 
Engage 2019 - De04. Java with Domino After XPages
Engage 2019 - De04. Java with Domino After XPagesEngage 2019 - De04. Java with Domino After XPages
Engage 2019 - De04. Java with Domino After XPages
Jesse Gallagher
 
How native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App DevelopmentHow native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App Development
Devathon
 
Mobile Architecture Comparison
Mobile Architecture ComparisonMobile Architecture Comparison
Mobile Architecture Comparison
Jonathan Bender
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
Troy Miles
 
Cache me if you can
Cache me if you canCache me if you can
Cache me if you can
Robbie Clutton
 
Finding the sweet spot - blending the best of native and web
Finding the sweet spot - blending the best of native and webFinding the sweet spot - blending the best of native and web
Finding the sweet spot - blending the best of native and web
Shawn Jansepar
 
Introduction to the Ionic Framework
Introduction to the Ionic FrameworkIntroduction to the Ionic Framework
Introduction to the Ionic Framework
rrjohnson85
 
How to Successfully Implement Headless Drupal
How to Successfully Implement Headless DrupalHow to Successfully Implement Headless Drupal
How to Successfully Implement Headless Drupal
Acquia
 
Creating a Comprehensive Social Media App Using Ionic and Phone Gap
Creating a Comprehensive Social Media App Using Ionic and Phone GapCreating a Comprehensive Social Media App Using Ionic and Phone Gap
Creating a Comprehensive Social Media App Using Ionic and Phone Gap
FITC
 
Pepperoni 2.0 - How to spice up your mobile apps
Pepperoni 2.0 - How to spice up your mobile apps Pepperoni 2.0 - How to spice up your mobile apps
Pepperoni 2.0 - How to spice up your mobile apps
Futurice
 
Ionic Framework
Ionic FrameworkIonic Framework
Ionic Framework
Dylan Swartz
 
Testing your Single Page Application
Testing your Single Page ApplicationTesting your Single Page Application
Testing your Single Page Application
Wekoslav Stefanovski
 
Chatbots
ChatbotsChatbots
Chatbots
Tessa Mero
 
Reark : a Reference Architecture for Android using RxJava
Reark : a Reference Architecture for Android using RxJavaReark : a Reference Architecture for Android using RxJava
Reark : a Reference Architecture for Android using RxJava
Futurice
 
A Personal Journey
A Personal JourneyA Personal Journey
A Personal Journey
Michael Lihs
 
360|Flex Recap - San Jose 2010
360|Flex Recap - San Jose 2010360|Flex Recap - San Jose 2010
360|Flex Recap - San Jose 2010
David Ortinau
 
I knew there had to be a better way to build mobile apps
I knew there had to be a better way to build mobile appsI knew there had to be a better way to build mobile apps
I knew there had to be a better way to build mobile apps
Alius Petraška
 
Xamarin.Forms Bootcamp
Xamarin.Forms BootcampXamarin.Forms Bootcamp
Xamarin.Forms Bootcamp
Mike Melusky
 
Mobile Fest 2018. Илья Иванов. Как React-Native перевернул наше представление...
Mobile Fest 2018. Илья Иванов. Как React-Native перевернул наше представление...Mobile Fest 2018. Илья Иванов. Как React-Native перевернул наше представление...
Mobile Fest 2018. Илья Иванов. Как React-Native перевернул наше представление...
MobileFest2018
 
Phonegap Day 2016: Ember/JS & Hybrid Apps Tips
Phonegap Day 2016: Ember/JS & Hybrid Apps TipsPhonegap Day 2016: Ember/JS & Hybrid Apps Tips
Phonegap Day 2016: Ember/JS & Hybrid Apps Tips
Alex Blom
 
Engage 2019 - De04. Java with Domino After XPages
Engage 2019 - De04. Java with Domino After XPagesEngage 2019 - De04. Java with Domino After XPages
Engage 2019 - De04. Java with Domino After XPages
Jesse Gallagher
 
How native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App DevelopmentHow native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App Development
Devathon
 
Mobile Architecture Comparison
Mobile Architecture ComparisonMobile Architecture Comparison
Mobile Architecture Comparison
Jonathan Bender
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
Troy Miles
 
Finding the sweet spot - blending the best of native and web
Finding the sweet spot - blending the best of native and webFinding the sweet spot - blending the best of native and web
Finding the sweet spot - blending the best of native and web
Shawn Jansepar
 
Introduction to the Ionic Framework
Introduction to the Ionic FrameworkIntroduction to the Ionic Framework
Introduction to the Ionic Framework
rrjohnson85
 
How to Successfully Implement Headless Drupal
How to Successfully Implement Headless DrupalHow to Successfully Implement Headless Drupal
How to Successfully Implement Headless Drupal
Acquia
 
Creating a Comprehensive Social Media App Using Ionic and Phone Gap
Creating a Comprehensive Social Media App Using Ionic and Phone GapCreating a Comprehensive Social Media App Using Ionic and Phone Gap
Creating a Comprehensive Social Media App Using Ionic and Phone Gap
FITC
 
Pepperoni 2.0 - How to spice up your mobile apps
Pepperoni 2.0 - How to spice up your mobile apps Pepperoni 2.0 - How to spice up your mobile apps
Pepperoni 2.0 - How to spice up your mobile apps
Futurice
 
Testing your Single Page Application
Testing your Single Page ApplicationTesting your Single Page Application
Testing your Single Page Application
Wekoslav Stefanovski
 
Reark : a Reference Architecture for Android using RxJava
Reark : a Reference Architecture for Android using RxJavaReark : a Reference Architecture for Android using RxJava
Reark : a Reference Architecture for Android using RxJava
Futurice
 
A Personal Journey
A Personal JourneyA Personal Journey
A Personal Journey
Michael Lihs
 
360|Flex Recap - San Jose 2010
360|Flex Recap - San Jose 2010360|Flex Recap - San Jose 2010
360|Flex Recap - San Jose 2010
David Ortinau
 

Viewers also liked (13)

Developing maintainable Cordova applications
Developing maintainable Cordova applicationsDeveloping maintainable Cordova applications
Developing maintainable Cordova applications
Ivano Malavolta
 
Define Labs : Portfolio / Projects / Our work
Define Labs :  Portfolio / Projects / Our workDefine Labs :  Portfolio / Projects / Our work
Define Labs : Portfolio / Projects / Our work
saurwad
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails Presentation
ChanHan Hy
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
Joost Hietbrink
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
adamcookeuk
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
Benny Skogberg
 
Android ppt
Android pptAndroid ppt
Android ppt
Pooja Garg
 
Presentation on Android application
Presentation on Android applicationPresentation on Android application
Presentation on Android application
Atibur Rahman
 
Mobile Application Development With Android
Mobile Application Development With AndroidMobile Application Development With Android
Mobile Application Development With Android
guest213e237
 
Android Project Presentation
Android Project PresentationAndroid Project Presentation
Android Project Presentation
Laxmi Kant Yadav
 
Android ppt
Android pptAndroid ppt
Android ppt
Ansh Singh
 
Home automation using android mobiles
Home automation using android mobilesHome automation using android mobiles
Home automation using android mobiles
Durairaja
 
Android ppt
Android ppt Android ppt
Android ppt
blogger at indiandswad
 
Developing maintainable Cordova applications
Developing maintainable Cordova applicationsDeveloping maintainable Cordova applications
Developing maintainable Cordova applications
Ivano Malavolta
 
Define Labs : Portfolio / Projects / Our work
Define Labs :  Portfolio / Projects / Our workDefine Labs :  Portfolio / Projects / Our work
Define Labs : Portfolio / Projects / Our work
saurwad
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails Presentation
ChanHan Hy
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
Joost Hietbrink
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
adamcookeuk
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
Benny Skogberg
 
Presentation on Android application
Presentation on Android applicationPresentation on Android application
Presentation on Android application
Atibur Rahman
 
Mobile Application Development With Android
Mobile Application Development With AndroidMobile Application Development With Android
Mobile Application Development With Android
guest213e237
 
Android Project Presentation
Android Project PresentationAndroid Project Presentation
Android Project Presentation
Laxmi Kant Yadav
 
Home automation using android mobiles
Home automation using android mobilesHome automation using android mobiles
Home automation using android mobiles
Durairaja
 

Similar to Building mobile apps with PhoneGap and Backbone (20)

«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​
FDConf
 
Cross Platform Mobile App Development
Cross Platform Mobile App DevelopmentCross Platform Mobile App Development
Cross Platform Mobile App Development
Synerzip
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
Nuxeo
 
Developing Windows Phone 8 apps using PhoneGap
Developing Windows Phone 8 apps using PhoneGapDeveloping Windows Phone 8 apps using PhoneGap
Developing Windows Phone 8 apps using PhoneGap
Amar Mesic
 
Introduction to hybrid application development
Introduction to hybrid application developmentIntroduction to hybrid application development
Introduction to hybrid application development
Kunjan Thakkar
 
Cross Platform Mobile Development
Cross Platform Mobile DevelopmentCross Platform Mobile Development
Cross Platform Mobile Development
Manesh Lad
 
Javascript Best Practices and Intro to Titanium
Javascript Best Practices and Intro to TitaniumJavascript Best Practices and Intro to Titanium
Javascript Best Practices and Intro to Titanium
Techday7
 
Angular mobile angular_u
Angular mobile angular_uAngular mobile angular_u
Angular mobile angular_u
Doris Chen
 
Cross platform mobile application development
Cross platform mobile application developmentCross platform mobile application development
Cross platform mobile application development
webprogr.com
 
2011 code camp
2011 code camp2011 code camp
2011 code camp
imranq2
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
DevelopmentArc LLC
 
Phone gap
Phone gapPhone gap
Phone gap
Kevin Lee
 
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGapBuilding Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Nick Landry
 
The Developers World
The Developers WorldThe Developers World
The Developers World
Ronald Northrip
 
React native - React(ive) Way To Build Native Mobile Apps
React native - React(ive) Way To Build Native Mobile AppsReact native - React(ive) Way To Build Native Mobile Apps
React native - React(ive) Way To Build Native Mobile Apps
Jimit Shah
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScript
Troy Miles
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
Ganesh Kondal
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Gil Irizarry
 
Your choices for building a mobile app in 2016
Your choices for building a mobile app in 2016Your choices for building a mobile app in 2016
Your choices for building a mobile app in 2016
Jad Salhani
 
Mobile app development
Mobile app development  Mobile app development
Mobile app development
Luke Summerfield
 
«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​
FDConf
 
Cross Platform Mobile App Development
Cross Platform Mobile App DevelopmentCross Platform Mobile App Development
Cross Platform Mobile App Development
Synerzip
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
Nuxeo
 
Developing Windows Phone 8 apps using PhoneGap
Developing Windows Phone 8 apps using PhoneGapDeveloping Windows Phone 8 apps using PhoneGap
Developing Windows Phone 8 apps using PhoneGap
Amar Mesic
 
Introduction to hybrid application development
Introduction to hybrid application developmentIntroduction to hybrid application development
Introduction to hybrid application development
Kunjan Thakkar
 
Cross Platform Mobile Development
Cross Platform Mobile DevelopmentCross Platform Mobile Development
Cross Platform Mobile Development
Manesh Lad
 
Javascript Best Practices and Intro to Titanium
Javascript Best Practices and Intro to TitaniumJavascript Best Practices and Intro to Titanium
Javascript Best Practices and Intro to Titanium
Techday7
 
Angular mobile angular_u
Angular mobile angular_uAngular mobile angular_u
Angular mobile angular_u
Doris Chen
 
Cross platform mobile application development
Cross platform mobile application developmentCross platform mobile application development
Cross platform mobile application development
webprogr.com
 
2011 code camp
2011 code camp2011 code camp
2011 code camp
imranq2
 
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGapBuilding Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Nick Landry
 
React native - React(ive) Way To Build Native Mobile Apps
React native - React(ive) Way To Build Native Mobile AppsReact native - React(ive) Way To Build Native Mobile Apps
React native - React(ive) Way To Build Native Mobile Apps
Jimit Shah
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScript
Troy Miles
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
Ganesh Kondal
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Gil Irizarry
 
Your choices for building a mobile app in 2016
Your choices for building a mobile app in 2016Your choices for building a mobile app in 2016
Your choices for building a mobile app in 2016
Jad Salhani
 

More from Troy Miles (20)

Fast C++ Web Servers
Fast C++ Web ServersFast C++ Web Servers
Fast C++ Web Servers
Troy Miles
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
Troy Miles
 
AWS Lambda Function with Kotlin
AWS Lambda Function with KotlinAWS Lambda Function with Kotlin
AWS Lambda Function with Kotlin
Troy Miles
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
Troy Miles
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
Troy Miles
 
Intro to React
Intro to ReactIntro to React
Intro to React
Troy Miles
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
Troy Miles
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application Testing
Troy Miles
 
ReactJS.NET
ReactJS.NETReactJS.NET
ReactJS.NET
Troy Miles
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?
Troy Miles
 
Angular Weekend
Angular WeekendAngular Weekend
Angular Weekend
Troy Miles
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
Troy Miles
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScript
Troy Miles
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
Troy Miles
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-up
Troy Miles
 
The JavaScript You Wished You Knew
The JavaScript You Wished You KnewThe JavaScript You Wished You Knew
The JavaScript You Wished You Knew
Troy Miles
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
Troy Miles
 
Build a Game in 60 minutes
Build a Game in 60 minutesBuild a Game in 60 minutes
Build a Game in 60 minutes
Troy Miles
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEAN
Troy Miles
 
A Quick Intro to ReactiveX
A Quick Intro to ReactiveXA Quick Intro to ReactiveX
A Quick Intro to ReactiveX
Troy Miles
 
Fast C++ Web Servers
Fast C++ Web ServersFast C++ Web Servers
Fast C++ Web Servers
Troy Miles
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
Troy Miles
 
AWS Lambda Function with Kotlin
AWS Lambda Function with KotlinAWS Lambda Function with Kotlin
AWS Lambda Function with Kotlin
Troy Miles
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
Troy Miles
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
Troy Miles
 
Intro to React
Intro to ReactIntro to React
Intro to React
Troy Miles
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
Troy Miles
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application Testing
Troy Miles
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?
Troy Miles
 
Angular Weekend
Angular WeekendAngular Weekend
Angular Weekend
Troy Miles
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
Troy Miles
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScript
Troy Miles
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
Troy Miles
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-up
Troy Miles
 
The JavaScript You Wished You Knew
The JavaScript You Wished You KnewThe JavaScript You Wished You Knew
The JavaScript You Wished You Knew
Troy Miles
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
Troy Miles
 
Build a Game in 60 minutes
Build a Game in 60 minutesBuild a Game in 60 minutes
Build a Game in 60 minutes
Troy Miles
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEAN
Troy Miles
 
A Quick Intro to ReactiveX
A Quick Intro to ReactiveXA Quick Intro to ReactiveX
A Quick Intro to ReactiveX
Troy Miles
 

Recently uploaded (20)

IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 

Building mobile apps with PhoneGap and Backbone

  • 1. Building Mobile Apps with PhoneGap & Backbone 28 January 2014
  • 2. Who am I? Hi, I’m Troy. I have been developing software for over 30 years. For the last 12 years I have been focused on web, mobile web, and mobile development. I currently work at Kelley Blue Book as a senior software engineer. My opinions are my own. ! I can be reached [email protected]
  • 3. Free mobile tutorials with source code @ therockncoder.blogspot.com
  • 4. Want more? Follow me, new tutorials are announced on Twitter first: @therockncoder
  • 5. Source code for my tutorials hosted on GitHub @ https://github.com/Rockncoder
  • 6. Check out my videos: www.youtube.com/rockncoder
  • 7. Agenda • A Quick & Dirty JavaScript Overview • What is PhoneGap? • Building PhoneGap Apps • Backbone • Underscore
  • 8. Agenda • Models • Collections • Views • The Router • Templates • Chocolate Chip
  • 9. Agenda • Lists • Widgets • Look and Feel • Google Maps • Debugging • Summary
  • 11. JavaScript Best Practices • Avoid sloppy JavaScript • Avoid the Global Space • Encapsulate Code into Objects • Use Design Patterns
  • 12. Avoid Sloppy JavaScript • Use “strict” mode • Always use ‘===’ & ‘!==’ • Code in JavaScript not C#, Java, Ruby, etc. • Use JSLint or JSHint
  • 13. Avoid the Global Space • Minimize use of global variables • Use Name-spacing • Use anonymous/immediate functions when appropriate
  • 14. Use Design Patterns • Singleton • Chaining • Revealing Module Structure • + many more
  • 15. Functions • Functions are a first class type • Like other types they can be passed and assigned freely • Anonymous functions are used frequently
  • 16. Objects • Objects are some what like Key/Value dictionaries in other languages • The Key can be anything when wrapped in quotes • The Value can be any type including a function
  • 17. Events • Events allow for excellent separation of concerns • You can listen for system events or • Trigger and respond to your own • Many external libraries will communicate via events
  • 18. Deferred Objects • A rather new JavaScript concept • Used to register multiple callbacks • The app uses jQuery’s version
  • 19. What is PhoneGap? • Created by Nitobi in 2009 at an Apple Event • Nitobi was acquired by Adobe • Open sourced as Apache Cordova • PhoneGap is only one implementation
  • 20. Other Cordova Implementations • appMobi • Convertigo • Icenium (Telerik) • ViziApps • Worklight (IBM)
  • 21. PhoneGap • Current release is 3.3 • Node.js is a hard requirement since version 3.0 • It is all command line instead of IDE • Recommend not upgrading your app to a new version right away
  • 22. How it Works? • Most device APIs include an internal web browser • PhoneGap uses this internal web browser as its app canvas • It adds more features to the navigator via software which bridges the gap between the internal web and the device
  • 23. Setting up your environment • Setup Device specific frameworks: • Install Xcode • Install Android Dev Kit • Install Node.js • Download Cordova CLI
  • 24. Building PhoneGap Apps • cordova precedes all commands • cordova create • cordova
  • 25. Underscore • A utility belt library for JavaScript • Excellent at manipulating objects and collections • About 5kb minified and compressed • Required for Backbone apps
  • 26. Backbone • A MV* Framework • Note: There are no controllers hence no ‘C’ • More lightweight than Angular or Ember • Requires jQuery and Underscore
  • 27. Models • The base object in Backbone • Essentially a wrapper around a JavaScript object • Use get and set command to access properties
  • 28. Collections • A collection of models • Can associate a URL with a collection • Backbone native support of RESTful API • Can also use third party API
  • 29. Views • Backbone’s UI layer • Also does much of what a controller would do in typical MVC
  • 30. The Router • The router controls application state • In a web site it would control what is in the URL bar • PhoneGap apps may lack a visible URL bar, but it still exists
  • 31. Templates • Templates render markup to the DOM in a cookie cutter fashion • Especially good for render collections to a view • Make it easier to create single page apps
  • 32. Chocolate Chip • A UI Framework akin to jQuery Mobile or even Bootstrap • Does a great job of impersonating iOS 7, Android 4+, and Windows Phone 8
  • 33. Lists • You will work a lot with lists in mobile apps • In CC, lists will have the look and feel of the device • Lists typically will need a bit of code to make them fully functional
  • 34. Lists • Lists have classes which enhance their looks • Classes exists to indicate: • Navigation to another page • Navigation to a details page
  • 35. Widgets • CC uses a combo of its own stuff with HTML5 • For example the Range Slider is simply an HTML5 input type=range • But a switch is a combination of HTML, CSS3, and JavaScript
  • 36. Look and Feel • Switching the look and feel is easy, just change CSS files • PhoneGap version 3+ automates the process
  • 37. Look and Feel • iOS 7: chui-ios-3.5.0.css • Android 4+: chui-android-3.5.0.css • Windows Phone 8: chui-win-3.5.0.css
  • 38. Look and Feel • PhoneGap’s merges folder • one directory for each supported device • Its contents will be copied and overwrite during the build command • Name all of the css files identically • Place in each appropriate folder
  • 40. Location • Use HTML5 location services • Both location watching and current location used in the app • Recommend giving users an alternative if they prefer not sharing their location
  • 41. Google Maps • Google Maps works on both iPhone and Android without code change • Google also provides reverse geocoding API • Reverse geocoding turns some part of an address into a lat/long
  • 42. Debugging • No getting around it debugging PhoneGap apps suck • Best work around I have is console.log and using a browser • Some like the Ripple emulator
  • 43. What We Learned • Some JavaScript Best Practice • How to use PhoneGap and Backbone to make mobile apps • How to use one codebase to support multiple devices • How to go from web to app
  • 44. Links • http://jquery.com/ • http://documentcloud.github.io/backbone/ • http://www.chocolatechip-ui.com/ • https://developers.google.com/maps/ • http://blog.mediumequalsmessage.com/ promise-deferred-objects-in-javascript-pt1theory-and-semantics
  • 45. The Rock n Coder • http://therockncoder.blogspot.com • http://www.youtube.com/user/rockncoder • https://github.com/Rockncoder • http://www.slideshare.net/rockncoder