Yahoo! Developer Network Blog
« Previous | Main | Next »
May 11, 2009
Titanium App: My Personal Highlight from JSConf2009
Guest post by Greg Ferrell (@gregferrell)
A couple weekends ago (April 24-25, 2009), I had the great fortune to attend JSConf2009, "The First Conference Just for JavaScript Developers". Chris Williams and his wife Laura, spent much of 2008 and the beginning of 2009 putting together one heck of a conference. I have been to a few conferences that were all middle management or salesmen trying to sell a product but JSConf2009 was refreshingly different. Most presenters were actual project developers or experts on the techniques they were showing.
One of the more exciting presentations for me was Titanium by Jeff Haynie of Appcelerator. For those unfamiliar with Titanium, it is an open-source, cross-platform, desktop application SDK that is built on Webkit. Applications are written in HTML/CSS/JavaScript and supports lots of HTML5 goodies. (It also supports writing in Python and Ruby, with plans to add more languages in the future.). If that sounds a lot like Adobe AIR, that's because it is. However, there are some fundamental differences that make Titanium a viable choice and very desirable over other solutions.
To give you a quick overview on my background with this: I write a lot of (unpublished) AIR apps for both my work and home projects because I am one of its ideal customers:
- I use Macs, PCs, and sometimes Linux, all in the same day, almost every day
- I need to write cross platform desktop applications, but I only know web development related programming languages
- I need my applications to have full filesystem access as well as web access so I can automate repetitive work
However, Jeff's presentation at JSConf2009 very quickly awakened my curiosity about Titanium. His first demonstration was a modified version of pro-web-dev and blogger Jonathan Snook's demo on imitating Tweetie in Titanium. Titanium, being built on a recent version of Webkit, was able to make use of CSS3 transitions that very closely copied Core Animation techniques from OS X. The end result was simply astonishing. The Titanium mimic of Tweetie was so close visually to the original that, with a little work, it could be a 99% clone.
The best part for me was when Jeff showed the Titanium Developer Application (TDA). The TDA, itself being built in Titanium, was a testament to the power of the platform. With the TDA, you can start a new application by entering in your name, the app name, a description, publishing information, app location on your HDD, and a custom app icon. You can also elect to choose popular JavaScript libraries to be included in your app before you create it. More options like window size, max/minimize ability, etc. are available in the app descriptor XML, which is very similar to the AIR app descriptor. Once you declare all of your options for your new application, you are taken back to the projects window where you have options to delete, create more, or go to the packaging stage. There, you can launch and test your app in one click, package with another click, or do a mock installation. The packaged files also have options to include the runtime for tandem installation or, for machines that have RTE installed, just the app by itself.


This was the point upon which I was fully sold on Titanium being a solid platform. Testing, packaging, and mock installing from a single first party dev app should be mandatory. My biggest complaint with developing AIR apps with HTML/CSS/JavaScript is the messy command line process required to test and package the apps. I made my own shortcut to launching AIR apps without the command line because I was so irritated with it. (It's worth mentioning that Aptana can launch and package AIR apps with a simple GUI, but with big kudos to Aptana, it shouldn't take a third party app to make first party development easy. Flash and Flex, however, can run and package from within their respective IDEs.)

There is also a sandbox portion of the Titanium Developer Application that allows you to try small scripts without making a whole new app. This is a boon for me because I frequently make copies of my AIR apps just to test a few small scripts or run a very simple batch job. A sandbox would make that a heck of a lot easier. The TDA does this, and takes it up a notch by letting you include common JavaScript libraries in your sandbox. It also gives you a list of pre-made snippets to see how it works.

The Titanium Developer Application is also a great community tool because it includes: a tab with links for popular apps built in Titanium, a tab with a built-in connection to the #titanium_app IRC chat room, and a tab for Twitter and FriendFeed posts that mention Titanium. Keep in mind that the Titanium Developer Application was itself written in Titanium, so all of these things should be possible in your own Titanium apps.

