Lecture5 - Electrical and Computer Engineering Department

Download Report

Transcript Lecture5 - Electrical and Computer Engineering Department

ICOM 5016 – Introduction to
Database Systems
Lecture 5 – Mobile Apps Development
Dr. Manuel Rodriguez Martinez
Department of Electrical and Computer Engineering
University of Puerto Rico, Mayagüez
Slides are adapted from:
Database System Concepts, 6th Ed.
©Silberschatz, Korth and Sudarshan
See www.db-book.com for conditions on re-use
Objectives
 Describe the tradeoff associated with mobile apps
 Discuss the typical architecture used to organize these
 Show examples using

jQuery Mobile

Node.js

Titanium
Database System Concepts - 6th Edition
7.2
©Silberschatz, Korth and Sudarshan
References (if unfamiliar)
 HTML & HTML 5

http://www.w3schools.com/html/default.asp
 CSS & CSS 3
 http://www.w3schools.com/css/default.asp
 Javascript

http://www.w3schools.com/js/default.asp
 jQuery
 http://www.w3schools.com/jquery/default.asp
 JSON
 http://www.w3schools.com/json/
 AJAX

http://www.w3schools.com/ajax/default.asp
 REST

http://rest.elkstein.org
Database System Concepts - 6th Edition
7.3
©Silberschatz, Korth and Sudarshan
Web Apps
 Web sites and apps worked nice on desktop and laptop
 But they look terrible on mobile phones
Database System Concepts - 6th Edition
7.4
©Silberschatz, Korth and Sudarshan
The Mobile Wave
 Mobile market – dominated by smartphones and tablets

Smartphones sales overtook PC sales in 2010

IDC report: 100M smartphones vs. 92.1M PCs
 Smartphones and tablet : principal devices to access the Internet

No more bad or diminished experience sites
 Many players as well
5
Database System Concepts -
6th
Edition
7.5
©Silberschatz, Korth and Sudarshan
Open911: First responder M+C Solution
 To handle a crisis, first responders need

spatiotemporal awareness

Real-time data exchange

Rich-data formats
6
Database System Concepts -
6th
Edition
7.6
©Silberschatz, Korth and Sudarshan
Open911: Web App
•
M. RodriguezDatabase
System Concepts - 6th Edition
Martinez
2011 IEEE Cloud Talk
7.7
Command center view
• Collect incident
reports
• Push reports to
first responders
• With
instructions
on what to do
7
©Silberschatz, Korth and Sudarshan
Open911: iPhone App
 First responder get
notified
of incident
App
looks good:
using
UI and APIs
 Email
specific for mobile
 MMS or SMS

Push notification
 Detailed information

Address

Map

Photos, etc
8
Database System Concepts -
6th
Edition
7.8
©Silberschatz, Korth and Sudarshan
Convergence of Factors
 Mobile Wave
 Cloud Computing
Database System Concepts - 6th Edition
7.9
©Silberschatz, Korth and Sudarshan
Cloud Computing
 Cloud computing provides

Massive amount of computing power

Massive storage capacity

All priced as a commodity
Virtual Machines
Applications & Services
Storage
Cloud
M. RodriguezDatabase
System Concepts - 6th Edition
Martinez
10
7.10
©Silberschatz, Korth and Sudarshan
The Cloud Wave
 Market size: $148.8 billion by 2014 (Gartner)

Exponential growth
 US Federal Government: Cloud First Policy
 Many players around: open source and proprietary
11
Database System Concepts -
6th
Edition
7.11
©Silberschatz, Korth and Sudarshan
Cloud Service Models
 Infrastructure as a Service (IaaS)

Access to servers, storage, networking solutions
 Platform as a Service (PaaS)

Access to application development stacks that
feature databases, web servers, applications
servers, etc.
 Software as a Service (SaaS)

