
Apache Cordova: after 10 months, I won't using it anymore - yla92
http://geekcoder.org/apache-cordova-after-10-months-i-wont-using-it-anymore/
======
AshleysBrain
On performance, the new WKWebView on iOS (with Nitro JS + GPU rendering,
including WebGL), and the Chromium webview on Android 5.0+ (or Crosswalk for
Android 4.0+, similar features all round), radically changes the performance
story. It's almost identical to the system browsers now. Facebook's comments
about HTML5 were back in the dark ages when the webviews generally used
horribly slow software rendering and didn't have JIT for Javascript on iOS.
It's a completely different picture today. In fact, our performance-sensitive
HTML5 game engine[1] targets the iOS 8 webview and Crosswalk for Android for
making native apps, and they generally work as well as in the browser, which
is very good, especially on newer devices. Modern web APIs are also
asynchronous which helps offload work from the UI thread, and Web Workers can
do that for arbitrary JS code too. For example our game engine runs A*
pathfinding in a web worker, offloading any performance impact from the CPU
intensive algorithm and running it in parallel to the game.

I think it's time to stop accusing webviews of being slow.

[1] scirra.com

~~~
0x0
Does WKWebView work with file:/// urls needed by Cordova?

~~~
gpmcadam
Is there a reason they don't ship with a simple web server to server out the
static files, similar to `python -m SimpleHTTPServer`?

~~~
eddieroger
Why would they want to? Both platforms have webviews that can render HTML from
a file, or passed in strong form, or whatever you like. Why point it at an
internal web server? If anything, it'd add overhead to the system that's
unnecessary.

~~~
0x0
Apparently WKWebView does not support loading from file. That's why he
suggested wrapping it in a localhost HTTP server.

------
hliyan
We've been using Cordova for almost 2 years (one in production, mind you), so
I beg to differ.

Granted, our applications may be different and yes, Cordova, if not done
right, can be excruciatingly slow. But we have managed well. Simple things
like properly paginating data (rather than trying to infinite scroll),
cleaning up CSS, avoiding repeated query selections (which is a bad habit of
some jQuery developers) made a huge difference[1].

Our older app is built on jQuery Mobile. The latest one is Ember. The next R&D
project I'll try will probably use React with Cordova. Mobile browsers are
always getting better. After a while, I have the option of using App Cache
instead of Cordova, without any significant code changes (I'm not using
plugins yet).

[1] Edit: And not abusing local storage.

------
jorgt
There's a use case for everything. I for one am not wasting resources creating
and maintaining two versions of fairly simple applications in a corporate BYO
environment, like the one I'm working in. There are plenty of convenient and
easy to use frameworks out there that make positioning and screen creation
just as straight forward as Xcode or the android development tools.

Actually, I always find it a bit surprising Cordova doesn't have more
competition.

Edit; I find the title misleading. It's not so much about Cordova as it is
about hybrid app development

~~~
seanwilson
I agree with this. If someone thinks Cordova is bad, what are you comparing it
to? Maintaining two separate native code bases (including test suites and
finding third party libraries for both that do what you need) to support iOS
and Android isn't exactly a walk in the park either.

Coding is all about trade offs. There is rarely a perfect solution for all
cases otherwise frameworks like Cordova would never exist in the first place.

------
csvan
So I was reading this, and the only things that kept repeating in my mind were
"Ionic, Crosswalk, Webworkers, Ionic, Crosswalk, Webworkers..."

(Yes I know Crosswalk is Android only, but it works wonders).

~~~
stewbrew
"To bundle Chrome, you will see a small (~10-15MB) size increase in your
Android Apps."

I wonder what kind of apps they run that make them call 10-15mb call "small".

~~~
lmm
One game I play is 500mb. A few people complain about it, but honestly, with
today's flash sizes, who cares?

~~~
SunboX
Don't judge about others based only your used hardware! There are a lot (!)
people with devices out there that only have 10MB storage left and can't
install a app because it's size is bigger than that. ;)