Jeff also mentioned that, in order for AIR JavaScript apps to leverage Flash classes, it must always have an instance of Flash running in the background within the app. While this offers a great deal of flexibility for leveraging powerful Flash libraries and built in classes, it also causes a severe performance hit. Titanium runs ONLY on an instance of Webkit and therefore has a large resource advantage over AIR. In tests of JavaScript applications that were ported from AIR to Titanium, most saw significant reductions in needed resources to run. For applications like Twitter interfaces or other stay-on web-connected apps, this is a HUGE advantage. Even the best computer can be faster if 10% of its CPU isn't needlessly taken up at all times by a minor app.
Titanium comes with the expected file system access, drag and drop, web connection, and SQLite db access APIs, but throws a trump card on the table with its ability to open processes and applications from the users computer. Jeff quickly went over the ability to use the process API to do something as simple as read the contents of a directory via the command line. I have desperately wanted this ability in AIR because using function recursion to iterate over an entire folder full of files with the File API is MANY, MANY times slower than what the native file system can do via command line.
I have considered communicating with Bonjour via AIR so I could write iPhone apps and AIR apps that could communicate. Titanium's process API may just accomplish this and open the door for easily created, cross-platform apps that can communicate with their iPhone counter parts. Couple that with PhoneGap and you could then have the ability to make iPhone apps and desktop apps for the Big Three OSs that can theoretically talk to each other, all written in JavaScript.
While system process access may seem like a security risk, keep in mind that anything with the ability to write text files to the file system could potentially make a nasty text-based runtime file named "RUN_ME_FOR_FREE_INTERNETS" and screw the system up as well. The key thing here is that you must exercise caution with any app you download, and the presence of system process access to Titanium is no greater a security risk than downloading any random application written in other languages.
As of this writing, Titanium is only in Preview Release 3 and still has ground to cover before it's a complete platform. I think more options need to be added to the existing APIs, like the ability to pass parameters to opening applications, and perhaps some additional APIs to match the filesystem set already within AIR. The documentation could also benefit from some visual improvement. I would love to see a revised version of the docs presented just like jQuery's API browser and be another tab in the Titanium Developer Application. That would be beyond amazing. It would also be nice to have the ability in Titanium (or AIR) to package a standalone app into a "no need to install" executable file, similar to what Shu-Player does for AIR. Aside from those minor quips, Titanium is off to a smashing start and I must thank Jeff for doing a bang-up job with his presentation. I might not have taken a second look at Titanium until much later and may have missed out on a great platform for many months.
I can't possibly go over all of the awesome things Jeff talked about, but if you want to learn more about Titanium app, take a look at the slides from his JSConf2009 presentation, check out the Tweetie Imitation Demo, or go to the Titanium website, grab the Titanium Developer Application, and try something in the sandbox yourself.
Companies like Appcelerator are making it a great time to be JavaScript developer and JSConf2009 really opened my eyes to the inspiring things going on with the JavaScript community.
Lastly, the point of this article is not to talk negatively about AIR, but rather to show the strong points of Titanium in comparison, as Jeff presented it. I still think AIR is a great platform and has lots of advantages in its corner as well.
Editors note: this post was delay by my very silly travel schedule. It's still a great read though!
Posted at May 11, 2009 3:13 PM | Permalink
Comments
A good review and overview of what might end up being a very useful platform. Thanks much!
Posted by: alan at May 12, 2009 7:12 AM
Hey Greg,
Thanks for the glowing review! We've been working practically around the clock for the past 5-6 months to bring this platform to fruition, and it's very rewarding to read articles like this one :)
Feel free to drop by our IRC channel on irc.freenode.net, #titanium_app and hook up with me or Jeff anytime.
Posted by: Marshall Culpepper at May 12, 2009 10:37 PM
Thanks for the review!
'It would also be nice to have the ability in Titanium (or AIR) to package a standalone app into a "no need to install" executable file...'
I just wanted to note that the installer for any application is essentially a self extracting zip that runs a setup file afterward.
You can simply extract the file as a zip to get the same file structure you would after an install, just in a different folder.
No weird registry keys or paths involved.
Posted by: Joseph Still at May 13, 2009 8:03 AM
@Joseph Still
I guess I should have clarified that point a little more. What I was thinking was more exporting to a single *.exe or *.app file so that there would be no need to run any installer. It would work like an app from http://portableapps.com.
The need to install the runtime is a tad of a deterrent for me because the apps I write usually are to be used on corporate machines that need admin privileges for any install or update. In some businesses like ours, it takes a divine act to get that approval.
Posted by: Greg Ferrell at May 13, 2009 8:11 AM
@Greg Ferrel
Apologies if I am not explaining it well.
If you download a titanium app and treat it exactly like a zip file you will get a working program without having to install it.
So download an app and push it to 7zip or whatever and you have a working app without installation. It will not be a single .exe file since all the resources it uses will be there in the file structure.
This is ONLY if the application developed has the runtime files bundled with the application. This makes it a bigger, of course, but should still work.
It as worked the three or four times I've found it useful.
I just confirmed with one of the developers that this is correct as long as everything is bundled when it is packaged.
If you have any questions or want clarifications on this, just say so and I'll do a write up and some screenshots for you as soon as I can!
Joseph
Posted by: Joseph Still at May 13, 2009 2:30 PM
Hi,
my name is Trevor and I am with the Appcelerator Team.
First of all I just have to say wow! this is definitely the greatest and most detailed article on Titanium that I have ever read and I have read a lot of them. It is great to see that you see the positives in Titanium and am thrilled that it makes your life just that little bit easier. It would be my pleasure to send you an Appcelerator Titanium t-shirt on behalf of the Appcelerator team and myself. All I need is your mailing address!
Thanks,
Trevor
Posted by: Trevor Cape at May 14, 2009 4:21 PM
Post a comment
Comment Policy: We encourage comments and look forward to hearing from you. Please note that Yahoo! may, in our sole discretion, remove comments if they are off topic, inappropriate, or otherwise violate our Terms of Service. Fields marked with asterisk '*' are required.
Subscribe
Recent Blog Articles
view all
YQL Open Table for Google Buzz now live
Tue, 09 Feb 2010
INSERT INTO twitter.status ...
Mon, 08 Feb 2010
Announcing the Yahoo! Brasil Open Hack Day 2010, 20-21 March
Mon, 08 Feb 2010
Marketing hacks, linchpins, and tech women of valor
Sun, 07 Feb 2010
Yahoo! India invites you to join the first India Hadoop Summit
Thu, 04 Feb 2010
Recent Links
Appcelerator Titanium + Yahoo YQL on Vimeo
Mon, 08 Feb 2010
Tue, 02 Feb 2010
PhoneGap | Cross platform mobile framework
Sat, 30 Jan 2010
Web developers can rule the iPad - O'Reilly Radar
Sat, 30 Jan 2010
rc3.org - Is the iPad the harbinger of doom for personal computing?
Thu, 28 Jan 2010
Archives
2010
2009
2008
2007
2006
2005
Recent Readers

