Thursday, April 14, 2011

Review:Rhomobile vs Appcelerator/titanium vs PhoneGap Which one is Best?



What all Products are available for Mobile Application Development?
To know about Native application,Web application and Hybrid application follow this link

There are plenty of players available for Mobile Development.
The major frameworks in market are
·       Appcelerator Titanium
·       DroidDraw
·       PhoneGap
·       Rhomobile
·       Application Markup Language (AML) etc.

Each of these frameworks has its own advantage and disadvantage. The choice of frameworks depends on project’s requirements.
Each platform for mobile applications also has a development environment which provides tools to allow a developer to code, test and deploy applications into the target platform environment. There are also Legacy Providers which are platform specific. 

In following table we have shown comparison of Rhodes with Legacy Provider and other frameworks.


Rhodes
Legacy Providers
Other Framework
Support all Smart Phone
Yes
No
No
Native UI
Yes
Yes
Yes
App Language
Standard
Proprietary
Standard
Model View Controller
Yes
No
No
Barcode/Signature Capture
Yes
Yes
No
HTML5
Yes
No
Yes
Support all OS
Yes
No
No
MetaData
Yes
No
No
Sync
Yes
No
No
Native Push API
Yes
No
No
Hosting Facility
Yes
No
No

  (Source : www.rhomobile.com )

Why Rhomobile is different from other products in market?

·       Model View Controller
Most of the other framework available in market are based on HTML and JavaScript . Hence other frameworks force us to put all business logic into the view and JavaScript. However, as Rhodes is ruby based framework and its structure is similar to popular framework Rails it also support Model View Controller, so code written with Rhodes is more structured and easy to understand.

·       Cross Platform Support for All Devices
Rhodes supports far more device operating systems than any other framework: iPhone, Android, Windows Mobile, BlackBerry and Symbian. The best thing is you have single code base from which you can build application for different smart phone. It does not work legacy way that we have to write seperate code for different types of phones.

·       Offline Capabilities using Rhosync
Rhomobile supports local synchronization of data. Older sync servers don’t support modern smartphones such as iPhone and Android. Most iPhone developers that need sync just end up writing their own synchronization code or process. As we can synchronize the data using Rhosync it provide offline Capabilities. We can work even if you are offline.

·       Object Relational Manager
Rhodes provides inbuilt Object Relational Manager called Rhom. It is similar to Active Record in Rails but with basic functionality only. It helps us to write queries without thinking about which database is being used by phone

·       Rapid Development
One of the interesting features of Rhodes is that it imposes some fairly serious constraints on how you structure your applications which help us for Rapid development. Rhomobile products are properly structured and well organized which enforce  us to do rapid development. Modern web developers have found Rhodes to be very comfortable, familiar and massively productive.

·       Scalable Sync Server
The Sync Server uses NoSql Database which makes it scalable. In addition, RhoSync has several compelling advantages over other sync servers yet built. Specifically it is the only sync server that has a built-in “no SQL”  Redis key value store, making it more scalable than other sync servers who offers internal relational database servers for caching. RhoSync also performs its push-based sync using the native smart phone push SDKs, which no other sync server does.

·       Liberal use of code generation
 Rhodes/RhoSync can write lot of code for you. For example, when you need a class to represent a table in your database, you don't have to write most of the methods. Rhodes even offers an application generator that creates an initial app based on the structure of your models or business objects in your app. It’s very similar to the scaffolding offered by most modern web frameworks with basic “list/create/read/update/delete objects” functionality. For each basic CRUD action, views in HTML are also offered. App developers spend most of their time just modifying views as they see it. No other framework provides an app generator, nor does any SDK. Rhodes looks at the table's definition and creates most of the class. You'll find that you're writing only a fraction of code compare to other frameworks.

·       Metadata
Every enterprise application that is used to run a company’s core business has a different schema for its business objects. For example, every application has varying and customized structure that changes with time. It is not possible to install the client application again and again for a small change. Metadata framework provides a way to handle the view from Rhosync server. It also provides validation and custom template.

