BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage Interviews Brian Leroux on Cross Platform Mobile Application Development with PhoneGap

Brian Leroux on Cross Platform Mobile Application Development with PhoneGap

Bookmarks
   

1. My name is Srini Penchikala. […] In this interview, we will be talking with Brian Leroux from Adobe team, about building Cross Platform Mobile Applications. Can you introduce yourself to our audience and tell us a little bit about what you do and what you are currently working on?

Sure, I work at Adobe Systems, my name is Brian and at Adobe my core focus is on the Apache Cordova Project which is a sort of Open Source rebirth of Phone Gap. But I do a lot of mobile web stuff too.

Srini: Also you are hosting a tutorial at this conference on developing Cross Platform Mobile Applications?

Yes.

   

2. For our audience to set the base line, how do you define the term “Cross Platform Application”?

It’s tricky for sure, it’s a loaded statement. A lot of people will say that the Cross Platform is a bit of a myth usually on the Internet which is kind of ironic because they will say it from any device in the world at any time. It’s our belief in the Phone Gap team that the web solves Cross Platform, so web technologies is kind of where we go with this, there has been sort of false profits in the past with Java and its many runtimes but the web really has permeated most devices and platforms.

   

3. That kind of leads to the next question: what is the current state of the Cross Platform Application Development in terms of maturity, technologies and vendor support?

We are still in the early stages and the web has gone through a real massive rebirth in the browser, there is a new browser war, but it’s almost a war of cooperation now, and the technologies are moving so fast, that we are seeing all kinds of new frameworks, new developments, new understandings, new performance characteristics and profiles. So it’s really young and it’s really early, I don’t think we fully understand our own monster yet today.

   

4. So maybe that could lead to the next question: what are some challenges - organizational as well as technology-wise in building Cross Platforms Apps?

Organizationally, I think the development process is still being figured out, one area that I’ve been obsessing on lately, is that there is always a build step, whether we want to admit it or not in web development we are now doing things like concatenating files, obfuscating them, precompiling templates, running tests, running a linter. All this ceremony happens when we do build and development times are a lot different than runtimes, a lot different than deployment time, and there is a lot of duplication of effort between different groups in organizations. This isn’t an “either-or” either. So a lot of people are trying to pursue Cross Platform organizationally as a strategy to cost save, also to reuse skills, so there is a lot of web developers and there it’s a good idea to leverage that, but at the same time it’s definitely worth exploring the native platforms with what they have to offer, they have large markets, sometimes getting more direct user experience and more direct access to the hardware. So it’s not really an “either-or” but I think we all are still trying to figure out how these things fit together and how to build the applications in an efficient way.

   

5. Technologies wise, what’s available in the market?

I am partial of PhoneGap, because I work on it but I don’t want that bias to influence of people think about things, it’s just another technique and there are lot of tools. I personally feel if I was an organization ninety nine percent of the cases I’ve been looking building a responsive web design as my first go to, and then view something like Phone Gap as a progressive enhancement to access app stores and revenue models around that, and then maybe explore in parallel the idea of doing more goal directed, native development on devices. Interestingly though, at PhoneGap we are trying to really blur this and so there it’s a term now called Hybrid Development, and we do both your application development in the browser and then you have a build step that brings you into the phones. In Phone Gap we’ve recently started exposing our plug-in API which allows you to essentially write the native code bits and then wire it back to the browser instance in the PhoneGap application. So doing this there really isn’t a debate to be had, you can access anything native from the browser if you want, including GUI components, or not. So it’s not getting easier, it’s actually getting harder because there are more ways to do things.

   

6. You mentioned about development time and concepts like Responsive Design. What are some considerations or best practices that the designers and developers should take into consideration when deciding to go with Cross Platform Application Development?

