Runtime Architecture

Rhodes development files are compiled into a native executable that is installed on the device or run in a desktop simulator using command line tools or the web interface on rhohub.com.

Since Rhodes apps are native binary applications, they can be submitted and distributed through the Apple iTunes App Store, BlackBerry World, Android Marketplace, and other distribution channels. To build for a device, you typically need to sign up for those developer programs and acquire cryptographic keys required to sign applications, even though you will not be writing in the platforms native SDKs. You also need to observe each platform's user interface guidelines so that your applications can be approved. (See Part 1 of the book on submitting apps for your target platform(s).)

On platforms where the primary development language is Java, such as BlackBerry, Rhodes applications are cross-compiled into Java bytecode that are then executed natively. On iPhone, Android, Windows Mobile and Symbian platforms, Rhodes applications are compiled into Ruby 1.9 bytecode. On these platforms, Rhodes includes a Ruby executor that runs the bytecode on the device. The Rhodes Ruby implementation is a subset of Ruby 1.9. It does not include all of the libraries that you would find on a desktop implementation of Ruby, although it is possible to extend it and add additional libraries into your application. (See http://wiki.rhomobile.com/ index.php/Rhodes#Adding_Libraries_to_Your_Rhodes_Application.)

To connect your Rhodes application with web services, you can use RhoSync or connect directly. You can connect directly via JavaScript, use the Ruby net/http library, or the optimized Rho:AsyncHttp. However, with remote data, you almost always want to cache it locally for offline use and using a RhoSync server is ideal for that use case. As detailed in chapter 7, you would write a source adapter that runs in the server environment where you have access to the full Ruby language and complete libraries.

Although Ruby is an interpreted language, using Rhodes, you cannot run arbitrary Ruby code at runtime by using, for example, string eval. That capability was intentionally removed in Rhodes Ruby interpreter to comply with iPhone App Store's Rule 3.3.2 that states:

An Application may not itself install or launch other executable code by any means, including without limitation through the use of a plug-in architecture, calling other frameworks, other APIs or otherwise. No interpreted code may be downloaded and used in an Application except for code that is interpreted and run by Apple's Published APIs and built-in interpreter(s).

(www.rhomobile.com/blog/2009/05/29/iphone-app-store-rules-and-guidelines-on-use-of-frameworks/)

Rhodes is a fully native application and embeds the device's built-in browser. This has implications for the markup, CSS, and JavaScript that can be supported on each platform. Some devices, such as the iPhone and Android, have full-featured browsers while others like the BlackBerry do not. This means that you cannot write HTML and CSS that take advantage of advanced or platform-specific browser features on one device and expect it to work on another device with a less capable web browser. While Rhodes apps are developed much like web apps, they run locally as native apps and not remotely like web apps. All processing and database access is local.

App Gangster

App Gangster

Get All The Support And Guidance You Need To Be A Success At Dominating Apps. This Book Is One Of The Most Valuable Resources In The World When It Comes To Becoming The Godfather Of Smart Phone Apps.

Get My Free Ebook


Post a comment