A Cross-sectional View to find the Best Cross-Platform Framework:Titanium Vs PhoneGap

VN:R_U [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
FavoriteLoadingAdd to favorites
31/10/2015 by
xicom

Among the three mobile app designing technologies available, I opine that if you are going for an cost effective one you can opt for Cross-platform apps , wherein if you have dungeon deep pockets you can go for Native application development. Let’s not make an irrational decision and gauge them under three different parameters such as Cost, Performance and Native Hardware Access, which are the prime requites of making a decision.

Looking at the graph ahead if you wish to go with Cross-platform development which seems to be the most viable development option for you business app to go for mobile development , then you can keep on reading!

Now we have another quest in front of us and that is choose the best cross platform framework among these following options:

  • PhoneGap/Cordova (HTML/JavaScript)

  • Titanium/Appcelerator (JavaScript)

  • Kony (Lua)

  • Rhodes (Ruby)

  • Mono/Xamarin (C#)

Goal of PhoneGap

PhoneGap is a Cross-platform app which transforms normal HTML based apps, so that they can be downloaded and used as native mobile app. PhoneGap wraps your application in a native shell, wherefore enabling your app to be downloaded from the app stores for respective mobile platforms available in the market. Moreover, it helps you to achieve a native functionality for your apps which one do not gets in web applications, such as device contacts, sensors , camera access and other core functionalities.

Additionally, PhoneGap is considered as one of the avant-grade ideas of the new API standards of W3C, as they aim to bring the futuristic development technology. When it comes to accessing first class APIs, we have only one or two names such as Mozilla with FirefoxOS and Microsoft with Windows 8, which are utilizing them for for their web applications. However, PhoneGap aims to provide a subset of web applications of today.

Key Features of the Technology

As discussed earlier PhoneGap wraps web applications into a native container we shall now discover how these apps are wrapped. Let’s dig into the intricacies of how these apps are wrapped in a native container.

Mobile development SDKs provided by Android and iOS comprise of “web view”, which is a widget for web browsers which is present in their UI framework. In exclusive native applications, HTML containers are displayed from a local HTML package or a remote server with their native apps via Web view for apps which are exclusively designed for a native platform.

Now the wrapped application created by PhoneGap is used to load the HTML pages developed by end developer into a web view control. This displays the HTML, as the user interface of the application when is it accessed on mobile devices.

Reading the JavaScript

Now if you have JavaScripts on your page which is to be displayed using a web view, do not worry as the code can be read normally. However, this is not what happens in native apps and this communication differs from platform to platform; as web view created by native applications communicate asynchronously with JavaScript which runs in the web view. This hassle free code communication between JavaScript and Web view is known as “the bridge” in PhoneGaps’ architecture.

Understanding the “The bridge”

Utilizing this technology to the fullest, PhoneGap also uses it to generate JavaScript API within a ‘web view’ which can asynchronously send messages and get messages from the code wrapped in the application. Every platform has its own way of implementing this bridge layer, though. Now for instance if you are using a PhoneGap for developing mobile application, and for accessing the contact list, your method has to stand in a request queue which is to sent over to the bridge (one which communicates with the native code and user interface). Then after, PhoneGap creates an iframe which then loads a Uniform resource identifier scheme that is configured in native apps, this is where the commands standing in queue to reach the bridge are executed. In order to communicate back to the web view a string of JavaScript is evaluated in order to check whether it is in context of the native code.

This was not it , when it comes to technologies used in PhoneGap, but communication between the native code and the wrapper to deliver the perfect native experience is the essence of PhoneGap and this is what will makes it a holistic cross platform framework.

Pros:

  1. Simple and concise set of API which enables app to easily acclimatize to different mobile operating environment.

  2. Offers code reusability with mobile technologies such as JavaScript, HTML5 and CSS. Wherefore, any piece of code ever written using these technologies can be easily transformed in a native application.

  3. Offers an incredible support to all modern platforms and operating systems, such as Android, iOS, Blackberry, Windows , Ubuntu and Firefox OS.

  4. There is no additional skill set required to work with PhoneGap and developers who have worked of HTML,JavaScript or CSS can easily work on it.

Cons:

  1. I would not say that it delivers low performance, but rather the performance is not up to the mark, as we use codes of a web app which is then launched on a mobile app by a web browser. Wherefore, they are unable to match the performance level of native apps.

  2. It has been fragmented into numerous basic level framework and libraries .

  3. User interface is the app depended on the quality of Web View delivered, not your UI design.

Goal of Titanium :

Titanium aims to provide a top notch, API and cross-platform JavaScript runtime for mobile apps which can run on all platforms ( as the market is fragmented in Android, iOS, Windows Phone, Blackberry and others). When we talk about similarities between Titanium and PhoneGap , then I must say that they have very less in common with platforms such as PhoneGap, Rhomobile , Corona, or Adobe AIR, wherein it is much more similar to platforms namely node.js , MacRuby/Hot Cocoa or PHP, Xojo.

The assertions on which the core functionalities of Titanium are built on are:

  • A core mobile development API which exists can be customized to be used across all the platforms. This is where they targeted to reuse the code.

  • There are API’s which are specific to platforms, features and user interface norms which developers must include while building apps for a particular platform. Wherefore, it is imperative to use a platform-specific code in order to deliver a high quality native experience.

How Titanium Works?

Though these frameworks have an ample lot of internal functionalities going on to provide sublime mobile experience, but we are focusing on how a web app in converted into a mobile app, which is the essence of the platform, I suppose. At runtime, we will see three major components – Titanium API implementation of your code for a specified mobile operating platform , Source code of your JavaScript which is in an Objective-C or Java file and compiled into an encoded string and an interpreter for JavaScript for instance we have JavaScriptCore for iOS and V8 for Android platform, for evaluating your code at runtime.

During the time of app launching, a native code JavaScript execution environment is developed , then after the source code of your application is evaluated. In this JavaScript runtime environment, there are some objects named as “proxy ” are incorporated in it. These are JavaScript objects which are paired with a native code object. This forms two parallel environments which are referred as

“native land” and “JavaScript land” in Titaniums development environment.

There delegating objects exist in native land as well as JavaScript land, and they serve as a bridge which is completely different from the definition on bridge than PhoneGap.

Now calling a function on Ti object or global Titanium , for instance var a = Ti.UI.createButton({title:’Poke Me’});, invokes a native method which will then create a UI object in the native land, and a “proxy” object (a) which is used to take JavaScript to see the objects in the Native UI.

For creating complex user interfaces the developers can arrange the UI components, i.e. the view proxies hierarchically. These proxy objects which are exposed to non-visual APIs are executed in native code, and the result is returned to the JavaScript synchronously or asynchronously for certain specific APIs.

With this I guess it is clear that Titanium do not use the ‘web view’ component. Though the developer can create a native UI widget, but a web view is not used to make Titanium source code run like a mobile app. Plus the JavaScript code is not cross-compiled into a Java or Objective-C code. In Titanium the JavaScript code works at runtime.

Pros:

  1. Native API usage renders better performing apps, which also helps to gain native elements and feature set of mobile operating platforms such as iOS and Android.

  2. It delivers native use interface, wherefore helps in delivering apps which perform better in terms of aesthetics when compared to other cross platforms frameworks.

  3. The development procedure is quite swift and easy with JavaScript.

Cons:

  1. Do not supports third party libraries

  2. Complex applications are developed very easily

  3. As it do not use HTML5 and CSS for development, thus the DOM elements and animation of the app are not that responsive.

The Gist!

XTND2

After analysis, we have gathered that though these frameworks have different working functionalities by they aim to deliver the same thing via a different route. Wherefore, I will suggest that if your app has complex features you can go for PhoneGap, wherein Titanium can be used if your app has an easy to use interface.








Hide ↑

As an mobile app developer and computer programmer of Xicom Technologies Ltd.-Android App Development Services, explains Cross-sectional View to find the Best Cross-Platform Framework:Titanium Vs PhoneGap. Technology intrigues me and this is why I like to read and write about mobile apps and web development related topics specially.






Comments

No comments yet...

Write a comment

 






RSS for this article.  |  TrackBack URL