·       Hosted Development and Build
Rhomobile also provides a hosted management and Build through Rhohub. We can deploy Rhosync app and build our Rhodes code for different phones with it. No other products in market offer such functionality or feature as of now.
  
PhoneGap
PhoneGap is an HTML5 app platform that allows you to write native applications with web technologies and get access to Native Capabities of phone with ease. PhoneGap uses standards-based web technologies to bridge web applications and mobile devices.

Strengths :

  • Can use HTML5 and CSS3
  • Deploy your app to Multiple Platforms (Symbian and Bada is also supported)
  • Access Native Features
  • Use JavaScript to write your code
  • Licence under Apache Software Foundation
  • Very well documented
  • PhongGap APIs are more generic and can be used on different platforms such as iPhone, Android, Blackberry, Symbian, etc 
Weakness:
  • No MVC
  • No ORM

Appcelerator Titanium
Appcelerator Titanium is an open source mobile application development tool for iPhone and Android. We can also create Desktop application with titanium. It allows you to code apps with HTML, CSS and JavaScript. Titanium primarily uses Javascript and JSON code to write your Native application. It supports Ruby, Python, and PHP scripts for broad developer coverage. If you are creating any social media mobile app then it is better option as Facebook, Yahoo etc API is available with titanium.
Documentation is available here: http://developer.appcelerator.com/documentation

Strengths:

  • Compiles to truly native application code, not HTML5
  • Very large library of APIs for all kinds of activities and data access
  • Uses Javascript/JSON for primary language
Titanium appears to be more feature rich than PhoneGap by bridging more mobile phone functions to javascript. 

Weakness
  • Only support iphone and Android
  • No MVC and ORM
Rhodes and Phonegap does NOT compile your html, css or javascript code into "native bits". When the application runs, these resources use  UIWebView control and run there. From architectural standpoint, these the frameworks are very similar. 

Also i have presentation in RubyConfIndia 2012 about "Which Mobile platform should i choose?"

Sunday, March 27, 2011

Changing Rhosync URL dynamically

We may need that we want to change rhosync server URL dynamically. We can change using  Rho::RhoConfig API

SyncEngine.set_syncserver('http://newurl/application')


Calling the function above will do the following:

  • Update the in-memory syncserver for the SyncEngine 
  • Perform a logout to make sure the session for the old syncserver is removed
  • Write the new syncserver property to rhoconfig.txt

Tuesday, February 22, 2011

Rhomobile javac invalid flag error

Sometime we try to run rake run:bb and we get following error:


[...stuff deleted]

cp -r platform/bb/build/../hsqldb/src/com/rho/file/
PersistRAFileImpl.java C:/Doc
uments and Settings/mrcorba/storemanager/bin/tmp/vsrc/com/rho/file
        executing javac
PWD: C:/Ruby19/lib/ruby/gems/1.9.1/gems/rhodes-1.5.4
CMD: "C:/Program Files/Java/jdk1.6.0_03/bin/javac.exe" -g -d "C:/
Documents and S
ettings/mrcorba/storemanager/bin/tmp" -classpath "C:/Documents and
Settings/mrco
rba/storemanager/bin/RhoBundle.jar;C:/Documents and Settings/mrcorba/
storemanage
r/preverified/RubyVM.jar" -bootclasspath "C:/Program Files/Research In
Motion/Bl
ackBerry JDE 4.6.0/lib/net_rim_api.jar" -source 1.3 -target 1.3 -
nowarn "@C:/Doc
uments and Settings/mrcorba/storemanager/bin/tmp/vsrc_build.files"
@platform/bb/
build/hsqldb_build.files @platform/bb/build/rhodes_build.files
javac: invalid flag: C:/Documents
Usage: javac
use -help for a list of possible options

Error compiling java code 



Solution 
Try to move your app into a folder without spaces.
 Ex If you project is in C:\some directory\Rhodes_application then put your applicaton in  C:\some_directory\Rhodes_application
This is because sometime Rhodes is not able to count white spaces.