Responsive Web Designs have come a long way in last couple of years, it really started around the idea of media queries, which is still quite nascent and still a little bit buggy, but with the polyfill, we can go back to the older browsers and we can build applications that can scale to many different screens - the kind of fun term that people are using as a future friendly. That’s it, there is still inefficiencies to be had, so if we’re building our CSS for example, for all these different dimensions and screens that we using media queries to selectively render for the different screens that were still delivering this big payload and so there is a latency cost upfront. And I don’t necessarily have all the answers here, but there are people that are experimented with the techniques, Scott Jehl from Filament Group has recently started experimenting with the idea of a conditional loader that uses matchMedia, which is a JavaScript API for media queries.

This is probably something that browsers should be doing, but there is a lot of things that browser should be doing and it’s not doing yet, so that’s one challenge and we see the exact same problem in JavaScript. So I think Steve Souders said there is something like thirty percent of JavaScript in the top one hundred sites is never executed. That is a big problem so we’re delivering all this stuff to bring parity across devices but clients don’t need it, and when we were in a mobile context this is particularly big penalty to performance which can be a penalty to revenue in the end, so there is work to be done.

   

7. Do you see HTML5 next generation or version or HTML6 even, supporting the native device features out of the box?

Srini’s Full Question: In the Mobile Runtime environment every byte counts. Let’s go back to the device features that Phone Gap brings to the table like push notifications or camera or accelerometer. I know HTML5 supports geolocation, so do you see HTML5, next generation or version or HTML6 even, can it support those device features out of the box?

We’ve always believe really heavily in device API’s and that was what we went with things with the PhoneGap Project. When we started building these sort of fancy browsers, one way to describe PhoneGap, our whole vision was to access the sensors and the data on the devices, you can’t get into the web, the web being sandbox, we can’t access things like the camera, and actually in the web we’ve been able to do this for a while with technologies like Flash and now in the Media capture API it’s available on Android and Opera I believe. Probably Firefox 9 release at this time, so we are seeing these API’s start to trickle into the browser and I don’t know if we want to increment the HTML version number or if we want to just start viewing this as the web Platform or the web Runtime. These are the things that I’m personally really excited about – file system access, Index DB, just all these sensors and data on a phone, your contacts, the media on your device, the ability to record audio and video, we saw audio API’s possibly land maybe in the next version of iOS 6, so really exciting time.

   

8. Do Cross Platform Applications potentially bring the worst of both worlds, where the mobile apps are not as rich as the native apps and not run on all mobile devices?

Srini’s Full Question: Definitely you are right, the mobile is the way to go, so definitely the users in this space and industry will be asking for a lot of these application features. So Brian, let me go back to this Cross Platform Application features again. They are supposed to bring the best of two worlds, one being the Mobile Web Applications and the other being the native mobile apps so you can write one program language or one API and be able to deploy these applications to different devices, without having to write code in Objective-C, or Java, or C#. So is it really the case or do Cross Platform Applications potentially bring the worst of both worlds, where the mobile apps are not as rich as the native apps and not run on all mobile devices?

It is one of those “it depends” answers which are no fun for software developers but we all have to give that answer every time. It depends, one example for you, we once had a client come to us a while ago and we’re like “We are going to build this app and it’s going to be huge, it’s going to be the biggest app ever, and it’s going to have more functionality than Facebook” and they thought that was a great idea and I thought that was the worst idea ever. So instead of one thing that we challenge people when they say “Is it’s capable to do this stuff”, I view it in the mobile context especially you should probably just aim for do one thing and do it super well, as opposed to trying to do a lots of things because you are going to have terrible performance, it’s going to be a latent experience over the wire and your user experience is going to be confused and junky.

If you need to do a lots of things it’s nothing wrong with doing a lot of apps and it’s sort of my answer in general to: “How do you solve doing a lot of stuff, do you need objective C or Java?” is “Maybe, depends of what you are trying to do”. We are adding more API’s all the time to PhoneGap and there is a huge very rich plug-in ecosystem that is growing out there. I wouldn’t discourage someone from writing objective C or Java, I think those are great languages to learn and you can’t really begin to appreciate the web platform until you have to go deal with the native platforms too. None of these are silver bullets and none negate each other, there is always a time and place.

   

9. Use the right solution to solve the right problem. I know that are a lot of these Mobile Enterprise Application Platforms, MEAPs, like IBM WorkLight, or Oracle ADF Mobile. They promise that they provide everything out of the box. So what do you think about these products in terms of developing the Cross Platform Apps?

IBM is really big contributor back to PhoneGap and we know workwise built quite few apps and I haven’t play with Oracle solution but I know they are using Phone Gap as well so I can really comment directly of what I think of them but I know that the Enterprise right now deeply concerned about getting back into the space, we are seeing a moving away from devices distributed by the Enterprise to their work force to people just using their own devices, so they need to start developing applications, so these guys can get it, most people of these days are rocking a Smartphone, iOS, Blackberry, Windows Phone, Android even Bada actually, so accessing this array of possible devices, the other big problem the Enterprise had is they pick just one, what is happen when another one emerges and so we saw this between iOS and Android, there is been a sort of tension between these two platforms and Blackberry on the way down, they can’t just choose one, so they know they need to use a delivery platform like the web to get to their work force.

   

10. And there is also vendor lock-in with MEAPs. Let’s go back to the tools, can you talk about some tools for Developing Cross Platform Applications, what developers can use to make it easy for developing Cross Platform Applications?

So this is tricky because I don’t like to be prescriptive, and so being we are kind of a Web Runtime in a sense, whatever tools that you use as a software developer are probably the most appropriate ones for you. I can tell you some of the tools that I use but I don’t want people to feel it that I’m telling them that this is the right way to do it or the wrong way, just one way, so I tend to prefer to write raw JavaScript because I know it and I find the less code I’m sending over the wire, the better and I’m usually targeting devices, so if I’m building a PhoneGap application I know what browser it’s going to render, and if I’m building for the open web I would probably choose a tool like jQuery because I know that it’s going to be able to fall back to older devices.

jQuery comes with some penalties, so I would use something like Clojure Compiler and Advance Book make sure that I was only using the parts of jQuery that I’m actually going to be sending over the wire. jQuery as a whole still quite a big library. From the front-end side of things are the more like CSS I quite like Twitter Bootstrap lately but looking at Twitter Bootstrap it’s four thousand lines of CSS which is pretty inappropriate to send over the wire, so again I actually wrote a tool called CSS Slap Chop, that removes selectors you are not using , get it down to only the bare minimum that you need to send over the wire.

I highly recommend people look at an MVC Framework. JavaScript can get quite ugly and if you want you code to be maintainable I tend to prefer Backbone personally but Spine is quite good. I’m sure EmberJS will be ok, sometime soon, those guys are working really hard, they are solving a kind of a higher level or a higher order set of problems, and it doesn’t really matter in the end, just a good code separation is a good idea. Your concatenant build step should be codified with something like a Lint tool and all running tests. PhantomJS is a nice way to run test headless and web kits, it just gives you an idea if your logic it’s going to execute it all. It is nothing worse in doing a build waiting for your phone to boot only to find a white page waiting for you. From a debugging stand point – and again I don’t like to be prescriptive - but I attend to prefer using Chrome Remote Debugging and I hear others platforms are getting it, I used to use a tool called Weinre, which is available at debug.phonegap.com.

   

11. The PhoneGap also have the build which is the cloud computing support, build on the cloud.

build.phonegap.com is fantastic for just trying up PhoneGap without installing the SDKs. It’s a cloud based service for building PhoneGap applications but it’s also really good for building a Continuous Integration system with your code, so we’ve got hooks and an API so if you want when you do a check in, you can have us to do run a build, it creates a QR Code and so then your clients and stakeholders, they just install the app and check it out for themselves. It is really useful, well Continuous Integration, I’m sure the QCon audience understands so useful could be, so that is another angle. There are a lot of tools and I don’t like people to think that they can’t use things like Dojo, YUI or Sencha or jQuery Mobile, they are all totally appropriate for some people.

Srini: They have to look at their own requirements and pick the right tool.

And their skills too, where their existing investments are, they’ve already invested in something like extJS, Sencha might make sense for them.

   

12. Regarding Apache Cordova project, right now it’s in incubation. What is the timeline for getting this out of incubation and become a main Apache project?

We are hoping that we will be shipping 1.9 next week so I don’t remember the date, it’s July 18th or no, June 18th, so we are going to ship 2.0 on July 20. I’m fairly confident we should be through the incubation process by then, the remaining issues are like really kind of silly things like license header files and stuff, so we are almost out of incubation, which is nice.

   

13. What is the roadmap of Cross Platform Applications in general for PhoneGap in particular. What are the other features that are coming?

There is some cool stuff happening with the web right now, so we desperately need a component model and so we do a lot of this built step business in order to create a kind of like componentized single executable situation, not really single executable usually compiler HTML with a compiler CSS and a compiler JavaScript, we send this three things over the wire. The problem is if I want to pull library say for a specific widget, is not going to be just one of those things, if I want to pull a rich drop down or something like that, it’s going to include CSS, it’s going to include images, it’s going to include JavaScript.

And so Shadow DOM might give us some ideas of how to build components and I think it’s in Chrome Canary right now as an experimental feature, it hasn’t been fully ratified, but the idea of an componentized web where we can include a little bit of pieces, it’s going to be crucially important how we build applications in the future, traditional platforms had this for a really long time. So I’m looking for that one, but that one is ways out, a little bit closer and something that we are seeing is this emergence of web operating systems, so WebOS which is kind of a hopefully going to be an ok story, we don’t know, it hasn’t been a fully open source any of those that came awesome, which I recommend JavaScript developers check out.

Then there is the newer ones, is Boot to Gecko from Mozilla which I’m extremely bullish on and Tizen from Intel and Samsung, so these web based operating systems are like a browser on top of a Kernel, and with this emergence all of the sudden a whole new set of problems came to light and this new group just started the W3C, called the sysapps group. And they are starting to look at addressing what a web operating system look like, what a web runtime look like and a sort of early talk right now and it isn’t been completely charged but the ideas of , they start with the idea of what runtime security model will look like and how all installable web apps could work and so I’m really excited about that. I don’t know where things are going to go necessarily but I know this is probably the closest thing we have a glimpse of the future.

   

14. You mentioned about the Security, so let’s discuss about that. Security is a critical requirement no matter what, especially with the Mobile Applications. Can you talk about what are the applications security considerations when using PhoneGap Cross platform Mobile Apps?

So PhoneGap is exactly like a Mobile Web App and unfortunately on the devices these days, there is no encrypted key store, I think on some models of enterprise Blackberries you can get an encrypted key store and possibly on older Nokias but not in the current generation of Nokias. Because there is no encrypted keys store, there is no way for us to store keys on the phone which means you are going have to have an off step if you want it in store, if you want to deal with any sensitive data, if you want to store locally cool encrypted for sure but understand you are going to encrypt performance penalty based on the CPU, you got and you can’t keep the key on the same phone, it’s really not safe to do that. Local store interesting in the Android is pretty safe, but again I would not necessarily trust this. So this is what you’ve left with, it’s all the same rules as the web, basically you are on a proxy request, you don’t want to include third party scripts. You are sandboxing in an iFrame.

   

15. Thanks for your time, so last question, what are favorite IT and non IT looks?

It’s a good question. Favorite IT books, I collect a lot of really old software books and I quote business from Eric Raymond’s I think it’s the Unix Philosophy, the Art of Unix Programming always a good book, just read that if you are a software engineer. Obviously Fred Brook’s is good one too. Non programming I read a lot of High Fantasy, it’s kind of like my sitcoms and I’ve been reading the Malazan series which is a huge epic and I’m hoping to finish that soon, my favorite book is the one I’m reading right now.

Srini: What is the title of the book?

The Malazan series, I think there are like twelve of them, I can’t remember, tides of darkness or something like that.

Srini: Thanks Brian, thanks for the time!

Cool, thanks man!

Nov 13, 2012

BT