Access to fully operational (“turnkey”) applications
(e.g., Gmail, Office 365, Facebook)
12
Database System Concepts -
6th
Edition
7.12
©Silberschatz, Korth and Sudarshan
IaaS cloud service model
 Low-level computational resources

Deploy production systems (email, web, etc.)

Build other valued-added solutions
server machines
HPC machines
Virtual private network (VPN)
13
Database System Concepts -
6th
Edition
7.13
©Silberschatz, Korth and Sudarshan
IaaS Products
EC2
Cloud Computing
Database
System Concepts - 6th Edition
Illustrated
S3
Copyright © 2012, M. Rodriguez7.14
Martinez
14
©Silberschatz, Korth and Sudarshan
PaaS cloud service model
 Ready to use software development systems

Integrates web, email, databases, file systems, programming tools, etc.

Configured to work together with “no hassle”
distributed
file system
u ser X
identity
management
15
Database System Concepts -
6th
Edition
7.15
©Silberschatz, Korth and Sudarshan
PaaS Products
Elastic Beanstalk
16
Database System Concepts -
6th
Edition
7.16
©Silberschatz, Korth and Sudarshan
SaaS cloud service model
 Ready to use, fully functional application

Accessed via web interface

Nothing to install, simply “login and play”
17
Database System Concepts -
6th
Edition
7.17
©Silberschatz, Korth and Sudarshan
SaaS Products
18
Database System Concepts -
6th
Edition
7.18
©Silberschatz, Korth and Sudarshan
Mobile Plus Cloud Paradigm
Cloud services
consumed by firstVirtual Machines
class mobile
apps
Applications
Storage
RESTful API/JSON data
M. RodriguezDatabase
System Concepts - 6th Edition
Martinez
2011 IEEE Cloud Talk
7.19
19
©Silberschatz, Korth and Sudarshan
jQuery Mobile
 Framework to build mobile apps
 Uses

HTML 5 – UI

CSS – UI

Javascript – content manipulation and communications

jQuery – manipulation of UI

Ajax - asynchronous JavaScript and XML for communications

JSON – Java Script Object notation for data representation

REST – Representational State Transfer : Restful Web Services
for data persistence
Database System Concepts - 6th Edition
7.20
©Silberschatz, Korth and Sudarshan
Sample App
Database System Concepts - 6th Edition
7.21
©Silberschatz, Korth and Sudarshan
JSON
 Java Script Object notation for data representation
 The problem: UNIX, Windows, Linux, Mac: they all represent data
types differently. How to exchange data?
 JSON: Represent object independent of platform:

Person - { “id” : “123”, “name” : “Jose”, “lastname” : “Diaz”}

Attribute names become keys

Attribute values become type value
 API based on a map (remember your data structures …)
 You can know do things like:

var P= { “name” : “Jose”, “lastname” : “Diaz”}

P.name

P.get(“name”)

P.set(“name”, “joe”)
Database System Concepts - 6th Edition
7.22
©Silberschatz, Korth and Sudarshan
REST
 Restful Web Services
 Key Idea: Data in the server can be accessed with URL!
 Ex: mycompany.com/humanresources/person/123

Fetched record for person 123

Response from server:

{“Person”: { “id” : “123”, “name” : “Jose”, “lastname” : “Diaz”}}
 Map CRUD operations to web operations

CRUD – Create, Read, Update, Delete
 Mapping

Create new object – Use HTTP POST

Read object – Use HTTP GET

Update object – Use HTTP PUT

Delete object – Use HTTP DELETE
Database System Concepts - 6th Edition
7.23
©Silberschatz, Korth and Sudarshan
Summary
 Mobile Apps have become the most frequent client to get data out of
Internet

Database Resident on Internet
 Cloud Computing is riding a parallel wave

Mobile apps often feed from cloud-resident databases and other
data sources
 REST

Most common method to interface client and backend servers

Uses HTTP to specify CRUD operations
Database System Concepts - 6th Edition
7.24
©Silberschatz, Korth and Sudarshan