Monday, January 1, 2018

Lessons learned using Cordova in 2017

I would not refer to myself as an expert in Cordova, but I already had the pleasure to work with it (extensively) in a few occasions over the last few years, including but not limited to prototypes for weird would-be projects of friends of mine, production apps for my own company, plugins for products of a company and production apps for other companies. Sounds like a lot? Well, no - most of those projects were based on a technique to wrap an existing website in Cordova drastically reducing the amount of code that needed to be written from scratch. But I can tell you tales of suffering from those projects - because Cordova is not pleasant to use in most cases. But it gets the job done... eventually. I guess.

Here's a few of the things that I learned:

Most updates break something it a plugin, the build process or something else. If you're working with other developers it is crucial to use the same version of Cordova on all development machines! I should mention that this experience mostly comes from my projects being several months or years apart, which of course leads to breaking changes when updating from one major version to another. But that brings me to my next point:

Outdated plugins and documentation

There is a lot of very popular plugins that are simply no more maintained by the original author. The one that I had most problems with was phonegap-facebook-plugin (in retrospective I could have saved myself a lot of time by noticing the plugin still referring to "phonegap" rather than "cordova"). Thankfully there is a popular fork available which keeps maintaining the plugin, but that again is not compatible to the latest version of Cordova. Well, at least there is another fork for that which is a sign for how active the community is.
The same problem goes for documentation and the information available in general. While searching for a problem you are likely to dig up lots of articles from anno 2014. Not a problem per se, but reread the previous to paragraphs if you don't see why this is a problem for Cordova.

Weird bugs.

One more thing that almost cost me my sanity is that Cordova by default does not honor a website's viewport setting. An experienced web developer might have figured that out a lot faster, but it took me hours to understand why a website looked different when rendered in Cordova vs a browser. The solution was to use a plugin that was... well outdated and not compatible to the latest version of Cordova. :) Fortunately I was able to fix that easily.

I guess that's it for now. I was able to let the steam off! Please don't get me wrong: Cordova is great for some things, but I wish the whole developer experience would be more "consistent" in general.

No comments:

Post a Comment