Live data from Hacker News

PhoneGap vs. Native: Some Thoughts on Going Native

groups.google.com

11–20 of 41 posts

Re: PhoneGap vs. Native: Some Thoughts on Going Native

#11
I spent an inordinate amount of time fighting webkit before switching all of our stuff to native. The four biggest problems, I think, with the state of webkit are:

1) Implicit memory management of large images/surfaces isn't reliable. There's basically nothing you can do (outside of not doing anything) to prevent your page from crashing webkit if you use too many (where too many is undefined) accelerated elements/total texture space. There's no "Running low on memory" callbacks or means to explicitly remove a recently drawn image from memory outside of removing it from the DOM and crossing your fingers.

2) Lack of proper prioritization in javascript. One of the things that IOS focuses on a lot is separating out user interaction on the main thread from everything else on background threads. In JS, if you're not careful and you do an innerHTML in the wrong spot, you can lock up a bunch of user interaction or delay an AJAX request that would otherwise be executing. Maybe the answer here is something like .updateInnerHTMLWithCallback(function foo(){}) to prevent breakage of JS that does expect the DOM to be consistent after an innerHTML update. (Edit: Oh I forgot, we actually did something similar to this by doing all of our innerHTML updates in setTimeout'ed functions with a 1ms delay). There's a lot of weird stuff around loading images and keeping UI responsiveness then as well.

3) No cache beyond pure source code between separate user sessions. One of the biggest issues for us was initial load time (parsing and calculating CSS, parsing and running JS, and blitting down accelerated DOM elements, etc). Once everything was loaded we could imitate a native-level experience, but this often would be 10-15 seconds in. Perhaps an intermediate cached file (kind of like python's pyc) would help alleviate this.

4) Debugging. This was covered, but ugh, what a nightmare. At a certain point I was booting up XCode instruments and tracing through webkit code to figure out what parts of our JS/CSS/etc to optimize.

Re: PhoneGap vs. Native: Some Thoughts on Going Native

#12
post #6

Same experience with phonegap + sencha touch. My personnal conclusion is that : if you're doing "business" app (aka : where data matters much more than UI responsiveness) AND you want to release the app both for Android and iOS : go Phonegap. Otherwise, and until the majority of smartphone become as powerful as the iphone4S, stay native. With ARC, developping on iOS with Obj C has become pretty much like developping…

What if you've already developed a (simple) Android app for consumers, and you want to enter the iOS sphere as well, but you don't have an iOS dev on the (completely bootstrapped) team? Would it be worth investing one team member's time to learn iOS development, or outsource the creation and simultaneously learn to maintain/extend the code, or to simply go with PhoneGap despite the performance drawbacks? It's not a q…

In my experience it is worthwhile to learn native iOS development. Once you setup the environment and get used to XCode it is kind of fun and it doesn't take too much time. Knowledge of Android and iOS and optionally PhoneGap development will make you (or your team member) a better developer regardless of which technology you actually use. And based on that you will also be able to make an informed decision about which approach to use for a particular project.

Re: PhoneGap vs. Native: Some Thoughts on Going Native

#13
post #3

This person successfully managed to trade a bunch of irritating issues for a different set of irritating issues: that generally makes one feel happier, as working around new and thereby relatively exciting irritating issues as a vacation from the worn and tired ones we are now so sick of it makes us want to die, is all many of us can hope for in life.

It's not exactly like that — there will always be issue, we know it, but some are more irritating than other. I can handle Xcode crashing, and needing some help to compile everything — I can live with that. The debugging part otherwise, is subpar. It's (at least for me), a true hell. Appcelerator was the king of unusable error for example, that and a lack of GOOD (heck, even complete) doc were driving me mad.

So yes he has made a trade. I think a good one, but to each his own !

Re: PhoneGap vs. Native: Some Thoughts on Going Native

#14
post #8
post #5

Great post. Having dabbled in mobile dev (and spent lots of time in web development), I always want to leverage my existing skills rather than learn new languages/dev techniques if possible. Still, a hammer - no matter how useful - is not always the right tool for the job... For all of the attention to user interface design, I find iPhone development one of the least intuitive environments going. Objective C isn't ba…

In that case, skip IB and build your views in code.

Yeah, that route could work... but it is a bigger investment in time to learn another language/development environment in greater depth. At least part of the appeal for PhoneGap and other third party tools is that devs are trying to avoid XCode / Objective C development. There is something painful/time consuming about the process in comparison to other comparable programming tasks.

It seems like there are two ways of approaching GUI/language development:

