lessons learned from applications that kicked titanium's ass
DESCRIPTION
from the firstTRANSCRIPT
Kevin Whinnery
@kevinwhinnery
Lessons Learnedfrom apps that kicked Titanium’s ass
Agenda
Some Cool Titanium Applications
Problems we saw (and how we fixed them)
Titanium application structure: CommonJS modules and Custom Components
Demo and code walkthrough
Q&A
Some Cool Titanium ApplicationsNBC iPad Application
Late Night with Jimmy Fallon
GetGlue
Wunderlist
Many many more
Awesome!
…but they also kicked our ass…
Big Apps, Big Problems
Cross-platform concerns
Memory Management
Slow initialization times
Multiple Contexts
Code Structure
Cross-Platform Concerns
“Write Once, Run Everywhere” fallacy
Cross-Platform API Parity
Cross-Platform functional differences
SolutionsCross-Platform Concerns
“WORE” Fallacy
Don’t aim for 100% code re-use, because it’s not going to happen (not even on the web)
For many apps, you can get by with branching logic
For complex experiences, re-use components, not your entire set of UI code
Custom components offer the best cross-platform re-use
If your app is made up of small chunks, each chunk will be easier to maintain cross-platform
Cross-Platform Parity/CompatibilityProbably the most annoying thing about our platform
- We’re writing specs to drive testing/implementation for 2.0
- First spec implementation will be with layouts in 1.8
Cross-platform testing essential
Should plan on platform differences, however – check NavigationController demo for one example
Memory Management
No explicit memory management API
Lots of views (images especially) === lots of memory
Unsure when Titanium cleans up
SolutionsMemory Management
How to make Titanium clean upClose windows
Set object references to null
Don’t keep “fat” views in the view hierarchy (images)
Slow initial load times
App loads up too slowly
Windows open too slowly (windows with URLs)
SolutionsSlow load times
Dealing with slow load times
JavaScript evaluation is the slowest part of your application
Defer script loading until absolutely necessary
Don’t load the same script over and over again in a context
Multiple Contexts
Kitchen Sink model
Data sharing is hard
When was code run?
SolutionsMultiple contexts
Dealing with multiple contexts
Don’t
Custom events
Properties API for data transfer
Code Structure
app.js – not very much structure
folder structure?
MVC?
MVVM?
SolutionsCode Structure
Code structure
Many ways to skin that cat
Appcelerator will have a more formal solution soon
Your best bet is to build a suite of components
Demo/Code Walkthrough
Q&AQuestions and Answers
ContactKevin Whinnery@kevinwhinnery
Thank you!