Upload
espressologic
View
45
Download
0
Tags:
Embed Size (px)
Citation preview
Welcome!
Topics
What’s REST, and Why? (hint: not because it’s idempotent)
REST and Database
How to Create a RESTful Server - demo
Brief Look at Logic
Q & A
Word for the day
DatTricityMation
REST
Connectable as Electricity
Safe, Secure and Fast
Big Job
Patterns
Boilerplate
REST - what & why
Why REST?
REST
1. Networked
2. SOA - any
language,
architecture
Mobile,
Web Apps,
Integration,
Cloud
ODBC
Corp
Data
What’s REST?
• What’s REST: HTTP/HTTPS based
• Very Database-y
– Resources (Objects) / Operations (vs. SOAP RPCs)
– JSON: Rows & Attributes
curl www.google.com
curl -X POST
https://demodev.espressologic.com/rest/el-dev/demo/v1/product
--data-binary '[{"name": "PA", "price": 199.99}, {"name":
"PB", "price": 299.99} ]' -H "Authorization: Espresso
demo_full:1" -H "Content-type: application/json"
Payload is JSON (or XML)
Resource
server/object?filter...
Operation: GET,
POST, PUT, DELETE
Pass 1 - DB and REST
Model Database REST
Domain Model Schema api: server/
Object View/Base Table,
Procedure?
Resource
Operations Select, Insert,
Update, Delete
Get, Post, Put,
Delete
Payload * JSON (XML)
Pass 2 - REST Network Performance
Requirement Solution
Limit Trips ● Nested Document Results
● Update refresh data
Limit payload row size ● Projection
Limit payload row count ● Filtering
● Pagination
Non-flat results also
best for clients
(business objects)
SQL Pass-thru
not enough
Hmm
Like this
FilterMulti-Level
Pagination Shape
Nested-document
resultOptimistic
Locking
Creating a RESTful Server
Creating REST - Framework xyz
• Create Server, Configure packages
• Define / Configure Routings
• Code Controllers
• Persistence Layer (Entity Framework, HibernateN, …)
• Code Persistence / REST logic, for each resource
– Filtering, Ordering, Projection, Pagination, Opt Locking, ...
• Code Logic and Security
• Compile, Deploy, Test, Iterate
Weeks to Months
Very Complex
Creating REST - DatTricityMation
• Create REST - just connect
• Create Resources: ~ Views, plus Nested-doc, Multi-DB
• Declare Logic, Security
Create Nested-Doc, Multi-DB Resources
• Joins, Logic across databases
– SQL
– REST
• Performance
– Joins - per row vs. per query
See it here
Business Logic
Whither Logic?
• Right Answer?
• Usual Answer??
{RESTful Server}
Shared
Network Accessible
Shared
Not Network Accessible
Not Shared
Needs REST
Excessive traffic
Serious work
250 lines / table
@ 50 lines / day
Tables Days
50 250
100 500
500 2500
● Business: Slow, Not Agile, Expensive
● Devs: Mostly boring, Error-prone
● Bus Users: Obscure
Logic: Reactive Programming Rules
Solves 12 transactions
● Hundreds of lines: triggers/Java
● Reduces (fat) client dev
See it here
Security
Valid User?
Row/Column access?
Considerations
NoSQL? When and Why...
Good
Reasons
Not So Good
Archiving Data Nested-Document REST API
Log Data Integrity (structure, logic)
Unstructured Data
JSON Is JavaScript
● Mobile JS app
Was hard in SQL
● No longer
World is networked… and changing
Business hates this
Conventional DatTricityMation
Upgrade Database Upgrade Database
Revise ORM
Recode REST Logic (order,
optimize)
Recode REST Security
Add rules
Compile, Deploy, Test Test Automatic reuse,
ordering, optimization
One More Thing...
Your data
in 5 seconds
Pretty Substantive Change
REST API, for free
Point/Click Nested-doc, Multi-DB
Logic and Security
Plus Live Browser
10X Faster
Fundamental Change
Thank You!
max, paul, val @ espressologic.com