The first day of the PhoneGap Conference 2013 (Portland, OR) was really good. In this article I will briefly touch upon what was presented (follow the links to the presenters sites for more info on that) and then elaborate on how I see the technology can be taken to the next level, with a focus on enterprise contexts.
I am not going to say anything about the technology side of things, like OS support. There is a lot of discussion and interest in that area already.
PhoneGap Conference Day One
The first day (July 18, 2013) I attended presentations by:
- Andy Trice, on basics, deployment to devices, debugging, etc.
- Christophe Coenraets, on designing your PhoneGap application properly (with
1011 architecture principles) - Holly Schinsky, on integration of your PhoneGap with native code for the device.
The day was both inspirational and informative, and it was good to meet a lot of people that are on the edge of technology.
Infancy Challenges
It seems Adobe PhoneGap (or it’s open source mother project Apache Cordova) is very much in it’s infancy. Integrating these technologies in enterprise projects without any on-site support is going to provide some challenges:
- Documentation: At first sight there is quite a lot of documentation. But for someone getting started, it is difficult to get a consistent answer on some initial questions, like:
- What is the difference between Corova and PhoneGap? And what about Icenium?
- How do I install this stuff on my machine? Should I download a ZIP, do ‘git clone’ or use ‘npm install’?
- What kind of directory structure am I supposed to use?
- How do I set myself up for debugging and profiling?
- How do i add a plugin to my project, in a way that I support local compilation, PhoneGap Build and perhaps even Icenium?
- Inconsistencies in approaches: Even if you manage to get the information you need to get started, you will find there are different approaches for critical things like the directory structure:
- If you use the (OS-specific) ‘create’ command, then you will get an OS-specific project. However, if you use the (improved, but less known) ‘cordova create’ command, then you get a completely different structure, with a project that supports multiple OSes from one directory hierarchy. Potentially there is also a ‘phonegap create’ command which might work in a similar way.
- The ‘cordova emulate’ command runs your application in an emulator, but the ‘phonegap’ command does not have an explicit command for that, but you can run ‘phonegap run’, which will start the emulator only if there is no connected device available.
- Separation of concerns: In enterprise projects, it is common practice is to store the team’s files in a version control system such as Subversion or Git, and to store only the files in there that the team has authored, not the generated files.
However, with Cordova/PhoneGap you get a whole hierarchy of generated files. And it seems that you cannot avoid editing files in that hierarchy or adding new ones, for things like registering custom plugins, adding custom splash screens and icons, etc. - Integration with enterprise tools: As it currently stands, integration with common enterprise tools like e.g. Maven and Jenkins seems possible, but appears to require quite a lot of manual labor. There seem to be no Maven plugins available on the Central Repository and there might be some manual steps involved in building iOS apps.
Potential for Efficiency Improvements
On top of these challenges, I see a lot of potential for making people more efficient in creating PhoneGap applications.
A good first step was that all three presenters shared some example projects with useful (working!) code, all on GitHub:
- Andy: threedoo
- Christophe: phonegap-day-app
- Holly: CalendarPluginSample
Again, that is a good start, that can be improved upon by:
- having official examples with a consistent approach,
- make these examples more prominent,
- tackle a number of things that most people will want to address in their projects anyway, like single page applications, page animations, addressing the click delay on touch devices, theming, etc.
Moving It Forward
Combining all the above, here is a non-exhaustive list of things that could be done to move Cordova/PhoneGap forward:
- Have a single and prominent set of interconnected tutorials on the site that answers FAQs, and guides people all the way from installing PhoneGap on their specific platform to running an example application on their emulator or device.
- You can potentially have multiple variants of the example application, e.g. initially one based on Dojo and one based on jQuery + Ember.js + Twitter Bootstrap.
- Have a deprecation warning banner on documentation pages that pertain to older versions of PhoneGap, with a link to the latest version.
- Have a consistent CLI across PhoneGap and Cordova, with the PhoneGap variant only adding additional commands and features.
- Explicitly document and deprecate old directory structures and the old OS-specific ‘create’ command in favor of a new ‘cordova create’ or ‘phonegap create’.
- Standardize on a directory structure that separates authored from generated files. To comply with the Maven Standard Directory Layout, it could be set up as follows:
- src/ – contains all authored (source) files
- src/main/www/ – the shared PhoneGap ‘www’ directory
- src/main/platform/ios/ – the files to merge into the iOS project, including icons, splash screens, plugin definitions, etc.
- target/ – contains all generated files
- src/ – contains all authored (source) files
- Design and implement a strategy for upgrading Cordova/PhoneGap versions, allowing people to keep their projects untouched.
- Make sure people do not have to touch any generated files, allowing them to run something like ‘cordova platform remove ios && cordova platform add ios’ without losing any information.
- Implement a Maven plugin that supports creating assets and integrates with PhoneGap Build.
- Implement a Jenkins plugin for integration with PhoneGap Build.
If you have any feedback, do let me know in the comments or on Twitter: @ernstdehaan.