1) Apples way: Keep building on a base language (C). Add new features (Object orientation, XML rather than proprietary configuration, Code Generators). Maintain backwards compatibility (your old devs will be wowed by each new release's automations and syntax improvements. New devs that have not been part of your programming tradition will require greater up front study time to grok the process).

2) Microsoft's approach: Make visual development "primary" (closer to the way one uses a GUI rather than builds it). Ignore underlying language constructs and best practices (e.g. make everything global).

Having worked with Microsoft, I thought that Apple (especially with their attention to UI design) would give developers a more intuitive interface. Perhaps it is intuitive to those who can build GUIs in code, but it was not to me. This is in stark contrast to Microsoft, where someone who knows very little about programming can create a usable GUI (and get themselves in trouble quickly as well). Don't get me wrong, I am not a Microsoft fan and spend little time in that world. However, I was able to jump in on several projects and be productive with very little ramp up time. Apple development required a greater investment of time and energy up front to be productive. Enough that I have considered PhoneGap and other tools as alternatives for subsequent development.

Re: PhoneGap vs. Native: Some Thoughts on Going Native

#15
I am equally productive with web as well as native development so it makes no difference to me. Not surprisingly, Phonegap never appealed much - same work, inferior results, single (but dubious) benefit: cross platform.

I was pleasantly surprised by Titanium mobile though when I had to evaluate it at my job 2 years ago. I set to reimplement one of our (non-trivial) apps and summarize my experience. I ended up writing 50% less code and it took about the same time as what I had spent on the native version. I consider this a compliment though as I was completely new to Titanium. On the flip side I was completely new to the app when I wrote it the first time :-)

The build/run/debug loop was unpleasant but I've heard that it has improved since then. As for performance, it was good - Titanium generates native UI, albeit with an interpreter in the middle.

I was quite surprised when it turned out that I have a 99% identical app. You see, from the very beginning I decided that I'll be hard on Titanium, my goal was no-compromise, high-fidelity clone. And it worked. The only problem was positioning a tooltip near a touch point - at the time there was no way to traverse the view hierarchy. But then again, maybe I could have implemented it in a different way.

I realize a lot has changed since than, but this is my 2 cents - sharing a real world/product experience.

Re: PhoneGap vs. Native: Some Thoughts on Going Native

#16

I like this post. I'd like it if we could get studies/posts on: 1) A/B testing of users' responses and revenue outcomes on native vs wrapper implementations of apps 2) Webkit performance metrics in wrapped apps on different platforms (e.g., exactly how slow is the app on the 4S, why, and can this be mitigated?) 3) good approaches to interfaces that don't confuse or put off the user but are simple enough to run smooth…

For A/B testing:

I'm working on a fast testing framework for native iOS apps. I posted some early design specs at appgrok.com. There's also clutch.io, which supports iOS app iterations (things similar to A/B testing) using a hybrid approach, if I understand it correctly.

Re: PhoneGap vs. Native: Some Thoughts on Going Native

#17

Another point: You have to pay to have you app reviewed on the AppStore, and it may be refused. If it is accepted, Apple will take 30% of your incomes. And your app will remain slow if it is connected to a database online.

What about the exposure it gives you app, and (potentially) much more sales (it has hundreds of millions of users with credit card, and buying stuff is just one click)?

That's why I still love eBay+PayPal despite their double-dipping on seller fees.

I've sold so many items that would otherwise live forever in a closet because they'd be too hard to find a local buyer. The number of eyeballs looking at eBay makes the place a huge net win.

Re: PhoneGap vs. Native: Some Thoughts on Going Native

#18
post #3

This person successfully managed to trade a bunch of irritating issues for a different set of irritating issues: that generally makes one feel happier, as working around new and thereby relatively exciting irritating issues as a vacation from the worn and tired ones we are now so sick of it makes us want to die, is all many of us can hope for in life.

You're right, but you're wrong too- they're different kinds of issues. One of the worst things about web development is that sneaking dread that you can't get there from here. The last 5% of evil performance bugs is particularly miserable in managed environments.

Re: PhoneGap vs. Native: Some Thoughts on Going Native

#19

I spent an inordinate amount of time fighting webkit before switching all of our stuff to native. The four biggest problems, I think, with the state of webkit are: 1) Implicit memory management of large images/surfaces isn't reliable. There's basically nothing you can do (outside of not doing anything) to prevent your page from crashing webkit if you use too many (where too many is undefined) accelerated elements/tot…

I'm not a mobile webdev, but about (2), did you try using Webworkers for the background tasks? iOS Safari supports it nowadays, right?
Post reply on HN