Cross-platform mobile apps – possible or not?

What is Titanium and how it works. Titanium is an open-source solution for cross-platform, almost-native mobile app development. It has its own MVC, JavaScript and XML-based framework Alloy. Titanium is based on assumption, that each app can be divided into two parts: UI, which is platform-specific part and application core – business logic, common to all […]What is Titanium and how it works. Titanium is an open-source solution for cross-platform, almost-native mobile app development. It has its own MVC, JavaScript and XML-based framework Alloy. Titanium is based on assumption, that each app can be divided into two parts: UI, which is platform-specific part and application core – business logic, common to all […]

blog-product-titanium1

What is Titanium and how it works.

Titanium is an open-source solution for cross-platform, almost-native mobile app development. It has its own MVC, JavaScript and XML-based framework Alloy. Titanium is based on assumption, that each app can be divided into two parts: UI, which is platform-specific part and application core – business logic, common to all platforms. So, inside the app, we have native UI components and JavaScript interpreted logic, communicating with each other.

If you want to write your app in titanium, you only need to know JavaScript and learn to call Titanium API for UI components. Alloy, on the other hand, is more fun, because you have to write views in XML, model and controllers in JavaScript (+ Titanium API mentioned before) and styles in something called Titanium StyleSheets, which is CSS+JSON hybrid. I must admit, the language is not an obstacle for anybody who ever did web development, or any kind of script and markup languages. It’s easy to start working with this framework.

Beginnings.

To work with Titanium, you will need Titanium Studio – an Eclipse-based IDE adapted to write and deploy Titanium apps into various platforms and stores – AppStore, Google Play etc. It has a direct access to Appcelerator Titanium Marketplace, where you can download e.g. sample applications, widgets and plugins – paid for or free of charge.

After downloading Titanium Studio and necessary SDK’s I downloaded sample code called Kitchen Sink – an example, showing possibilities of Titanium Alloy framework. I chose a device and… it worked! After (very few ;-) years of programming I get used to difficult beginnings, long configurations before the first launch (whether regarding a web app, mobile app or any kind of desktop/command line app), but Appcelerator did a great job preparing IDE and integrating it with simulators, emulators etc. After the first success I played with Alloy for a few days and here comes my conclusions.

What is great about Titanium.

1. Simplicity. Apps can be build from small files and can be developed very fast. Everybody knows basics of XML and JavaScript, so you can start writing your apps straight away.

2. Architecture. Alloy framework is very well designed. It allows installing plugins, widgets, or even native modules in a convenient way. “Convention over configuration” makes this process faster – all you need to do is put the downloaded widget into the “widget” directory and add a dependency into config.json file.

3. GitTio is a search engine that indexes all Titanium modules and Alloy widgets. It is something similar to Cocoa Controls for iOS, but more comprehensive, because it automatically finds new modules in GitHub and indexes them. GitTio provides Command Line Interface, which facilitates installing and managing widgets.

What is not-so-great about Titanium.

1. There is not such thing as “one app to rule them all”. Mobile platforms have different controls, components and UI elements. The same things are implemented by different solutions. The more complex the app gets, the more platform dedicated code needs to be written. After all, I end up writing views and controllers for each platform separately.

2. Even if you can write one view for each platform, you probably shouldn’t do it. There is one thing I have not mentioned yet – User Experience. It is extremely different for each mobile OS. Android users are used to “back” and “menu” buttons, iOS users are using navigation bar, some OS’s are using swipe moves to navigate between window. Therefore, a universal app for all platforms is doubtful idea to start with.

3. Cross-platform idea stops working when you want to use external module. There are “iOS-only” modules or “iOS and Android” modules. Very rarely, they may also include mobileweb.

What is totally not-great about Titanium.

1. Titanium is still young. It develops really fast. A lot of things have bugs, while at the same time, a lot of features get deprecated. When you find a tutorial from 2011, you may never be sure whether it’s up to date. Differences between close versions (like 3.1.3 and 3.2) sometimes force re-writing the whole view or using another widget.

2. Titanium and Titanium Alloy are two different worlds. Having got used to the beautiful Alloy MVC code I tried downloading a widget written in “plain Titanium”. This was a lot of code with a completely different approach and not so easy to integrate with Alloy. Then I found out, that I don’t have “631 Titanium modules” (gitt.io), but “178 Alloy Widgets”, so I had to found widget with similar functionality, written in Alloy. Another “little” bump on the road.

So what?

With some experience with Titanium and some experience with PhoneGap, I don’t think it is possible to write a good cross-platform app. It is hard even when you try to do this for iOS and Android only, but we have also Bada, Tizen, Firefox OS and new OS’s are developed as we speak – Ubuntu Touch, Sailfish OS and some more. Also, it is always good to have mobile web version of the app. But, even if a cross-platform app would be possible to write…

You shouldn’t do this. When you write a native app, you can learn user habits and good practises for each platform. When you write one app for every platform, you probably break about a million good-UX rules. But, if you are desperate and want to do this anyway…

It won’t save you a lot of time. When you write cross-platform apps, you have to deal with OS-specific quirks, you sometimes get native-code errors (good luck with Objective-C errors without any iOS knowledge) and it is not too difficult to miss some crucial things (while testing on 9 devices at the time).

Of course, in some cases, cross-platform apps can be a good solution. Nevertheless, in my opinion, it is not the universal solution for mobile app development.

You May Also Like