Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Phonegap for Enterprise
Phonegap for Enterprise

Phonegap for Enterprise: Master the art of building secure enterprise mobile applications using PhoneGap

eBook
₹799 ₹1965.99
Paperback
₹2457.99
Subscription
Free Trial
Renews at ₹800p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Phonegap for Enterprise

Chapter 2. Building the Data Store and Business Logic

Enterprise apps, by their very nature, require a data store that is capable of persisting data and business logic that manipulates data. This can be comprised of any number of technologies, though there are usually several servers involved, including database, application, and authentication servers.

In this chapter, we'll cover the following topics:

  • Typical server architecture
  • Designing data models
  • Writing business logic and where that logic should be placed
  • Designing permissions and authorization models
  • An introduction to Tasker, our demonstration app

Of course, it's impossible to cover all of these topics extensively in the next few pages. As such, if you need to create a large system from scratch, including the business logic and data models, you might want to do quite a bit of research into the various tools and technologies that you might want to use. Above all, use the right tools for the job—just because we...

Introducing Tasker

I find having an example useful when learning about technology, and this book is no exception. The code package for this book contains an example enterprise application representing each of the following four tiers: the database, business logic, web service API, and presentation layer.

Tasker is intentionally designed to be a very simple app, far simpler than many enterprise apps. This isn't a bad thing; it enables us to worry about the critical issues related to enterprise app development without having a complex application that defies understanding. Instead, Tasker is largely what it sounds like: a simple task management app.

Of course, a to-do list doesn't sound very enterprise-y. As such, Tasker isn't about managing a single task list, but about managing and delegating many tasks to many users. The app is built with the idea that the entire organization will be using this app to track their work. As such, tasks are owned by their creator, and they...

Server architecture

Although Tasker is a simple app, we've built it to mirror a typical enterprise setup, as shown in the following diagram:

Server architecture

