Unblocking The Main Thread Solving ANRs and Frozen Frames
Best of brew city presentation final
1. Best of Brew City (BOB)
Mobile Web App - SPA, Backbone.js, Zepto.
js, HTML5, CSS3, JSON API
-Ezekiel Chentnik
2. What’s this guy gonna talk about?
●
●
●
●
●
what is BOB?
birds eye view of project
technical features
lessons learned
future of project
http://www.jsonline.com/brewcity/?mode=preview
3. What is BOB?
● A comprehensive & friendly mobile web app that allows
you to find things to do in Milwaukee
● Single page app that acts like a native app
● Built with:
○ HTML5, CSS3, JavaScript,
○ Underscore.js, Backbone.js, Zepto.js,
○ JSON API
○ appMobi
4. Bird’s Eye View of project
1.
2.
3.
4.
conception/discovery
time estimates, requirements, project approval
project: 2 week sprints, daily standups (soft launch, hard launch)
maintenance/v2
My role
●
●
●
Lead developer (full tech stack)
UI/UX guy
Manager, Teacher, Liaison
7. Performance
Goal: make as fast as possible
Accomplished: under 1 second home page load .36s
○ embedded image data uri's & sprites
○ compressed css, html & js
○ reduced http requests
○ google web font optimization using condensed font face calls and data
uri embedded fonts
○ server loaded google analytic assets
○ reduced html markup and nested HTML nodes
Improving: (testing: blocking scripts/js, asset caching/fragments, sprites/webfont icons)
8. Buttery Smooth UI
Goal: make super fast feeling, with native like UI
Features
● ios style page transitions
● pull to refresh
● momentum scrolling w/ios document jumping
bug fixed
Techniques:
● curbing user expectations
● hardware acceleration
● memory management - lightweight views
● panel rendering, active state
11. BOB’s Data
●
●
●
●
●
data caching - localStorage memcache style
geo located results lists - watchPosition, distance threshold
offline error handling
panel rendering/boot-straping panel data
JSON API
12. JSON/P API
JSON API, JSONP, or Data Bootstraping
JSON/P API
consumed by
BOB
wizardry &
magical
mashing
lucene .net
search service xml
zvents - event
search service xml
Clickability CMS
Data
http://m.jsonline.
com/api/v1/?
bust=y&custom=bl
_get_promotions&t
ype=JI.
BusinessListing&p
age_size=50&serv
icedebug=true&da
y=Wednesday&lati
tude=43.
042723795&longit
ude=-87.91450082
&sortByField=dista
nce&_=138557487
8454
14. Code snippet - Panel Rendering
listings:function(splat,queryString){//our route handler
var self = this;
var params = BOB.parseQueryString(queryString);
$.extend(params,BOB.currentPosition);
params.sortByField = "distance";
var collection = new BOB.ListingsCollection([],{params:params});
var view = new BOB.ListingsView({section:self.currentSection,collection:collection,state:self.currentState});
self.fetchCollectionAndRenderView(view,collection,params);
}
●
●
●
●
listen for route change
initialize route data - create view, collection, state
render panel shell
try cached data, render data OR try fetch data, render data on success
16. More features...
●
●
●
●
code base refreshing & idle aware app
last page aware, persistent login, prepped for full offline abilities
debug tools
admin control panel for producers or customers
21. Lessons learned...
● too much time spent on non
impactful features, not enough time
spent on important features
● API needs more data architecting
● feeling is important (design is more
than...)
● css bloats, deadlines & other
people
22. Looking forward - V2
Features:
●
●
●
●
●
re-skin - IOS7 style, flat theme, icon updates
update homepage layout
advanced map controls, search, personality through content
cms interface for updating/adding sections
facebook integration
Code:
●
●
●
●
UI performance improvements (make it even faster) - faster views, smoother transitions
build out debug tools
refactor & modularize codebase - reusable library for other markets
restructure router/controller/pub-sub [explain on whiteboard]