Building Cross-Platform Mobile Apps: An Interview with Troy Miles

[interview]
Summary:

In this interview, senior software engineer Troy Miles talks about cross-platform mobile application development. He discusses the benefits of PhoneGap, as well as tips for how to keep code both clean and full-bodied.

Josiah Renaudin: Today I'm joined by senior software engineer Troy Miles, who will be speaking on building cross-platform mobile apps at our Mobile Dev + Test Conference. Troy, thank you very much for joining us.

Troy Miles: Thank you for having me.

Josiah Renaudin: No problem at all. First, could you tell us just a bit about your experience in the industry?

Troy Miles: Oh my God, I've been in this business so long. It's hard to even remember when I got started. I actually sold my first app to my school when I was still in high school. That was thirty-five years ago, over thirty-five years ago. Since then I've done video games, I've done systems programming for both Windows and embedded devices, I've done lots and lots of web programming, both on the server and the client side, mobile, iPhone, Android, Windows Phone. I've been all over the book, and just deeply in this. I mean, it's a very rare that you see me go more than a few hours without a computer in front of me, adding some code.

Josiah Renaudin: I do have to ask you, because I have a deep interest in video games: Did you mostly do mobile games, or did you have any experience in consoles and PCs before?

Troy Miles: Oh, I'm sorry. At the time I was doing video games, there were no mobile games. This is mainly for the PC. We were also at that time doing things for the Commodore 64, the Apple II, for the Commodore Amiga. This is how long ago this was.

Josiah Renaudin: I have a whole other list of questions for that. I will ask you those later. Let's actually focus just your tutorial. You'll be digging into a cross-platform framework called PhoneGap during your tutorial. Can you explain a bit about what exactly it is and how it works?

Troy Miles: Yeah, PhoneGap is a way to take essentially web technologies and put them into a mobile app. What's amazing about it is that it's cross-platform out of the box—it allows you to use web development technologies, and it's a way to just maximize, especially for businesses or whatever, to maximize their developers that they have, because mobile developers that are platform-native are far more expensive and harder to find than people with web skills are. It's free. It's open source. It's amazing technology. It's a great game-changer as far as mobile development is concerned.

Josiah Renaudin: You did talk there about some of its different capabilities, but can you talk about what makes PhoneGap unique compared to other programs?

Troy Miles: Sure. One of the challenges that any business that's doing software, especially mobile, is going to have these days is that, with all respects to Windows Phone, it's essentially a two-horse race; it's Apple and it's Google, Android and iOS. Those two platforms could not be more different. Any time you're developing an app for one of them, and you want it to be on both platforms so that you can get over 90 percent of the market, you have to essentially scrap everything that you've done in the first one and redo everything for the second one. Even once you finish that and you have both versions up and running, now you have to support two different platforms and all other different platform changes as time goes on. Actually, it's a much bigger undertaking in mobile development than most people realize.

The idea of PhoneGap is that it's going to use almost all of the platforms we have, essentially what's called the WebView, which is a mini browser that gets embedded. It can be embedded into an application. PhoneGap uses that as its platform since both platforms have it, and other platforms have it as well. It's not just the two most powerful ones, iOS and Android, it's also Windows Phone has a WebView, Firefox, Blackberry. You can theoretically come out with one version, with very minor changes that can support a multitude of platforms, including the two big ones, all from, essentially, from web development skills.

Josiah Renaudin: Now, you're asking participants of your tutorial to build a complete app by the end of the session, which is a really fun, unique idea. How confident are you that everyone who joins will actually be able to complete this task and create a functioning app?

Troy Miles: I'm actually pretty confident. What we're going to do is what I'd like to call, "We're going to Julia Child it." I used to be a big fan of her cooking show. I love the way that she had dishes at different levels of preparedness already sitting, one is in the oven, one is on the pot, one is on the counter. She didn't make the whole dish from scratch; she showed you each step along the way.

This is essentially what we're going to be doing. We're going to be taking advantage of a source-control package called Git. Git has these things called bundles. The bundles allow—Git allows you to tag different steps in the repo. We are going to be pulling the stuff off of that Git bundle so that people get the flavor of it. We're going to do some typing, because it's really important to do some actual hands-on typing and stuff, but just in case somebody gets lost or they didn't catch the last thing I said, it's okay, because you can just get that next step. Go to it and load it in. When you leave, you have that whole bundle that you can take with you. You can go through the steps one-by-one again on your own to make sure that you remember everything that you learned in the class.

Josiah Renaudin: I don't want to give away the entirety of your class—I think it's important that when people sign up, they're surprised when they get there. But can you give just some preemptive tips for how to keep code both clean and full-bodied? Some tips that you'll maybe be expanding on during your tutorial?

Troy Miles: Yeah. JavaScript is—especially compared to more modern languages—is exceptionally easy to write dirty; dirty JavaScript code that works, but it's hard to maintain, hard to keep up. I'm a big believer in basically breaking your app down into very small pieces, that each of those pieces should be able to stand on its own that has a very narrow window of how it communicates with the rest of the program.

We're going to be using some design patterns in JavaScript that allow us to write code in that way. I'm going to explain to everybody that's attending, why these ways are important as you write bigger and bigger applications in order to keep things under control. We're going to rely on design patterns to help us out there.

Josiah Renaudin: I think it's very important to note that much of this tutorial deals with the basics of the application development. It's not really deep-level. You can get in as long as you have a basic understanding of what you're doing. Do you also have some different things you could share that are more advanced techniques that can take someone's understanding to the next level?

Troy Miles: Absolutely. One of the things that PhoneGap got a bad rap for when it first came out was its performance. The actual performance issues were not so much with PhoneGap as it was with the way people wrote JavaScript. I'm going to be introducing some techniques that allow your JavaScript to be faster, because even—the majority of apps, except when you get into really intensive games or simulations, are just waiting for people to type something out to press a button.

What we're going to do is, I'm going to show some techniques that allow your JavaScript, even though it's running in a WebView and it's embedded in an app, to give you really good performance so that we don't make the mistakes that people used to make with PhoneGap. That will really help to smooth these out.

Josiah Renaudin: All right, fantastic. It sounds really interesting, Troy. I also wanted to know, last question: At the end of the day, what do you really want your audience to remember after the tutorial is completed?

Troy Miles: Ideally, what I'd like for the people to walk away with is, here is a starter app, it's going to be your basic kind of an app that's—the pattern of this app is used so many times that people will easily be able to look and see, hey, how this app can help them, and something that they are thinking of making, that don't know how to get it up and running, how to go ahead and enhance it from way far beyond what we're going to have time to do in the class, and that they know the things and techniques of, "Here is how you get started with PhoneGap development."

Josiah Renaudin: All right, great. Well, thank you very much, Troy. I really appreciate your time, and I'm very much looking forward to hearing more about building cross-platform mobile apps in San Diego.

Troy Miles: All right. Thank you. I can't wait for the conference.

Troy MilesTroy Miles, aka the Rock-n-coder, has been coding for more than thirty years, writing games for C64, Apple II, and IBM PCs in assembly language. Troy moved on to Windows application and system programming, and caught Internet fever just before the dot net bubble burst. Realizing that mobile devices were the perfect window into back-end data, he added mobile programming to his repertoire. Troy builds web services with ASP.NET MVC or Node.js on the back-end and web or mobile up front. He loves coding, competing in hackathons, attending developer events, and randomly posting interesting code nuggets on his blog. Reach Troy at [email protected].

About the author

Upcoming Events

Oct 13
Apr 27