------
blhack
Every time I read one of these "this common, popular tool actually SUCKS", it
seems like the author is trying to use it in a way it wasn't really intended
(or obviously shouldn't be used).

Of course you aren't going to get native performance out of cordova. You are
going to get webview performance out of it. If you need native performance,
write a native app.

------
GFischer
The article makes some good points, but I wish he'd asked someone else to
proofread and correct it... it has way too many mistakes (I understand English
is not the author's mother tongue, but it's not mine either).

~~~
Sacho
For me, the more glaring problem is that the article simply makes statements,
with _no argumentation_ to back them up. There are no examples, no data to
support his claims, no follow-through on any of his categorical declarations.
The only useful information I got from it is that the author is frustrated
with Cordova.

------
onion2k
_There is no sens to spend time trying to do your app multi-platform from the
beginning. If your app do not works on iOS, it will not works on android
neither._

Conversely though, if your app is a success on iOS then it's very likely that
you'll want to get an Android version out before the clone-ware makers copy
it, so if (and it's admittedly a _big_ if) your app is something that Cordova
can do well there's very few reasons against using it. For some use cases it's
a good framework, notably "information viewing" apps, business CRUD apps and
simple 2D canvas games.

------
nolanl
For doing database work in a separate thread, you _used_ to be able to access
WebSQL from a web worker on both iOS and Android, but sadly that's been
dropped as of Chrome 39 and iOS 9:
[https://github.com/pouchdb/pouchdb/issues/2806](https://github.com/pouchdb/pouchdb/issues/2806)

Also I don't believe you can use the SQLite Plugin in a web worker either:
[https://github.com/litehelpers/Cordova-sqlite-
storage/issues...](https://github.com/litehelpers/Cordova-sqlite-
storage/issues/105)

Luckily, you can still access IndexedDB from a web worker on both platforms
(if you are able to use Safari's partial implementation). Also depending on
what kind of work you're doing in the database, most of the action happens at
the native level rather than the (DOM-blocking) JS level.

~~~
jkot
If background data access was really removed in newer browser version, than
just WOW.

~~~
nolanl
Well, WebSQL was deprecated in favor of IndexedDB. LocalStorage is also quasi-
deprecated (synchronous access == problems), which is why it's not available
from a worker either.

------
andresmanz
I tried Cordova three weeks ago, on my Nexus 10 (Android 5.1.1). I wanted to
have a native UI, so I tested angular-material and Polymer. I wasn't too happy
with the result, due to stuttering animations kind of ruining the UX.

Having a shared C++ code base and the respective native UI code works
perfectly fine for me, so I wouldn't use Cordova again. I don't see why I
should. I'm just as productive there as I am with the web stuff, with the
difference that I get a truly native look and feel, without having to watch
performance all the time. I'm sure that, if you want to take the time, you can
get perfectly well running apps. But for me, it isn't worth the trouble.

I also tried Qt and it was nice, but the app took ages to load on an actual
devices (because of QML) and their licenses get more and more messed up.

~~~
hliyan
> I wanted to have a native UI, so I tested angular-material and Polymer

Aren't Web Components still heavily polyfilled in most mobile browsers? I'm
wondering how much of the problem was due to the Polymer library than Cordova
proper.

~~~
andresmanz
I thought that would make sense, too. But I found them to be working OK in
Chrome on Android, so I thought I could give it a try.

I should have said that I wouldn't create any hybrid mobile apps anymore, not
just Cordova. That's not because I don't like it - it's simply because the
other options work just as good for me. At least for now - can't say anything
about the future.

~~~
hliyan
Right.

> I should have said that I wouldn't create any hybrid mobile apps anymore,
> not just Cordova

I must admit, I'm still quite enamored with them, if only for development time
and maintainability. I'd rather not develop 3 different apps for desktop
(browser), Android and iOS. As I said elsewhere, I'm waiting to rely on App
Cache instead of Cordova in the future.

~~~
andresmanz
> I must admit, I'm still quite enamored with them, if only for development
> time and maintainability.

That's a very good reason for many developers. My UI code is usually rather
small, with the C++ code being the biggest part. I really like C++ and Java,
and Objective-C is OK. I'm pretty sure if I didn't, I would take a different
route.

I'm still pissed off because loading in Qt apps can take very long. Writing
the apps in QML, JavaScript and C++ was a lot of fun, but I couldn't recommend
anything that destroys the UX so much.

------
bigiain
Hmmm, I note in his closing para: "Facebook wrote a good article when they
have decided to switch from a web app to a native one." A three year old blog
post from Facebook.

Now the circle has turned with React and React Native…

~~~
matwood
To be fair, react native compiles to native according to their keynote were it
was introduced. FB gave up on the web app/hybrid app and in the same keynote
strongly said the experience will never be the same or good enough as native.

~~~
ksherlock
react native doesn't compile to native. It's javascript with native GUI
controls instead of the DOM for the presentation layer. (You can still have
parts that are objective C or swift and are thus compiled, of course).

------
SchizoDuckie
FUD.

Ever heard of WebSQL for storing your data? After 10 months, you should have
been able to work around nearly anything you mention in your article.

~~~
thomasfoster96
WebSQL is pretty much dead (which is unfortunate, and you should direct stern
words towards Mozilla), so relying on that would be pretty risky.

~~~
fbender
There's IndexedDB. Both Mozilla and Microsoft opposed on standardizing on a
specific implementation of an SQL database (sqlite v2), and rightly so.
There's loads of commentary/rationale on this issue on the web, so I won't re-
iterate it here.

iOS has IndexedDB since v8.0 though the implementation is poor. I don't know
if they've fixed it in any 8.x release. However, you're (mostly) not using
IndexedDB directly anyway but a storage library, which supports IndexedDB,
WebSQL and maybe localstorage as a fallback (e.g. localForage[1] for a simple
key-value DB).

[1]
[https://mozilla.github.io/localForage/](https://mozilla.github.io/localForage/)

------
nailer
HTML5 is working for Instagram and Apple Music, I don't think many people
would say they're inherently slow.

~~~
eddieroger
Instagram and Apple Music aren't running through an abstraction layer than
brings it's own variable overhead. It's not a good comparison.

~~~
nailer
I don't think of Cordova as much of an abstraction layer. They just expose
things to the `window` global.

------
_pmf_
Can anyone using Xamarin chime in as to whether the situation there is better?

~~~
vittore
Well you are getting native app with xamarin, so it must be better.

~~~
SunboX
I heard a talk lately by two students that came to the result that it was a
lot time consuming to debug. You have to get from native-code failures to your
JS implementation. But I didn't try it myself by now.

------
mahouse
This is a very bad article. The real problems with Cordova are:

* Core functionality is broken between releases. If you ask in the IRC support channel, they will even tell you not to update if things work well! What if I need a new feature?

* Documentation is absurdly horrible or even plain wrong. I have been told several times to refer to the source code to find out how something works.

* If you face any problem, chances are you will never find an answer in Google. You may find some StackOverflow thread if you are lucky, where several clueless people argue about things they do not know and then arrive to a wrong conclusion. (The programming skill levels of Cordova users on those communities are usually very low.)

* Critical functionality (things such as local notifications) is not included. You must rely on 3rd party plugins, that could be well maintained, or could be not maintained at all.

Yes obviously a Cordova app does not look native. It's not native and it will
never be. Period.

~~~
posabsolute
I think it is also a question of ressources, I built a pretty good backbone
app with cordova, I would say that you can get 90% there
([https://www.cakemail.com/mobile](https://www.cakemail.com/mobile)).

The question is also what can you afford. Can you afford to have 2 ios & 2
android devs? Can you afford to build 2 times all the UI features, etc.

For a small company, small budgets, if you have strong front-end devs &
designers you are probably going to get a good cordova app & you can move your
company much faster.

You have big bugdets? Hire the native devs, get the 100% performance &
experience from native.

~~~
vbezhenar
For basic application there's no need for very deep knowledge of the platform,
so you can find people who know iOS and Android equally well and just write
two different apps. As Cordova might introduce more problems than advantages,
writing two identical apps might actually be faster, if app is not that huge.

And native fast responsive app with smooth animations might earn you more,
than HTML container.

I wrote a simple game using cordova and I won't do it again. HTML+CSS+JS just
not suited for mobile app development (I didn't try react native, those guys
might change the game). Either you use frameworks and everything is just bad
or use vanilla JS and everything might work, but you have to write a lots of
spaghetti-code and device support might be limited.

The real unmatched benefit of using cordova (or any other webview) is the
ability to deliver updates for your app without bothering with App Store
moderation.

~~~
moron4hire
> but you have to write a lots of spaghetti-code

What? As someone who does a LOT of vanilla JS, what do you consider "spaghetti
code"?

~~~
mgkimsal
"vanilla spaghetti" might be a new term we can start using :) leaves a bad
taste in everyone's mouth!

------
MichaelCrawford
I dont know from Cordova but a former employer bet the far on Solr without
evaluating in any way. When I tried a search for solr sucks I got 600,000
hits. No one ever answered my questions on stackoverflow.

~~~
Adirael
Solr and Cordova are on different realms, I don't see how that's relevant in
this discussion. FWIW I've used Solr a lot and it's great for faceting and
geometric search.

~~~
MichaelCrawford
they are both apache projects.

I have used many apache codebases, all the others were excellent. ai expect my
former employer chose solr because of thevapache foundation's great
reputation. I looked forward to using it and so was completely dumbfounded by
its poor quality.

------
infinityplus1
In another news, water is wet.