The mobile device (say, the user's phone) is considered the presentation tier of the app; this is where the data is displayed to the user and where they can manipulate it. Although this book is a PhoneGap book, we actually won't deal with this tier until Chapter 5, Communicating between Mobile and the Middle Tier, and later, since we need to establish the foundation of the app first.

The mobile device doesn't have to live on the enterprise's network. Depending on the sensitivity of the data, the mobile device might be expected to connect to the enterprise's network using a Virtual Private Network (VPN). This essentially means that the device exists within the enterprise's network. Since this adds an extra burden on the user (they need to connect to the VPN prior to using the app), this isn't always desirable. For...

Designing your data models

It is important that you identify the data models your app will need prior to writing any code. Consider your data models the foundation of your app as a whole. We don't have sufficient space in this chapter to cover all the various complexities a large data model design needs to address. Instead, we'll discuss some basic ideas and also explain our mindset while going through the design for Tasker.

Simply, a data model describes the kind of data your app will store as well as the relationships between the data elements. Having this in place makes it easy to understand the system and makes it easier to code the app.

Let's go through the data models for our app. First up, we have the PERSON model:

Designing your data models

The preceding diagram tells us quite a bit about the data we're storing:

  • The model stores information about people, including their name and administrator
  • The model indicates the data types for the individual data elements
  • The model also indicates the various...

Designing the business logic

When designing your business logic, it is important to think about how your app will need to access your data and what operations it will need to perform. We've defined many of these as part of the data models in the prior data model diagrams—these are the actions that our app can perform on the data. Generally this logic is pretty simple—nearly all of it boils down to something as follows:

  • Retrieve (SELECT) data from tables
  • Add (INSERT) data into tables
  • Update (UPDATE) data in tables
  • Remove (DELETE) data from tables
  • Return data back to the app

We won't take up valuable space in this chapter by including all the code for the business logic—it's pretty boring. Instead, look at the database directory in the code package for this book. Also, note that the backend database was designed to be simple and easy to understand; the design we use is not the most secure model. Data, views, and stored procedures are usually separated into separate...

Permissions model

When it comes to data security, there are usually several tiers. Of course, one wants to secure where the data lives and the transmission of that data; however, most enterprise apps need some level of data permissions as well, that is, certain users should only be able to see certain data or certain users should only be permitted to do certain manipulations.

Tasker's permissions model is inherently simple: every person is a user of the system, and every user can create tasks. Tasks can only be modified by their owner. Users can also manage other users, meaning that users can assign tasks to their subordinates. When a task is assigned to another individual, the assignee can update certain fields, namely progress and status. Both the owner and assignee can add comments to a task.

Of course, this doesn't cover the authentication and authorization or user administration mechanism, and that's by design. Many enterprises will have their own requirements when it...

Introducing Tasker


I find having an example useful when learning about technology, and this book is no exception. The code package for this book contains an example enterprise application representing each of the following four tiers: the database, business logic, web service API, and presentation layer.

Tasker is intentionally designed to be a very simple app, far simpler than many enterprise apps. This isn't a bad thing; it enables us to worry about the critical issues related to enterprise app development without having a complex application that defies understanding. Instead, Tasker is largely what it sounds like: a simple task management app.

Of course, a to-do list doesn't sound very enterprise-y. As such, Tasker isn't about managing a single task list, but about managing and delegating many tasks to many users. The app is built with the idea that the entire organization will be using this app to track their work. As such, tasks are owned by their creator, and they can also be assigned...

Left arrow icon Right arrow icon

Description

This book is intended for developers who wish to use PhoneGap to develop useful, rich, secure mobile applications for their enterprise environment. The book assumes you have working knowledge of PhoneGap, HTML5, CSS3, and JavaScript, and a reasonable understanding of networking and n-tier architectures.

What you will learn

  • Develop crossplatform mobile enterprise apps using PhoneGap
  • Understand the PhoneGap system and app architecture
  • Communicate between the mobile device and the backend using XHR and WebSockets for data transmission
  • Build a middle tier using Node.js to connect to the data store
  • Discover how PhoneGap allows you to whitelist trusted domains
  • Handle online/offline states by learning how to handle application and network status events

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 26, 2014
Length: 192 pages
Edition : 1st
Language : English
ISBN-13 : 9781783554768
Vendor :
Apache
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Dec 26, 2014
Length: 192 pages
Edition : 1st
Language : English
ISBN-13 : 9781783554768
Vendor :
Apache
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
₹800 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
₹4500 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₹400 each
Feature tick icon Exclusive print discounts
₹5000 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₹400 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 9,310.97
PhoneGap and AngularJS for Cross-platform Development
₹2755.99
Phonegap for Enterprise
₹2457.99
AngularJS Web application development Cookbook
₹4096.99
Total 9,310.97 Stars icon
Banner background image

Table of Contents

10 Chapters
1. PhoneGap and Enterprise Mobility Chevron down icon Chevron up icon
2. Building the Data Store and Business Logic Chevron down icon Chevron up icon
3. Securing PhoneGap Apps Chevron down icon Chevron up icon
4. Building the Middle-Tier Chevron down icon Chevron up icon
5. Communicating between Mobile and the Middle-Tier Chevron down icon Chevron up icon
6. Application Events and Storage Chevron down icon Chevron up icon
7. Push Notifications Chevron down icon Chevron up icon
8. Building the Presentation Tier Chevron down icon Chevron up icon
A. Useful Resources Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(6 Ratings)
5 star 50%
4 star 50%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Loiane Mar 31, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Phonegap for Enterprise is a great book! This is the book you should read if you want to take your phonegap knowledge to the next level. This is not a book for phonegap beginners, so if you are looking for a book to learn the basics about phonegap, I recommend the Phonegap Beginner's Guide (from Packt as well).If you already know the basics, this is the book for you. It covers apps that use a backend architecture (java, php, c# as backend deployed on the cloud), passing through REST services, security, best practices, storage (native sqlite) and also advanced topics such as push notifications (plugin). The appendix is full of external resources where you can learn even more about the technologies mentioned in the book.So if you already know the phonegap basics, I highly recommend reading this book.
Amazon Verified review Amazon
Charles A Carvey Mar 27, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Enterprises have a need to shorten the time to market for specific app needs. Kerri Shotts has outlined how PhoneGap can meet that need. The book deals with all three parts of the app ecosystem; the back end, the middle-ware, and the front end. Incorporating common patterns and security considerations makes this an excellent introduction for those charged with building PhoneGap apps in an enterprise environment. I highly recommend it to those developing hybrid apps in the enterprise.
Amazon Verified review Amazon
Captain Obvious Mar 31, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Throughout, PhoneGap for Enterprise addresses enterprise concerns in ways that are applicable to any hybrid development effort. While PhoneGap for Enterprise is focused on enterprise issues for PhoneGap development there is some nice coverage of PhoneGap\Cordova history in the first chapter. Not the best first book for those completely new to cross-platform development though - you need to be up and running to apply this material. Great addition to any mobile developers book shelf, highly recommend.
Amazon Verified review Amazon
Amazon Customer Apr 02, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
A good book, including an overview of technology choices and general and specific notes about how to make your application more secure... but also more likeable. It's definitely not a cookbook nor a how-to, as much as considerations and options which may apply to your application.The topics are somewhat scattered at times, ranging from very general considerations such as planning out your REST services first, to pieces often neglected such as security (what if my app is duplicated, what if someone spams my REST API), to an overview of some neat HTML5 tags. Despite covering this wide set of topics, each one is not overly detailed with pages-long code bits, but is quite rich in links to other resources -- having been given a point for consideration, resources are given to pick your own way.So again, not a cookbook and not really a tutorial/primer, as much as "don't just make an app, here are ideas to do it well". It's full of outside-the-box ideas, and full of options and links to other resources so you can take those ideas and run with them in your own direction. You'll probably find Phonegap for Enterprise a worthwhile read at any skill level with Cordova.
Amazon Verified review Amazon
Racykiwi Mar 31, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Kerri has written a highly readable tour through the main elements to consider when writing an enterprise level app. It covers much, but doesn't get too bogged down in detail. As such, it is possible (if you skim the code sections) to read the entire book in an evening.Much is made of security, and the great lengths that you have to go to to secure an enterprise grade application. This is the main focus of the first 5 chapters, which are quite generic in nature - they could equally apply to any web based application communicating with a server through an API, not specifically a PhoneGap one. Chapter 6 is the first time when you are required to set up a PhoneGap project to follow along the examples. This chapter is mainly about connectivity issues, network information and your app running in the background. Chapter 7 covers push notifications, using boxcar as the plugin provider, and chapter 8 puts it all together, although in a high-level way, briefly covering a raft of technologies such as Angular, Ember, Knockout, Backbone, React among others.One perhaps surprising omission is that there is no mention of testing or testing frameworks at all. For a book which touches lightly on so many topics I would have thought that this would have deserved a mention.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.