Friday, January 28, 2011

Rhomobile talk in Pune Rails Meetup


Today Akshat and I got a chance to speak about Rhomobile in Pune Rails meetup. It is good to see that lot of people are showing interest in Rhomobile. 
You can download PPT and code which we showcase from following link :
Code on github :

Monday, January 24, 2011

Improving performance of your Rhodes application #Rhomobile


I am listing out the way to improve the performance of Rhodes application:
  • Set MinSeverity=3 in rhoconfig.txt for production. Otherwise it will log all your activities and will affect your performance.
  • Set bb_loadimages_async=1 in rhoconfig.txt. In this mode next page opens, while the images are being loaded in the background 
  • Minimize the possible external files like CSS and Javascript. If possible include these file in layout.erb. 
  • Use Fixed schema instead of Property Bag if you schema is fixed and not expected to change. You can refer this link to understand it better http://itsallaboutruby.blogspot.com/2011/01/difference-between-propery-bag-and.html
  • Avoid using XML as they are slow, instead try use JSON.
  • Try using Rho JSON for parsing, if you have been using JSON. Rho JSON will minimize your sync time.
        parsed = Rho::JSON.parse("[{\"count\":10}]")

     You can refer following link to dig it in detail:

----------------------------------------------------------------------------------
Courtesy: @adamblum and akoc :

  • Bulk Sync :  Bulk sync will make huge deference in performance while syncing from rhosync.


  •   Push : Rhosync Push API also give a edge on performance while syncing.

-----------------------------------------------------------------------------
P.S : If anyone can suggest any other ways he is welcome to comment on the Blog :) 



  

Thursday, January 20, 2011

Difference between Propery Bag and Fixed Schema #Rhomobile

Rhomobile provide a mini ORM called Rhom. It is similer to Active Record of Rails but with less features.It provides a high level way to make the local database easier to program. That database is SQLite on all platforms except BlackBerry where it is HSQL.  

We can choose to store data in two way Propery Bag or Fixed Schema

Property Bag
All the data is store in stores in single table. Property bag is a db table which contains object id/attribute/value triplets and therefore set of attributes for each object is arbitrary.

Advantage
  • It is simple to use, no require for specifiyng attributes before use
  • we don't need to migrate data if  we add/remove attributes
Disadvantage
  • Size is 3 times bigger than fixed schema
  • Slow while sync

 This is how model look for PropertyBag:

class Employee
  include Rhom::PropertyBag

  # Uncomment the following line to enable sync with Employee.
  # enable :sync

  #add model specifc code here
end

Fixed Scema
Fixed schema is a regular db table with fixed set of columns (attributes)

Advantage
  •   Smaller size, you can specify index for only required attributes
  •   Faster sync time then Property bag
Disadvantage
  • You have to support all schema changes
 This is how fixed schema model looks :

class Employee
  include Rhom::FixedSchema

  # Uncomment the following line to enable sync with Employee.
  # enable :sync
  set :schema_version, '1.1'
  property :name, :string
  property :age, :string
  property :company, :string
  property :address, :string
  property :gender, :string
  property :salary, :string
  #add model specifc code here
end

Note : You have to reset database if you change the property

When you use Fixed Schema model application developer is responsible for sql schema. So when you add or delete some properties or just change app logic you may need to perform data migration or database reset.
So if you have to add a column in a table we have to add a property and then reset the Device.

To create a index in fixed schema we will write following line in model :
index :by_name_tag, [:name, :tag] #will create index for name and tag columns  

To create a primary key in fixed schema we will write following line in model :
unique_index :by_phone, [:phone]

Choosing in between PropertyBag and FixedSchema depend on you requirement. 

Monday, January 10, 2011

Disable status popup in Rhomobile

If you want to disable popup then add this line before dosync :
SyncEngine.enable_status_popup("disable")

And If you want to show popup then add this line before dosync :
SyncEngine.enable_status_popup("enable")

By default  :
Blackberry – Popup is enable
iPhone – Popup is disable
Android – popup is disable