What if we could bring the good parts of web development to Titanium? I'm talking about the realtimeness of web development - changing files and being able to see results on the fly, both visually and regarding application logic. Compare it to Firebug's live CSS editing abilities and Chrome's live code changes. I'm also talking about bringing the beauty of web frameworks to Titanium - Stylus, SASS and Less for styling, CoffeeScript and its cousins to enhance development, Jasmine for testing, Backbone for MVC and jQuery and friends to simplify element creation, communication and handling. What if we could use all these techniques on top of Titanium to create native apps even faster and with better structure?
The solution is Kranium - the result of merging Titanium with web development techniques, creating a cyborg which is greater than just the sum of its parts. It will significantly speed up development and styling, and is useful both for prototyping and production apps. It will be release under the MIT license during the conference. The session is meant as an introduction of Kranium for all Titanium developers, but will be especially thrilling for those with a web development background.
6. " Cross platform apps using javascript!
" Shared business logic!
" Native UI!
" Device API:s!
7. Why cross-platform?
" One codebase!
" Faster development → cheaper development!
" Less code → less bugs!
" Focus on one language and one tool!
8. Why not cross-platform?
" Potential bugs in cross-platform frameworks!
" Somewhat harder stepping outside the box!
" Might still need platform branching!
" Less speed and more memory usage!
9. Cross Platform is Hard
" iOS! " Android!
" Objective-C! " Java!
" XCode! " Eclipse!
11. Cross Platform Medicine
http://flic.kr/p/8dZbk4!
" Must use lowest common denominator!
" Go with a low-level API!
" Must focus on getting the “atoms” behave
the same across platforms!
12. Low-level
http://flic.kr/p/75b2DJ!
Means powerful!
13. Low-level
http://flic.kr/p/5JDvZM!
Also means annoying to build large stuff!
14. Low-level
http://flic.kr/p/nyxCW!
Is it therefore wrong?!
18. Titanium
" Titanium Mobile has a low-level
core API:s for each platform it
supports!
" Lets cover it in platform-
independent high-level
awesome-sauce!
20. Parallel
" Web development has low-level API:s!
" document.createElement!
" element.style.backgroundColor!
21. Web development
if (el.addEventListener) {
el.addEventListener("mouseover", myFunction, false);
el.addEventListener("mouseout", myFunction, false);
} else if (el.attachEvent) {
el.attachEvent("onmouseover", myFunction);
el.attachEvent("onmouseout", myFunction);
} else {
el.onmouseover = myFunction;
el.onmouseout = myFunction;
}
Used to be painful, slow and ugly!
42. Kranium
http://bit.ly/bW1zP5!
" Tries to invent as few wheels as possible!
" Instead piggyback on the ideas and momentum of
existing great web frameworks!
46. Command line program
" Built on NodeJS and NPM!
" Initiates Kranium resources in project!
" Pipes live updates!
" Two-way console!
" Jasmine reporter!
47. Template engine
A great template engine is a huge
help in keeping your code:!
" DRY!
" separated!
" consise!
48. Jade
" Lightweight!
" Supports custom compilers!
" Compiles templates to functions!
" Beautiful syntax!
" Consise!
" In active development!
53. JSS
" Great feature in theory - gives Separation of
Concerns!
" Hasn’t always been working well !
" Not powerful and extendable enough!
54. KSS
" A styling layer implemented in the javascript
context!
" Everything created using K function is styled
appropriately!
" Style based on Types, Classes and IDs!
" Platform branching using psuedo selectors!
" Variable evaluation!
61. Backbone supplies structure to JavaScript-heavy
applications by providing models with key-value
binding and custom events, collections with a rich
API of enumerable functions and views with
declarative event handling...
78. Summary
" Consists of a command line program and an
includable library!
" Ports the best web development libraries and
technologies to Titanium!
" Polyfills parts missing between platforms!
" Helps you with your KISS:ing and keeps you
DRY!
79. Available now
" Currently in open beta!
" Source under MIT License!
" Hosted on GitHub!
" Pull requests and co-maintainers welcome"
" http://github.com/krawaller/kranium!
80. Available now
" Beware!
" There will be bugs!
" API far from frozen!
81. Available now
" Works best with iOS, but Android getting
there!
" CLI works best on Mac OSX!
" Will be tested and fixed for Linux and
Windows !