Home > SOA Tips > Guest Commentary > Use JavaScript with the iPhone to create smart phone apps
SOA Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

GUEST COMMENTARY

Use JavaScript with the iPhone to create smart phone apps


George Lawton
02.25.2009
Rating: --- (out of 5)


News on SOA, EAI, Web services
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


While Objective-C remains the most powerful iPhone development language, JavaScript has been gaining traction as a viable alternative, particularly for basic applications and rapid prototyping. The benefits of JavaScript are a far larger audience of programmers and development tools, and a number of bridges have emerged to help JavaScript take advantage of native iPhone resources.

JavaScript alone does not give the developer access to all of the native resources of the iPhone but there are ways of accessing iPhone functionality for basic applications or prototyping. For more sophisticated apps developers will have to turn to Objective-C the native Mac programming language, which Simon Brocklehurst points is not nearly as popular as other languages like JavaScript.

One of the problems is that JavaScript must be interpreted by the WebKit embedded browser. As Dr. Nic noted, WebKit apps are slow. It can take a few seconds for the WebKit object to become available. It also suffers from running inside a JavaScript interpreter on top of a limited processor with small memory. Another drawback is that the bridge is only one directional. From Objective-C you can call JavaScript, but you can't invoke native Objective-C objects. However, he notes that JavaScript is a sweet option for rapid prototyping, particularly if your objective-C skills are limited because it gives the designer immediate access to building the app.

The limitations are also becoming less onerous. The second version of the iPhone firmware has doubled JavaScript performance compared to the first release. This was made possible with an update to the WebKit rendering eng...


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Guest Commentary
Get a grip on JavaFX 1.2 for Rich Internet Applications
On the road to SOA – Part 1, Boubez on early insights
On the road to SOA – Part 2, Governance is fundamental
SpringSource approach to adding enterprise class management and deployment features to Tomcat
Canonical Schema establishes interoperability: SOA Pattern (Week 6)
Legacy: Can't Live With It, Can't Live Without It
Review of protocols for cloud services - Part 1
SOA and TOGAF: A Good Fit?
Using atomicity to gain SOA granularity
Too Many Servers: A Case for Enterprise Architecture and TOGAF 9

Mobile Web services
Mobile development growing in prominence according to survey
Android and SOA
Mobile application development: Making it easier for developers
Chasing Apple, HP targets telecoms with app store pack
Google Chrome OS is coming, but what does Android offer now?
Check out mobile application development resources
Mobile app dev trends: Making life easier for developers
NEC and SAIC use SOA for first-responder app
Mobile Development Resource Guide
From mainframes to iPhones and beyond: IBM preps mobile SOA connection

Data services for SOA
SPSS and PMLL
Canonical Schema establishes interoperability: SOA Pattern (Week 6)
Medical imaging group build HL7 messaging hub with InterSystems Ensemble
Using atomicity to gain SOA granularity
Componentized XML Query tool takes a step forward
Podcast: SearchSOA tips on software architect skills
Services reuse drives ROI for SOA, survey finds
Tibco releases Complex Event Processing (CEP) suite with new rules, query interfaces
MapReduce moves from secret Google goo to enterprise architecture - Part 1
MapReduce moves from secret Google goo to enterprise architecture - Part 2

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


ine. The iPhone 3G processor is also 35% faster than the original hardware, which can also enhances performance.

John Resig has summarized his take on different strategies for writing JavaScript apps for the iPhone using JiggyApp, JSCocoa, tuning apps, PhoneGap, and WebTouch.

JiggyApp was one of the first iPhone scripting languages. Unfortunately it required a jailbroken iPhone, and the main site has since died. It gained a lot of publicity as it enabled a developer to code right from the phone.

JSCocoa is a bridge from JavaScript Core to Cocoa, allowing developers to create Objective-C applications using JavaScript. Developers can call C code, Objective-C code, and build JavaScript classes inheriting from Objective-C classes. Resig believes it is better suited for OX-X applications. Note that the main JSCocoa site has documentation and tips and tricks. The Google code site has more documentation and downloads for writing and testing apps.

Tuning Web Apps
Developers can tune their JavaScript mobile web application code to look a little more like native iPhone apps by doing things like providing a tray icon and a full screen view without the browser toolbar. However, these kinds of apps have limited access to native iPhone resources.

PhoneGap bridges the gap between web apps and native iPhone APIs for resources like the accelerometer and geoloaction. Future versions will support the camera and audio features. The goal of the project is to drive the adoption of open device standards for JavaScript applications running on major mobile platforms including the iPhone, Android, and Blackberry.

Meanwhile, WebTouch is a WebKit instance to render an iPhone application. At the moment, the project only provides a few snippets of sample code, but Resig believes it is a good entry point for developing hybrid HTML/CSS, JavaScript/Objective-C/Cocoa apps.

Rate this Tip
To rate tips, you must be a member of SearchSOA.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



SOA Trends and Strategy - SOA Education, SOA Development, SOA Implementations
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2001 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts