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
€8.99 €19.99
Paperback
€24.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781783554751
Vendor :
Apache
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 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
€189.99 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 €5 each
Feature tick icon Exclusive print discounts
€264.99 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 €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 94.97
PhoneGap and AngularJS for Cross-platform Development
€27.99
Phonegap for Enterprise
€24.99
AngularJS Web application development Cookbook
€41.99
Total 94.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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.