Share
Embed
Supercharge your PhoneGap workflow
Developing a complex and sustainable PhoneGap app can present many challenges. As your app grows, a seamless development workflow is crucial. Can you efficiently deploy and test in different environments? What are your pain points when implementing new functionality? How can you organize all the facets of your app with minimal effort?
This talk focuses on some of the ways you can create a development workflow that automates efficiencies, boosts scalability and most of all, preserves developer sanity.
Eric Alli
January 29, 2016
Transcript
82 slides
-
REFRAMING THE IDEA OF SCALING ▸ Kept me writing clean,
maintainable code ▸ Made it conducive to document as I was coding ▸ Created an automatic, holistic workflow ▸ Increased my ability to be agile -
REFRAMING THE IDEA OF SCALING ▸ Kept me writing clean,
maintainable code ▸ Made it conducive to document as I was coding ▸ Created an automatic, holistic workflow ▸ Increased my ability to be agile -
REFRAMING THE IDEA OF SCALING ▸ Kept me writing clean,
maintainable code ▸ Made it conducive to document as I was coding ▸ Created an automatic, holistic workflow ▸ Increased my ability to be agile -
REFRAMING THE IDEA OF SCALING ▸ Kept me writing clean,
maintainable code ▸ Made it conducive to document as I was coding ▸ Created an automatic, holistic workflow ▸ Increased my ability to be agile -
REFRAMING THE IDEA OF SCALING ▸ Kept me writing clean,
maintainable code ▸ Made it conducive to document as I was coding ▸ Created an automatic, holistic workflow ▸ Increased my ability to be agile -
FRAMEWORKS ▸ Readily available ▸ Usually does most of what
you need ▸ Tested and production ready ▸ Doesn’t do exactly what you need ▸ Requires separate maintenance CUSTOM CODE ▸ Gives you total control ▸ Will do exactly what you need ▸ Adaptable to your growing / changing app ▸ Requires planning and dev time ▸ Adds more to your testing workload -
DATA DECISIONS WHAT FUNCTIONS TO RUN ON THE DEVICE VS.
AN EXTERNAL API -
DATA CONSIDERATIONS ▸ Consider creating a backend API that prepares
all the data that will your app with consume ▸ API’s can range from a simple node server or a collection of PHP scripts to a full blown Ruby on Rails or Python app. ▸ Backend-as-a-Service tools are also a good alternative -
DATA CONSIDERATIONS ▸ Consider creating a backend API that prepares
all the data that will your app with consume ▸ API’s can range from a simple node server or a collection of PHP scripts to a full blown Ruby on Rails or Python app. ▸ Backend-as-a-Service tools are also a good option -
DATA CONSIDERATIONS ▸ Consider creating a backend API that prepares
all the data that will your app with consume ▸ API’s can range from a simple node server or a collection of PHP scripts to a full blown Ruby on Rails or Python app. ▸ Backend-as-a-Service tools are also a good option -
DATA CONSIDERATIONS ▸ Consider creating a backend API that prepares
all the data that will your app with consume ▸ API’s can range from a simple node server or a collection of PHP scripts to a full blown Ruby on Rails or Python app. ▸ Backend-as-a-Service tools are also a good option -
AUTOMATION OPPORTUNITIES ▸ Making a list of all the tasks
I do in every day developing. Not leaving anything out, big or small ▸ Consider if automation can be applied to each item ▸ Use a task runner (grunt or gulp) to offload some of the manual workload -
AUTOMATION OPPORTUNITIES ▸ Making a list of all the tasks
I do in every day developing. Not leaving anything out, big or small ▸ Consider if automation can be applied to each item ▸ Use a task runner (grunt or gulp) to offload some of the manual workload -
AUTOMATION OPPORTUNITIES ▸ Making a list of all the tasks
I do in every day developing. Not leaving anything out, big or small ▸ Consider if automation can be applied to each item ▸ Use a task runner (grunt or gulp) to offload some of the manual workload -
AUTOMATION OPPORTUNITIES ▸ Making a list of all the tasks
I do in every day developing. Not leaving anything out, big or small ▸ Consider if automation can be applied to each item ▸ Use a task runner (grunt or gulp) to offload some of the manual workload -
IT WILL BE SO MUCH MORE WORK IN THE BEGINNING,
BUT YOU’LL THANK YOURSELF LATER. -
Don’t delay device testing, bugs WILL find you in new
and inventive ways. TEST TODAY FOR A BETTER TOMORROW -
THERE ARE SO MANY WAYS TO DEBUG POORLY ▸Thinking your
app is just website ▸Thinking your app isn’t just a website ▸Missing potential device-related issues -
THERE ARE SO MANY WAYS TO DEBUG POORLY ▸Thinking your
app is just website ▸Thinking your app isn’t just a website ▸Missing potential device-related issues -
THERE ARE SO MANY WAYS TO DEBUG POORLY ▸Thinking your
app is just website ▸Thinking your app isn’t just a website ▸Missing potential device-related issues -
THERE ARE SO MANY WAYS TO DEBUG POORLY ▸Thinking your
app is just website ▸Thinking your app isn’t just a website ▸Missing potential device-related issues -
THERE ARE SO MANY WAYS TO DEBUG BETTER ▸Take advantage
of all browser-based debugging tools ▸Consider remote-device debugging tools (weinre, GapDebug) ▸Use a behavior driven (BDD) testing tool -
THERE ARE SO MANY WAYS TO DEBUG BETTER ▸Take advantage
of all browser-based debugging tools ▸Consider remote-device debugging tools (weinre, GapDebug) ▸Use a behavior driven (BDD) testing tool -
THERE ARE SO MANY WAYS TO DEBUG BETTER ▸Take advantage
of all browser-based debugging tools ▸Consider remote-device debugging tools (weinre, GapDebug) ▸Use a behavior driven (BDD) testing tool -
THERE ARE SO MANY WAYS TO DEBUG BETTER ▸Take advantage
of all browser-based debugging tools ▸Consider remote-device debugging tools (weinre, GapDebug) ▸Use a behavior driven (BDD) testing tool -
As you grow, it’s harder to mentally grasp your entire
app’s codebase. Splitting it up into manageable chunks can really help. GROWING PAINS -
WOULD YOU RATHER… A. Have a few files with 5k+
lines of code each B. Have many files with a few hundred lines of code each -
A. Have a few files with 5k+ lines of code
each B. Have many files with a few hundred lines of code each WOULD YOU RATHER… -
/* ______ | ____| | |__ ___ _
__ _ __ ___ ___ | __/ _ \| '__| '_ ` _ \/ __| | | | (_) | | | | | | | \__ \ |_| \___/|_| |_| |_| |_|___/ */ form { position: relative; input { ... } } -
A. Have a few files with 5k+ lines of code
each B. Have many files with a few hundred lines of code each WOULD YOU RATHER… -
SEGMENT EVERY PIECE OF FUNCTIONALITY INTO BITE-SIZED FILES ▸ Name
them by screen or by a specific feature ▸ Keep naming consistent: ▸ dashboard.css ▸ dashboard.js ▸ dashboard.template -
THE KEY TO BUILDING A SUSTAINABLE ORGANIZATION PATTERN IS TO
HYPER COMPONENTIZE EVERYTHING. -
MAKING THE MOST OUT OF OPEN SOURCE ▸Choosing libraries that
are mobile-first ▸Looking out for dependency requirements ▸Finding tools that can do more than one job -
MAKING THE MOST OUT OF OPEN SOURCE ▸Choosing libraries that
are mobile-first ▸Looking out for dependency requirements ▸Finding tools that can do more than one job -
MAKING THE MOST OUT OF OPEN SOURCE ▸Choosing libraries that
are mobile-first ▸Looking out for dependency requirements ▸Finding tools that can do more than one job -
Sprinkle in some native for common UI functionality. No Swift
of Java required* USE NATIVE FUNCTIONALITY! -
EVERYDAY NATIVE PLUGINS ▸ Social Sharing ▸ Maps ▸ Page
Transitions ▸ Progress Indicators ▸ Action Sheets ▸ … -
EVERYDAY NATIVE PLUGINS ▸ Social Sharing ▸ Maps ▸ Page
Transitions ▸ Progress Indicators ▸ Action Sheets ▸ … -
EVERYDAY NATIVE PLUGINS ▸ Social Sharing ▸ Maps ▸ Page
Transitions ▸ Progress Indicators ▸ Action Sheets ▸ … -
EVERYDAY NATIVE PLUGINS ▸ Social Sharing ▸ Maps ▸ Page
Transitions ▸ Progress Indicators ▸ Action Sheets ▸ … -
EVERYDAY NATIVE PLUGINS ▸ Social Sharing ▸ Maps ▸ Page
Transitions ▸ Progress Indicators ▸ Action Sheets ▸ … -
EVERYDAY NATIVE PLUGINS ▸ Social Sharing ▸ Maps ▸ Page
Transitions ▸ Progress Indicators ▸ Action Sheets ▸ … -
WITH EVERY BIT OF NATIVE FUNCTIONALITY YOU INCLUDE IN YOUR
APP… IT’S AN OPPORTUNITY TO OFFER A MORE FAMILIAR EXPERIENCE FOR THE USER. -
RECLAIM YOUR CODE Develop your app code outside of your
PhoneGap project…don’t worry, we’ll create a slick build process to reunite everything later. -
Move all app-specific code living in the www/ folder of
your PhoneGap project to a folder outside of the project. -
Use a task runner to copy only the files you
need into PhoneGap when the time comes. KEEPS YOUR CODE SEPARATE -
INSTALLING GRUNT ▸ Install Node.js from nodejs.org ▸ Initialize npm
in your project ▸ Install Grunt ▸ Install packages -
INSTALLING GRUNT ▸ Install Node.js from nodejs.org ▸ Initialize npm
in your project ▸ Install Grunt ▸ Install packages $ > npm init -
INSTALLING GRUNT ▸ Install Node.js from nodejs.org ▸ Initialize npm
in your project ▸ Install Grunt ▸ Install packages $ > npm init $ > npm install -g grunt-cli $ > npm install grunt —save-dev -
INSTALLING GRUNT ▸ Install Node.js from nodejs.org ▸ Initialize npm
in your project ▸ Install Grunt ▸ Install packages $ > npm init $ > npm install -g grunt-cli $ > npm install grunt —save-dev $ > npm install grunt-sass —save-dev $ > npm install load-grunt-tasks —save- dev $ > ... -
EXAMPLE GRUNTFILE.JS module.exports = function(grunt) { // Load all
packages require("load-grunt-tasks")(grunt, {scope: "devDependencies"}); // Project configuration grunt.initConfig({ // Sass compilation sass: { dist: { files: { "stylesheets/style.css": "stylesheets/style.scss" } } }, }); // Task groups grunt.registerTask('default', ['sass']); }; -
{COMPILES STYLESHEETS COMPILES TEMPLATES MINIFIES JAVASCRIPTS MINIFIES HTML CLEANS AND
COPIES WWW BUILDS THE PHONEGAP PROJECT LAUNCHES AN EMULATOR -
{COMPILES STYLESHEETS COMPILES TEMPLATES MINIFIES JAVASCRIPTS MINIFIES HTML CLEANS AND
COPIES WWW BUILDS THE PHONEGAP PROJECT LAUNCHES AN EMULATOR SASS, LESS… -
{COMPILES STYLESHEETS COMPILES TEMPLATES MINIFIES JAVASCRIPTS MINIFIES HTML CLEANS AND
COPIES WWW BUILDS THE PHONEGAP PROJECT LAUNCHES AN EMULATOR HANDLEBARS, MUSTACHEJS… -
{COMPILES STYLESHEETS COMPILES TEMPLATES MINIFIES JAVASCRIPTS MINIFIES HTML CLEANS AND
COPIES WWW BUILDS THE PHONEGAP PROJECT LAUNCHES AN EMULATOR JSHINT & CONCATENATE -
{COMPILES STYLESHEETS COMPILES TEMPLATES MINIFIES JAVASCRIPTS MINIFIES HTML CLEANS AND
COPIES WWW BUILDS THE PHONEGAP PROJECT LAUNCHES AN EMULATOR index.html -
{COMPILES STYLESHEETS COMPILES TEMPLATES MINIFIES JAVASCRIPTS MINIFIES HTML CLEANS AND
COPIES WWW BUILDS THE PHONEGAP PROJECT LAUNCHES AN EMULATOR COPY TO XCODE PROJECT -
{COMPILES STYLESHEETS COMPILES TEMPLATES MINIFIES JAVASCRIPTS MINIFIES HTML CLEANS AND
COPIES WWW BUILDS THE PHONEGAP PROJECT LAUNCHES AN EMULATOR phonegap build -
{COMPILES STYLESHEETS COMPILES TEMPLATES MINIFIES JAVASCRIPTS MINIFIES HTML CLEANS AND
COPIES WWW BUILDS THE PHONEGAP PROJECT LAUNCHES AN EMULATOR phonegap emulate -
EVEN MORE BUILD TASKS ▸ Watch files for changes and
run relevant tasks ▸ Preprocess the index.html file (for different environments / platforms) ▸ Optimize images ▸ Run virtually any shell commands -
EVEN MORE BUILD TASKS ▸ Watch files for changes and
run relevant tasks ▸ Preprocess the index.html file (for different environments / platforms) ▸ Optimize images ▸ Run virtually any shell commands -
EVEN MORE BUILD TASKS ▸ Watch files for changes and
run relevant tasks ▸ Preprocess the index.html file (for different environments / platforms) ▸ Optimize images ▸ Run virtually any shell commands -
EVEN MORE BUILD TASKS ▸ Watch files for changes and
run relevant tasks ▸ Preprocess the index.html file (for different environments / platforms) ▸ Optimize images ▸ Run virtually any shell commands -
EVEN MORE BUILD TASKS ▸ Watch files for changes and
run relevant tasks ▸ Preprocess the index.html file (for different environments / platforms) ▸ Optimize images ▸ Run virtually any shell commands -
YOU ARE YOUR OWN BOTTLENECK ▸ Empower yourself to make
quick and clear development decisions ▸ Organize today to help you scale for tomorrow ▸ Give yourself confidence to launch your app when the time comes ▸ Create efficiencies for yourself, then automate them -
YOU ARE YOUR OWN BOTTLENECK ▸ Empower yourself to make
quick and clear development decisions ▸ Organize today to help you scale for tomorrow ▸ Give yourself confidence to launch your app when the time comes ▸ Create efficiencies for yourself, then automate them -
YOU ARE YOUR OWN BOTTLENECK ▸ Empower yourself to make
quick and clear development decisions ▸ Organize today to help you scale for tomorrow ▸ Give yourself confidence to launch your app when the time comes ▸ Create efficiencies for yourself, then automate them -
YOU ARE YOUR OWN BOTTLENECK ▸ Empower yourself to make
quick and clear development decisions ▸ Organize today to help you scale for tomorrow ▸ Give yourself confidence to launch your app when the time comes ▸ Create efficiencies for yourself, then automate them -
YOU ARE YOUR OWN BOTTLENECK ▸ Empower yourself to make
quick and clear development decisions ▸ Organize today to help you scale for tomorrow ▸ Give yourself confidence to launch your app when the time comes ▸ Create efficiencies for yourself, then automate them