|
Using Phonegap for mobilizing Domino Apps - a new platform for Domino To Go?
Occasionally we hear the question "Why do you use Titanium as base for your cool Domino To Go framework? Why not using Phonegap?". The quick answer always is: because with Titanium you're able to create real native Apps easily, while with Phonegap you're producing websites that want to look like native Apps.
Nevertheless I was curious what Phonegap really is about, so I spend some time in the last days to dig my way through Phonegap. My leading question was: would it be possible to port Domino To Go to Phonegap? In theory, this should not be that hard. Domino To Go needs a SQLite database to store data and a filesystem for some simple file operations. Furthermore, it needs an XHR object to do Ajax-HTTP calls. Everything else is pure standard JavaScript and should work instantly on platforms like Phonegap (or HTML5). Phonegap provides a SQLite database, file operations and the XHR object is part of JavaScript anyway. So I started to play and so far, porting Domino To Go to Phonegap seems to be possible. Look and feel of Phonegap Apps Developing a mobile App with Phonegap means to develop the UI with HTML5 and JavaScript. I used jQuery mobile, which allows to develop a basic UI fast and easy. But while I played with my test App, I always thought "this thing does not feel native". The look of buttons, lists and so on is not the very same as in real native Apps. The transitions between "windows" are not the same. In short, the look & feel is not the same. Maybe I did something wrong. Maybe I overlooked the "make everything look like native"-switch in jQuery mobile. In the end, I only had a couple of days for my experiments. With Titanium on the other hand, all native controls are used. The App looks & feels like every other native App on the device. From my perspective, this is clearly an advantage for Titanium. Working with JavaScript in Phonegap Apps Basically, coding JavaScript in a Phonegap App is not different from coding any other web application, since the Phonegap App on the mobile device is a web application. To access specific features of the device, like the SQLite database or files, Phonegap provides JavaScript APIs. While working with these device specific JavaScript APIs I came across one major issue I really don't like: the excessive use of callbacks. In Phonegap, you cannot do something like this: you need to do it like this: You see? Callback calls a callback calls a callback calls another callback. Perhaps I'm not modern enough, or I'm not cool enough, but I don't like this style of coding. And I'm very, very, very sure that every standard Domino developer who knows LotusScript and just made some progress in JavaScript in XPages does not like this style either. When working with a SQLite database it's the same. You cannot simply get a result set for a SQL query, you need to execute the query and give a callback that gets the result set. I feel this is unnecessary complicated. Don't get me wrong, there are situations where callbacks really make sense. For example for HTTP requests, because you don't know how long the request will take and you don't want to block the whole App while the request runs. But for small file and database operations, I thinks that callbacks only make the code more complicated. Is it worth the effort? As said above, I think porting Domino To Go to Phonegap would be possible. But it would need some creative work to maintain one code base for Titanium and Phonegap while covering the excessive use of callbacks in Phonegap, which is a major difference to Titanium. So is it worth the effort? At least for iOS and Android, I don't see a reason why to use Phonegap. Coding is more complicated, the UI doesn't look like native Apps and stuff like using an ecrypted SQLite database seems not to be possible with Phonegap. The best argument for supporting Phonegap would be that it is available for Windows Phone and Blackberry. Your opinion?
Comments (8) | Permanent Link
1) Using Phonegap for mobilizing Domino Apps - a new platform for Domino To Go?
Julian, Excellent stuff - its a fairly worn debate in the mobile space for a while. Not all can be answered with whats "best"? Apples or Oranges?... The SQL query stuff is deprecated. I am looking at indexedDb. Mobile jQuery works (kinda) on IOs but is suboptimal on everything else - its too bloated - there are lighter and better frameworks. I agree - it still looks and feels "non native". However who says it all has to look "native"? For examples of HTML5 apps look at the new linkedIn app for example. Lots of big companies are doing that - cross platform. Twitter, Facebook, Financial Times blah blah are all developing some beautiful applications. They are fast, responsive, intuitive and really slick. As you know "Phonegap" is just a route to the underlying "services" with a common api. HTML5 does a lot for you without it - you can get storage db / geolocation etc just using the "hybrid webview" approach. HTML5 is moving further into this space... I have also heard that Apple themselves use "WebView" techniques for hybrid apps that ship with the devices. Like everything in life there are pros and cons. Depends on the situation, company, goals, culture, skills, plans. Some excellent tools emerging on a weekly basis supporting this sort of development (I mean HTML5 hybrid development - not just phonegap). What I love doing is developing on the browser with no emulators etc. My clients also love producing RESULTS with the skills they have. As you know there is an industry push with things like WebWorks, appmobi, PhoneGap, Worklight - all HTML5 (and PhoneGap). I would be interested to see your product on this platform. I am sure that some customers would like your solution for writing cross platform HTML5 apps with a single code base. Will be blogging about my experiences myself so watch this space.... 2) Using Phonegap for mobilizing Domino Apps - a new platform for Domino To Go?
Why did you choose Mobile jQuery over Sencha Touch? 3) Using Phonegap for mobilizing Domino Apps - a new platform for Domino To Go?
no reason, jQuery was the obvious choice and documented in a PhoneGap-Howto I read. I learned about Sencha Touch later. 4) Using Phonegap for mobilizing Domino Apps - a new platform for Domino To Go?
I found Sencha Touch to have a much more "native" touch than Mobile jQuery (at least to iOS) - but of course there are some smaller integration issues in the latest version with PhoneGap. 5) Using Phonegap for mobilizing Domino Apps - a new platform for Domino To Go?
I'm developing with jQuery Mobile+PhoneGap at the moment and even though you can get into developing straight away with HTML5, CSS3 and Javascript, there definitely is a learning curve. I do have to say that you CAN make the UI look native for iOS. However, you are correct when you say that JQM is bloated. Even after minifying all code, compressing all PNG and JPGs, there is still that 300ms delay. My app is a portfolio and has to have images unfortunately. With PhoneGap, for example, using plugins the app reacts natively. I'm using the NativeControls plugin and works really well. The problem is documentation and some features I'd like to use i.e. Save to Photo Album (or Camera Roll) aren't available for all builds. Bummer. I'd like to try developing with Titanium. How difficult do you think it would be to port the other direction from JQM+PhoneGap to Titanium? From my understanding, Titanium has it's own calls. 6) Using Phonegap for mobilizing Domino Apps - a new platform for Domino To Go?
yes, Titanium has an API of it's own, with much less using of callbacks. I guess you would need to re-engineer the UI, but you could keep most of your business logic. 7) Using Phonegap for mobilizing Domino Apps - a new platform for Domino To Go?
i want sqlite database for windows phone 7 using phonegap nothing but using html5,javascript 8) Using Phonegap for mobilizing Domino Apps - a new platform for Domino To Go?
dd |
