{"id":11747,"date":"2014-02-05T11:26:20","date_gmt":"2014-02-05T10:26:20","guid":{"rendered":"http:\/\/adamdziedzic.info\/blog\/?p=7"},"modified":"2014-02-06T15:46:52","modified_gmt":"2014-02-06T14:46:52","slug":"cross-platform-mobile-apps-possible-or-not","status":"publish","type":"post","link":"https:\/\/touk.pl\/blog\/2014\/02\/05\/cross-platform-mobile-apps-possible-or-not\/","title":{"rendered":"Cross-platform mobile apps &ndash; possible or not?"},"content":{"rendered":"<p style=\"text-align: center\"><a href=\"http:\/\/adamdziedzic.info\/blog\/wp-content\/uploads\/2014\/02\/blog-product-titanium1.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-12 aligncenter\" alt=\"blog-product-titanium1\" src=\"http:\/\/adamdziedzic.info\/blog\/wp-content\/uploads\/2014\/02\/blog-product-titanium1-300x167.png\" width=\"572\" height=\"320\" \/><\/a><\/p>\n<h2 id=\"what-is-titanium-and-how-it-works\">What is Titanium and how it works.<\/h2>\n<p dir=\"ltr\">Titanium is an open-source solution for cross-platform, almost-native mobile app development.\u00a0It 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 &#8211; business logic, common to all platforms. So, inside the app, we have native UI components and JavaScript interpreted logic, communicating with each other.<span id=\"more-7\"><\/span><\/p>\n<p dir=\"ltr\">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\u2019s easy to start working with this framework.<\/p>\n<h2 id=\"beginnings\">Beginnings.<\/h2>\n<p dir=\"ltr\">To work with Titanium, you will need Titanium Studio &#8211; an Eclipse-based IDE adapted to write and deploy Titanium apps into various platforms and stores &#8211; AppStore, Google Play etc. It has a direct access to Appcelerator Titanium Marketplace, where you can download e.g. sample applications, widgets and plugins &#8211; paid for or free of charge.<\/p>\n<p dir=\"ltr\">After downloading Titanium Studio and necessary SDK\u2019s I downloaded sample code called Kitchen Sink &#8211; an example, showing possibilities of Titanium Alloy framework. I chose a device and\u2026 it worked! After (very few <img decoding=\"async\" src=\"http:\/\/adamdziedzic.info\/blog\/wp-includes\/images\/smilies\/icon_wink.gif\" alt=\";-)\" class=\"wp-smiley\" \/>  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.<\/p>\n<h2 id=\"what-is-great-about-titanium\">What is great about Titanium.<\/h2>\n<p dir=\"ltr\">1. <strong>Simplicity<\/strong>. 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.<\/p>\n<p dir=\"ltr\">2. <strong>Architecture<\/strong>. Alloy framework is very well designed. It allows installing plugins, widgets, or even native modules in a convenient way. \u201cConvention over configuration\u201d makes this process faster &#8211; all you need to do is put the downloaded widget into the \u201cwidget\u201d directory and add a dependency into config.json file.<\/p>\n<p dir=\"ltr\">3. GitTio is a <strong>search engine<\/strong> 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.<\/p>\n<h2 id=\"what-is-not-so-great-about-titanium\">What is not-so-great about Titanium.<\/h2>\n<p dir=\"ltr\">1. There is not such thing as \u201cone app to rule them all\u201d. Mobile platforms have <strong>different controls<\/strong>, 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.<\/p>\n<p dir=\"ltr\">2. Even if you can write one view for each platform, <strong>you<\/strong> probably <strong>shouldn\u2019t<\/strong> do it. There is one thing I have not mentioned yet &#8211; User Experience. It is extremely different for each mobile OS. Android users are used to \u201cback\u201d and \u201cmenu\u201d buttons, iOS users are using navigation bar, some OS\u2019s are using swipe moves to navigate between window. Therefore, a universal app for all platforms is doubtful idea to start with.<\/p>\n<p dir=\"ltr\">3. Cross-platform idea stops working when you want to use <strong>external module<\/strong>. There are \u201ciOS-only\u201d modules or \u201ciOS and Android\u201d modules. Very rarely, they may also include mobileweb.<\/p>\n<h2 id=\"what-is-totally-not-great-about-titanium\">What is totally not-great about Titanium.<\/h2>\n<p dir=\"ltr\">1. Titanium is still <strong>young<\/strong>. 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\u2019s 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.<\/p>\n<p dir=\"ltr\">2. Titanium and Titanium Alloy are <strong>two<\/strong> different <strong>worlds<\/strong>. Having got used to the beautiful Alloy MVC code I tried downloading a widget written in \u201cplain Titanium\u201d. 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\u2019t have \u201c631 Titanium modules\u201d (gitt.io), but \u201c178 Alloy Widgets\u201d, so I had to found widget with similar functionality, written in Alloy. Another \u201clittle\u201d bump on the road.<\/p>\n<h2 id=\"so-what\">So what?<\/h2>\n<p dir=\"ltr\">With some experience with Titanium and some experience with PhoneGap, I don\u2019t 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\u2019s are developed as we speak &#8211; 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\u2026<\/p>\n<p dir=\"ltr\">You shouldn\u2019t 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\u2026<\/p>\n<p dir=\"ltr\">It won\u2019t 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).<\/p>\n<p dir=\"ltr\">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.<\/p>\n","protected":false},"excerpt":{"rendered":"What is Titanium and how it works. Titanium is an open-source solution for cross-platform, almost-native mobile app development.&nbsp;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 &ndash; business logic, common to all [&hellip;]What is Titanium and how it works. Titanium is an open-source solution for cross-platform, almost-native mobile app development.&nbsp;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 &ndash; business logic, common to all [&hellip;]\n","protected":false},"author":49,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":{"0":"post-11747","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-development-design"},"_links":{"self":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/11747","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/users\/49"}],"replies":[{"embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/comments?post=11747"}],"version-history":[{"count":2,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/11747\/revisions"}],"predecessor-version":[{"id":11751,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/11747\/revisions\/11751"}],"wp:attachment":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/media?parent=11747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/categories?post=11747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/tags?post=11747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}