DevTrends

Review

Book Review - PhoneGap Beginner's Guide

PhoneGap is an interesting framework that allows you to leverage your existing skills in HTML, CSS and JavaScript to create native mobile applications in all of today's popular platforms. This is a review of PhoneGap Beginner's Guide written by Andrew Lunny.

Disclaimer: I was kindly provided with a review copy of PhoneGap Beginner's Guide by Packt Publishing.

Despite that fact that DevTrends is a .NET consultancy and does not even offer mobile development as a service, we do like to look at a wide range of non .NET technologies and platforms between projects. In the past, we have written apps for Android and Windows Phone but iOS has never been an option, mostly because of hardware constraints - it is hard to justify buying a Mac just to play around with writing iPhone apps for fun. PhoneGap is an interesting alternative to native mobile development and the PhoneGap Beginner's Guide is a welcome aid for getting up to speed with PhoneGap.

What is PhoneGap?

Essentially, PhoneGap provides a bridge between JavaScript and native mobile platform functionality. You do all your development in HTML, CSS and JavaScript. When you need access to native functionality such as the contacts list or accelerometer, you use the PhoneGap JS library. PhoneGap then performs some magic and you have yourself a native app. More or less...

One thing that becomes clear once you read the book is that PhoneGap is not a 'write once and voila, native apps for all platforms' holy grail of mobile app development. You will almost certainly need to tweak your code for individual platforms and most importantly, you still require all the development IDE's, SDKs and emulators that you would for native, non-PhoneGap development. So for an iOS app, you need xCode and a Mac. If you intend to write an app for multiple platforms, PhoneGap does make this process significantly faster and easier though.

The PhoneGap Beginner's Guide

The PhoneGap Beginner's Guide

Figure 1: The PhoneGap Beginner's Guide by Andrew Lunny

The PhoneGap Beginner's Guide is a 328-page introduction to PhoneGap and mobile development that will "escalate you from being a novice at mobile development to writing complex applications that target multiple platforms". The book covers everything from setting up your environment through to HTML5 features and choice of JavaScript framework, plus of course, several chapters talking you through the PhoneGap API.

Whilst PhoneGap can be used to develop for most platforms, The PhoneGap Beginner's Guide concentrates on just three: iOS, Android and Blackberry. I was slightly surprised that Windows Phone did not get a mention. Having said that, most of what is discussed can be applied to all platforms.

The majority of the book is strongly focused on code examples followed by a few paragraphs walking the reader through the code. I generally like this approach but did find myself skipping some of the more rambling sections. As other reviewers have already noted, the book could have done with more editing to improve the readability of several sections. The tone of the book is very informal with the occasional geeky joke which may or may not appeal.

The first chapter explains what tools you are going to need for each platform, where to get them from and how to set them up. There is definitely lots of useful information here that will save you time searching blogs and forums for answers, but I found the chapter rather hurried. The rest of the first half of the book has very little to do with the PhoneGap API per se. Instead, it is more of a general tour of CSS3, HTML5 and JavaScript libraries that are essential to the creation of a PhoneGap application. This is not to say that there isn't useful, mobile-specific information here, but it is buried within more general text.

Chapters 7 to 9 introduce us to the PhoneGap API. We learn how to access device sensors, filesystem, camera and contacts. After five chapters of web dev talk, this is most welcome and surprisingly simple. This simplicity may be why so much non PhoneGap specific content is included in the book - it would be a very short book otherwise!

Chapter 10 encourages us to muddy our feet and write some native code in order to develop a PhoneGap plugin. There is lots of useful information here for those who need this functionality. Chapter 11 returns to HTML5 with caching and local storage options. Much of the chapter is devoted to Web SQL. Unfortunately, as we are told a couple of times in the book, Web SQL has been deprecated which makes the code rather pointless. Chapter 11 also (rather unnecessarily) introduces us to using Ruby and Sinatra to built a simple web service. I would argue that server side development has no place in this book and consuming a public web service in the example would have been a better idea.

Finally, we have two appendices. One of which discusses the laborious process of iOS deployment (very useful) and the other provides answers for the various pop quizzes scattered throughout the book.

Conclusion

I have to admit that I was initially disappointed by the large percentage of pages devoted to fairly standard front-end web development practices, interspersed by the occasional handy insight. The fact is though, there is not that much to write about the PhoneGap API itself. It is very easy to use and there is great documentation on the website, hence the reason that only three out of ten chapters deal with the API itself (and a further chapter deals with writing PhoneGap plugins). Whilst I did not find the HTML5/CSS3 focused chapters very useful, if you do not have much experience with web development, you may get more out of those initials chapters than I did.

Overall, there is plenty of useful information in this book that will certainly help anyone wanting to get started with PhoneGap. I would find this book much more useful if the non-essentials were removed and it was condensed into say 100 pages. As it is though, it is still a good introduction to an interesting framework.

Useful or Interesting?

If you liked the article, we would really appreciate it if you would share it with your Twitter followers.

Share on Twitter »

Comments

Comments are now closed for this article.