Pages

    Wednesday, February 16, 2011

    Learning Android: Appcelerator's Titanium vs. Native-built Apps

    I have finally been able to take the time to do something I've been wanting to do for a long time:  some mobile development.  I decided to work on some Android apps first, as the barrier to entry is a little lower.  As this was an exploratory mission, I thought I would give a few development options a try.  Those development options were native Android development via Eclipse and Appcelerator's Titanium Platform.

    By way of explanation, Appcelerator's Titanium Platform is a development environment that allows you to write HTML/CSS/JavaScript apps and have them compiled down to native code (Android or iOS).  Titanium provides a rich framework of APIs from which to build your apps.  For instance, the UI components in Titanium are analogous to the UI components in Android.  The advantage to Titanium is that you can take one app and compile it down to any of the supported platforms, like Android or iOS.  Since Titanium compiles down to native code, you're not running interpreted, though there are some specific wrappings that Titanium has to build in.

    The app:  Quotious

    For my app, I had a few necessities.  First, it had to be twitter-like, meaning that it was a bunch of short messages that can be displayed as a list.  I also wanted the data to be served up from some external source and arrive packaged in JSON.

    Based partly on these needs, and partly on an idea I got from a buddy, I decided to build an app that captured quotes.  You could specify the author of the quote, the source of the quote and the quote itself.  Nothing too fancy.  I called it "Quotious".

    In light of that, I first built out a small Jetty based server which I could run on my local.  It was backed by a MongoDB database.  The server simply served up the contents of the database in a RESTful manner (I really only implemented the GET).  I seeded the database with a bunch of quotes from Darth Vader, as he is a worthy source of quotes all over the interwebs.

    Then, I got to work building the apps.

    Titanium Quotious

    Titanium Quotious
    I decided to delve into Titanium first, as I was most excited about that.  While I can do all the Java programming anyone could ask for, I absolutely love working with JavaScript.  Titanium seemed like it would be a fun experience.

    From start to finish, it took me about two days to turn out the Quotious app in Titanium.  Titanium offers a great example app called "Kitchen Sink" that implements examples of an incredible number of their APIs.  I relied heavily on an example twitter app that comes included with Kitchen Sink, adapting it for my needs.

    The Titanium implementation of Quotious doesn't have a persistent store and pulls the data over a RESTful call every time you fire up the app.  In that manner, it's not very robust, but the real story here is that it was almost trivial to implement.  I was able to bring all of my traditional web app skills to bear and had I really been trying I could have turned it out faster.

    Native Quotious

    After I was done with the Titanium version of the app, I turned my hand to a natively built implementation done in Eclipse.  I quickly went through all the tutorials and found myself in an interesting position:  After Hello World, there wasn't a clear path to building up my understanding.  So, I turned to The Goog and found this superb implementation of a twitter app that is put together as a tutorial by Marakana.

    Native Quotious
    This app took me about twice as long to build, roughly 4 or 5 days.  The reason, though, is significant.  Titanium abstracts away much of the underlying Android structure.  You are free to basically build your app as if it were a web app and not worry about the inner workings of Android.  While those inner workings can only suffice to make your app stronger, they're not strictly necessary to simply build an app with Titanium.

    As I worked through the Marakana example, I was enlightened about all of the various moving parts that truly make up an Android app.  From the Manifest.xml to the views, from the actions to the intents, I had to actually learn what went into an Android app.  This accounted for much of the increased time of development.

    The native app that I developed is slightly more robust than the Titanium version.  It is backed by a SQLite database.  As updates are fed from the web source they are placed into the database.  As those changes go in, the UI is updated and what you see on the left is what is created.  In light of the database, my app will survive a loss of connectivity with grace, serving up what it has already seen and remembered in the past.

    Conclusion

    Let me not give the impression that Titanium is only about building web-app like Android apps.  It's not.  There is rich support for what makes a truly native app within Titanium.  You can create and manipulate a database, you can work with actions and intents.  You can do all of these things.  (Update:  See the first link below for some info on how to do all of these things)

    But you don't have to.  And therein lies what might be the most seductive thing about Titanium.  You can build your app as if it is a web app, only it runs natively.  You don't have to expand your skill set to understand all of the ins-and-outs of what makes up an Android app.  All you have to do is take your current skill set for building JavaScript heavy web apps and port them over to your device of choice.

    If developer time is your main constraint, then Titanium is likely the way to go.  You can hit the ground running faster with Titanium.  You don't really have to be an "app developer" to develop apps with Titanium.  What's more, and something I only lightly touched on, with very little augmentation, you can port your app to an entirely different platform such as iOS.  With very little, if any, changes, I can run the Titanium version of Quotious on an iOS device by simply compiling it down.

    One word of caution, though:  If you choose the Titanium route, don't eschew learning what really goes into an Android app.  Knowing the actuals behind Android can only make you a stronger developer in the long run.

    Edited:  For formatting
    Updated:  Added pointer to first comment with additional information

    39 comments:

    foo said...
    This comment has been removed by the author.
    Tony Guntharp said...

    Michael,
    Appcelerator also supports actions and intents as well as storing your data in a SQLite database.

    Take a look at:
    http://vimeo.com/18541179
    http://vimeo.com/19138717
    http://developer.appcelerator.com/blog/2011/01/titanium-and-the-android-ndk.html

    Tony Guntharp
    Director of Developer Relations
    Appcelerator
    @fusion94

    Michael.Rollins said...

    I made note of that in the conclusion, but the links will certainly help anyone that comes along.

    Think my next step is going to be to build in DB support for quotious on the appcelerator app.

    giuliocc said...

    So Titanium is a bit like "app-crack". It gives you a hit quickly but it's superficial if you want to be a capable and skilled developer for Android ?

    I appreciate the comparison and you are just giving it a try, but would like to also hear about more serious efforts in app development for Android between Titanium and Eclipse.

    Michael.Rollins said...

    @giuliocc, it's probably a bit of a red herring that I differentiated the two by including Eclipse in the native app development category. I did, in fact, write the js for the Titanium app in Eclipse, but there's a secondary environment which is Titanium that compiles and packages your app for running on the device.

    For the native app, I did everything within Eclipse, including launching my emulators and loading the app onto the device. It's a subtle difference, but one that is worth noting.

    As for Titanium being like app-crack, well, that's only partly true. I think that if you really want to get serious, you won't be doing the superficial stuff alone. Titanium just makes it easy to build the superficial stuff. In the vimeos that Tony linked, they go on to talk about the more in-depth stuff that they're making available in version 1.5, including intents and services.

    The platform definitely bears some serious consideration, especially if you're trying to gain traction by converting a bunch of web app devs into Android/iOS devs.

    Ian said...

    @giuliocc: I can give you first hand experience of trying to use Titanium on a production grade app. One word. Disaster. Or perhaps nightmare. Don't get sucked in by it. We wasted a month of dev time battling with it. From painful debugging, slow building, poor documentation, little community help and to cap it off, it's 'native' performance really isn't. We were really excited about using it and tried really hard to make it work, but it just is not ready. Maybe later versions will solve the problems, but to me it seems fundamentally flawed.

    If even its own KitchenSink application has noticable performance issues compared to a true native app that tells you something.

    We had to abandon it as wasn't good enough to show to the client. In the end we decided to learn Android native and ended up all done within a month. We'd still be debugging Titanium, or trying to make it perform reasonably and fighting with the api.

    Paul S said...

    @Ian

    > Don't get sucked in by it. We wasted a month of dev time battling with it

    Same experience we had. Appcelerator is cute and seemingly quite convenient, but the company hides its problems so that people aren't deterred from using it. That is not good in the world of software development where problems are very important. People begin to encounter big problems when the functionality of their app goes just outside the scope of the kitchen sink sample code. Besides that, the kitchen sink app is not written in the correct manner for a large app, in which the windows should be opened from a central location. I've built three apps with Appcelerator and my advice is to avoid it entirely unless your app has minimal functionality demands, like displaying flat content and photos.

    Sfynx said...

    Even with simple apps it is useful to code them natively IMO, since it gives you nice training in the platform in case you want to create more complex things later.

    Saurabh Saxena said...

    According to a new research the market for cross platform
    mobile development tools is forecast to reach $8.2 billion by 2016. The promise
    of Titanium as a write once run anywhere is a illusion but the technology is
    still indispensable in developing mobile apps. Developers are taking a number
    of cross platform development approaches and successful developers will match
    the right tools and approach to appropriate requirements and use cases. With
    the complexity of mobile app development continuing to grow, the tools vendors’
    ability to reduce development time and increase application reach is generating
    significant opportunities. This new trend in mobile application development
    will also help fuel an more open and prosperous mobile app ecosystem.

    Anonymous said...

    It's actually a nice and useful piece of information. I am happy that you shared this useful information with us. Please keep us up to date like this. Thank you for sharing.

    Feel free to visit my blog; community.atom.com

    Anonymous said...

    It's really very difficult in this active life to listen news on Television, so I just use internet for that purpose, and take the latest news.

    Feel free to surf to my website; iraqidinarchart01.xanga.com

    Anonymous said...

    These are not empty words which are uttered by a
    disciple of Jesus who anyone would anticipate to say such as this.

    If you want to know what folks are listening to and talking
    about on the opposite coast, Fly - Cast is
    terrific. As a gadget, it's out of this world; as a functional laptop, I'm not so sure.


    Feel free to visit my web blog ... www.pariscitybreaks.com

    Madt Team said...

    It has been a great discussion here. Thanks for stating a titanium platform's forecast. I had a good time on reading this post. Thank you also, Michael.

    Anonymous said...

    clients, Rachel, who got back together with her ex. The only downside of it in a lot of people's eyes is the fact that there is no multiplayer content. In this addictive puzzle game, catch that damn fly and avoid those tricky obstacles.

    My site Visit posters website

    Anonymous said...

    Facebook has groups, applications, and many of the exact same features of My - Space, delivered in just about the same way.
    You need to make real efforts towards inviting your friends
    to your fan page. Just because you can do something doesn't mean you should.

    my web page; facebook likes kaufen

    Anonymous said...

    Around 150 games in total, but that's relatively small compared to our users. Finding good outsourcing companies is the key, as naturally you do not want to lower the quality of the service. Next Jim Deacove developed a few of his own board games based on the principles of cooperation, group strategy and joint problem solving.

    Also visit my weblog: visit the next website

    Anonymous said...

    If adult comedy is what entertains you then there are plenty of these as well.
    All you have to do is select the movie from the Camera Roll and adjust the slider.
    Let's take a look at some of the devices which are used for video conferencing.

    Also visit my webpage; By TrackBack on

    Anonymous said...

    Once the game is 80% complete you will need to work on the sound. Don't leave the landscape designing and terrain optimization to the last moment. As ever we strive to help our customers make informed decisions and understand where their r4 cards are coming from.

    Also visit my weblog ... keep reading

    Anonymous said...

    This site is very easy to work with and doesn't shoot you around to different web sites before you find what your looking for. I believe the FTP transfer is a bit better than the regular HTTP transfer protocol. The virtual D-pad has been improved as well to make it easier to move around plus there are other tweaks for slabs and the Nether Reactor too.

    Feel free to visit my blog post http://mollyjfdszukl.skyrock.com/

    Anonymous said...

    Part 2 of this series on marketing your small business using Facebook
    offers social media marketing tips and guidelines for how to attract fans to your Facebook
    page. You need to make real efforts towards
    inviting your friends to your fan page. (Although, I also
    believe that there is something in them that might be
    and seek to reverse, too.

    Also visit my blog; mokchon-kimjungsik.org

    Anonymous said...

    According to statistics, "Internet radio attracts an upper-income audience, with weekly Internet radio listeners 36% more likely to live in a household with annual income of $100K+ than the general US population 18+".
    Perhaps there is a news broadcast you want to check, or perhaps
    a vital sports game you cannot miss. Individuals have acquired
    different software and programe through which you could
    download these videos.

    Here is my site; Let�s Get Personal

    Anonymous said...

    And Ouya, which is about the size of a Rubik's cube. Finding good outsourcing companies is the key, as naturally you do not want to lower the quality of the service. People are now looking to be able to connect to things like their vehicles through their smart phones, and now Buick has announced the release of their new e - Assist Fuel Effeciency smartphone games.

    my web-site - http://exercise.dsu.ac.kr/39811

    Anonymous said...

    Similar to the cue ball that is shot in pools;
    this game involves coins and strikers that are essential to play carrom game.
    It should come as no surprise that i - Tunes is loaded full of pirate apps for
    i - Phone, i - Pod Touch, and i - Pad. Harry Potter Hogwarts is one more entry into this new series of LEGO
    board games.

    my web blog - http://www.spielespielen24.de/geschick/oldest/22

    Anonymous said...

    Upon examining some etymological dictionaries, one can conclude that games
    are a creative expression of the human spirit through the creation of an activity that has an entertaining, instructive
    and competing element. This way you are not disappointed when you get residence, and you
    won't have to make a excursion back to the shop. As ever we strive to help our customers make informed decisions and understand where their r4 cards are coming from.

    Visit my blog: game

    Anonymous said...

    Part 2 of this series on marketing your small business using Facebook offers
    social media marketing tips and guidelines for how to attract fans to your Facebook page.
    You might not allow people to write on your wall, however, when you share a thought, a link, or comment on someone's else wall, people can definitely also leave a comment. Link ' Recommend sites to other users
    and vice versa.

    my web blog :: cybernet4u.com

    Anonymous said...

    Aside from the usual fare of alternative rock,
    jazz, and pop, among others, this station also showcases
    the work of and connects with indie artists from all over the globe.
    There are quite a few to choose from such as the Roberts stream
    83i or the Tangent Quattro which are both good examples
    of internet radios. Using a little exploration (which you happen to be clearly working on proper now), expenditure in your business here is exactly the instructions to use the medium
    to your benefit.

    Feel free to visit my web site: just click the next webpage

    Anonymous said...

    Once you have done this, set the burn speed to 4x and click
    Burn and wait for it to complete. Imagine never having to worry about what to wear to work, and even the infuriating traffic jams that never seem to end.
    The main reason why you would want to do this is
    simple, you can unlock the true potential of your purchase.



    Have a look at my web-site - http://gloriousk9kennels.com/cgi-bin/fpg.cgi

    Anonymous said...

    Much like Safari, the Camera app, the App Store and i - Pod, Game Center
    has no option to be deleted when editing your apps.
    However, every character in the game (even supporting players) should be
    presented in this same detail. In this addictive puzzle game, catch that damn fly and avoid those tricky obstacles.


    My blog post - click the following internet page

    Anonymous said...

    Much like Safari, the Camera app, the App Store and i - Pod, Game Center has no option to be deleted
    when editing your apps. At the same time, web games seemed like the future of gaming, and we wanted to be a part of it.
    The main reason why you would want to do this is simple, you can unlock the
    true potential of your purchase.

    My blog post - please click the following internet page

    Anonymous said...

    Similar to the cue ball that is shot in pools; this game
    involves coins and strikers that are essential to play carrom game.
    All spaceship game leveling systems are designed slightly differently, but there are some general concepts that apply to all games in this genre.
    For the purposes of this game, a "set" is at least three cards of equal
    value such as three Jacks or three fours and a "sequence" is made up of at
    least four cards that are of the same suit and run sequentially such as three, four, five,
    and six of spades.

    Also visit my web page ... denzel washington

    Anonymous said...

    Around 150 games in total, but that's relatively small compared to our users. t want to forget to buy your all star game tickets at Angels Stadium from an independent ticket broker that cares more about customer satisfaction than the bottom line. It fizzles as the lights go out, and she says it's been great talking to you.


    Also visit my homepage ... http://www.bgsurugby.com/board/profile.php?mode=viewprofile&u=273130

    Anonymous said...

    Similar to the cue ball that is shot in pools; this game involves coins and strikers that are essential to play carrom game.
    Imagine never having to worry about what to wear to work, and even
    the infuriating traffic jams that never seem to end.
    If you want to be able to hit the ball further and harder,
    you should keep in mind to keep your grip on the bat loose, your swing should begin with
    your legs and hips, and finally, you must always follow your bat through.


    My web blog; mouse click the following article - www.datingmadeeasy.com

    Anonymous said...

    Once you have done this, set the burn speed to 4x and click Burn and wait for it to
    complete. Imagine never having to worry about what to wear to work, and even
    the infuriating traffic jams that never seem to
    end. In this addictive puzzle game, catch that damn fly and avoid those tricky
    obstacles.

    Here is my blog ... click the following page

    Anonymous said...

    They help separate the fishing men from the boys, so you can
    find an excellent guide who really knows what he's doing. The 360 Series from Aqua-Vu is specifically designed with a rugged encasement for ice fishing. But here's my top 5 to
    consider with choices for both types of water included:.

    Also visit my web page: fishing.seweb.de

    Anonymous said...

    Una Musica Brutal, by Gotan Project: from Buddha Bar IV.
    Manual; this is the instructions; same again is it in good condition.

    Be comfortable in its open-air concept restaurant, where you might even sit in a table
    and look up to see stars in a clear night sky.

    Have a look at my blog - http://journals.fotki.com/kerriwhhi/kerriwhhi/entry/fwdtrfqssrfd/

    Anonymous said...

    If you just want to do a few cakes for right now
    you may be able to borrow most of the items or get cheaper versions of each tool.
    Personalized and theme cake asserts cake designs as per your requirements.
    The TV crew will embark on the task of helping "sweet" businesses survive
    and prosper.

    Here is my weblog ... cake and bake germantown coupons - dicttrans.com -

    Anonymous said...

    Similar to the cue ball that is shot in pools; this game involves coins and
    strikers that are essential to play carrom game. It combines RPG elements and strategy for a very interesting
    game where you must stop the rows of pirates ship from making their way down the river.

    Preparing to apply to the dozens of other game development companies for video game jobs will
    enable you to expand and diversify your list of possible employers, and your chances of getting hired
    will increase tremendously.

    Check out my blog post ... Read More Listed here - pcrepairandwebsitedesign.

    com (http://www.support.pdregister.com/knowledgebase/309982/page/2)

    Anonymous said...

    I hope it was informative and helped you along your own culinary journey.

    Couples only fool themselves if they think guests only care about
    the cake. The TV crew will embark on the task of helping
    "sweet" businesses survive and prosper.

    Feel free to visit my web page ... cake avenue cupcakes

    Anonymous said...

    Once you have the centers prepared, there are a number of ways to decorate
    the outside. If you prefer to use frozen strawberries, they work in
    this cake equally as well as the fresh. You may even love them more than this classic
    cake recipe.

    My webpage ... cake alchemy ()