24
Welcome!

Mtn view sql server nov 2014

Embed Size (px)

Citation preview

Page 1: Mtn view sql server nov 2014

Welcome!

Page 2: Mtn view sql server nov 2014

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

Page 3: Mtn view sql server nov 2014

Word for the day

DatTricityMation

REST

Connectable as Electricity

Safe, Secure and Fast

Big Job

Patterns

Boilerplate

Page 4: Mtn view sql server nov 2014

REST - what & why

Page 5: Mtn view sql server nov 2014

Why REST?

REST

1. Networked

2. SOA - any

language,

architecture

Mobile,

Web Apps,

Integration,

Cloud

ODBC

Corp

Data

Page 6: Mtn view sql server nov 2014

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

Page 7: Mtn view sql server nov 2014

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)

Page 8: Mtn view sql server nov 2014

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

Page 9: Mtn view sql server nov 2014

Like this

FilterMulti-Level

Pagination Shape

Nested-document

resultOptimistic

Locking

Page 10: Mtn view sql server nov 2014

Creating a RESTful Server

Page 11: Mtn view sql server nov 2014

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

Page 12: Mtn view sql server nov 2014

Creating REST - DatTricityMation

• Create REST - just connect

• Create Resources: ~ Views, plus Nested-doc, Multi-DB

• Declare Logic, Security

Page 13: Mtn view sql server nov 2014

Create Nested-Doc, Multi-DB Resources

• Joins, Logic across databases

– SQL

– REST

• Performance

– Joins - per row vs. per query

See it here

Page 14: Mtn view sql server nov 2014

Business Logic

Page 15: Mtn view sql server nov 2014

Whither Logic?

• Right Answer?

• Usual Answer??

{RESTful Server}

Shared

Network Accessible

Shared

Not Network Accessible

Not Shared

Needs REST

Excessive traffic

Page 16: Mtn view sql server nov 2014

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

Page 17: Mtn view sql server nov 2014

Logic: Reactive Programming Rules

Solves 12 transactions

● Hundreds of lines: triggers/Java

● Reduces (fat) client dev

See it here

Page 18: Mtn view sql server nov 2014

Security

Valid User?

Row/Column access?

Page 19: Mtn view sql server nov 2014

Considerations

Page 20: Mtn view sql server nov 2014

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

Page 21: Mtn view sql server nov 2014

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

Page 22: Mtn view sql server nov 2014

One More Thing...

Your data

in 5 seconds

Page 23: Mtn view sql server nov 2014

Pretty Substantive Change

REST API, for free

Point/Click Nested-doc, Multi-DB

Logic and Security

Plus Live Browser

10X Faster

Fundamental Change

Page 24: Mtn view sql server nov 2014

Thank You!

max, paul, val @ espressologic.com