Smart Tech for a better Web
I was invited to the Mobile Forum Stuttgart and speak about Apache Cordova/Phonegap (great conference, check it out next year!).
For Time & Bill, I needed to get started quickly. I was looking into Android development and into iOS development. While I found Android being very easy for me as Java developer, I didn’t grow into iOS so quick as I would need it. For me PhoneGap / Apache Cordova was a savior before 2 years.
After the talk, I was speaking to a couple of devs. One of them asked me:
Would you use Cordova again, if you would have objective-c skills?
But I was not so sure if I would.
Don’t get me wrong: I totally enjoy working with Apache Cordova. It’s easy. But don’t expect to start with Cordova and have a native-looking and native-feeling app on your device in an instant. I haven’t expected that, so I was happy.
The biggest misunderstanding with Apache Cordova is that it does everything for you.
But it’s not the case. It is just the base for your application. It supports you to package your app and helps you to access device features like the camera. Nothing more. There is nothing in Cordova which helps you to organize your App in terms of for example MVC. It’s not an application framework. You need more. You need help from the Apache Cordova ecosystem. And with ecosystem I mean everything which helps you to build mobile ready websites.
For example, there is jQuery mobile. It is a framework which lets you organize your app and even comes with a nice look & feel. It’s pretty straightforward to start with it. But it has some drawbacks. The look & feel is simply not the one you expect on your device. It’s neither Android nor is it iPhone. Also the behavior is not exactly what you would expect. It’s different, it’s a jQuery mobile experience.
Also I found it is extremely sluggish on my older devices. Especially when it came to page switching. No doubt, it is very nice and you can do nice things with it. But it was not was I was looking for - it was too much.
Then I was looking into Sencha Touch. I cannot say I have much experience with it, but the development model felt very unusual for me. Sencha does also come with a Look & Feel, but again, it’s the Sencha Look & Feel, not the Android or iPhone one.
Finally I wrote Roadcrew.js. It does nothing else then page switching. I liked how it was done in jQuery mobile but improved the way to intercept the page switching (for my taste and compared with an older version of jQuery mobile, namely 1.0x. Not sure if this has been improved in recent versions). This could have been done with Angular.js too. I used Roadcrew.js, because I was unsure if Angular.js would give me the performance I need on older devices. I didn’t want to make another experiment.
I am still happy with Roadcrew and writing a jQuery/Zepto.js based app on Cordova. Except it still doesn’t look good. I have started on reworking the whole app, but at the moment it’s still the ugly interface. While functionality is OK, it’s really looking more like a web page and not like a mobile app. To overcome this I have looked at Chocolate UI. And I looked into Ratchet too. Both frameworks give you a look & feel. Chocolate looks more like Android, Ratchet looks like the iPhone. Both are fundamentally different how they work. It’s simply not possible to use them exchangeable, so you have to create two apps. Of course, that’s not possible. I have withdrawn both experiments with the two.
Both had a lot of issues too.
Now I started to download the Android styleguide and create my own CSS for the components I need. This is of course cumbersome. I have to do the same with iPhone styles later. All of that is simply there when you go native.
Something else is often missing. Just because you have a nice looking button does not mean the button behaves as expected. You face several problems. One can be solved with implementing the FastButton for your system.
Let me quote an Google engineer:
The problem with this approach is that mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap. For most buttons we are developing we know that there is no double click behavior that we want to handle, so waiting this long to start acting on the click is time wasted for users.”
- Ryan Fioravanti
More: https://developers.google.com/mobile/articles/fast_buttons Along with my mobile look, I also have to start to implement mobile behavior. Thanks to Google for the FastButton implementation. It took me just an hour to use it with jQuery and in my own code.
Developing with Apache Cordova gets you on the road very quickly.
You have something in your hands within minutes. It’s great to progress quickly. It’s not Cordovas fault that the rest of the ecosystem is lacking a few things. There is still no “fantastic” framework which looks on every device as it should look. There is nothing which lets you application “feel” native on every device. Sure, you can deploy to each and any device (almost), but after all: you are not deploying a native app. It’s different.
Sorry to say, jQuery mobile and Sencha and the others are not the answer yet. Apache Cordova is a great tool. As with all tools, you need to look at your requirements and carefully decide if it is for you. If you can accept the mentioned drawbacks and want to come out quickly, it’s great. If you need performance eating animations and want it to be native, go with a native implementation. Don’t believe the hype. Look with your own eyes.