25
Date: 02/03/2015 Frameworks or a Design Pattern ? Shubhra Kar, Head of Products and Education @shubhrakar

Node frameworks talk_hackerdojo

Embed Size (px)

Citation preview

Page 1: Node frameworks talk_hackerdojo

Date: 02/03/2015

Frameworks or a Design Pattern ?

Shubhra Kar, Head of Products and Education @shubhrakar

Page 2: Node frameworks talk_hackerdojo

Bert Belder

Ben Noordhuis

Node Core

Raymond Feng

Ritchie Martori

LoopBack / Express Core

Sam Roberts

Miroslav Bajtos

Ryan Graham Plus 15 other full-time open source

developers working on Node.js core, modules and tools. Contributing to over 100 open source modules. Supporting banks, retail, IoT companies, startups and internet companies on Node.js

Page 3: Node frameworks talk_hackerdojo

Patterns are not created, they evolve

Right Now

— Someone on Stage

Page 4: Node frameworks talk_hackerdojo

Pattern 1: DIY / Construction Blocks

✤ Un-opinionated

✤ Middleware

Page 5: Node frameworks talk_hackerdojo

Router using express 4.0

Page 6: Node frameworks talk_hackerdojo

Router using restify

Page 7: Node frameworks talk_hackerdojo

Strengths and Weaknesses

Pros

Great starting point

Low learning curve

Nearly a standard for Node.js web middleware

Fully customizable

Targeted at browser, hence templating and rendering OOB

Cons

All endpoints need to be created manually

Developers may end up creating their own non-optimized libraries

Every end point needs to be tested

Refactoring is painful, update everything everywhere

No standards or prescription, DIY

Pros

Very stable and actively developed.

Automatic DTrace support for all handlers on enabled platforms

Built in throttling

SPDY support

Borrows from express but without unnecessary templating/rendering

Strict API with full control over HTTP interactions

Visibility into latency and app characteristics

Cons

All endpoints need to be created manually

Developers may end up creating their own non-optimized libraries

Every end point needs to be tested

Refactoring is painful, update everything everywhere

No standards or prescription, DIY

Less documentation

Express Restify

Page 8: Node frameworks talk_hackerdojo

Pattern 2: Configuration

✤ HAPI

✤ Express and Restify (maybe…)

Page 9: Node frameworks talk_hackerdojo

Router using hapi

Page 10: Node frameworks talk_hackerdojo

Router using hapi

Page 11: Node frameworks talk_hackerdojo

Strengths and Weaknesses

Pros

Supported by Walmart labs. Less known but getting momentum

Very granular control over request handling

Detailed API reference with support for document generation

Significantly more functionality for building web servers

Pseudo prescriptive with configuration centric approach

Caching, Authentication and input validation available

Plugin based architecture for scaling

Cons

Good construction blocks but left to your own devices to figure out design patterns

Binds you to specific modules and tool chains (catbox, joi, tv, boom, good, travelogue, yar)

All endpoints need to be created manually

Developers may end up creating their own non-optimized libraries

Every end point needs to be tested

Refactoring is painful, update everything everywhere

Page 12: Node frameworks talk_hackerdojo

Pattern 3: Convention - ORM

✤ Model driven development

✤ Any Datasource

✤ Automatic Rest API Generation

Page 13: Node frameworks talk_hackerdojo

Router using LoopBack DELETE /items/{id}GET /itemsGET /items/countGET /items/findOneGET /items/{id}GET /items/{id}/existsPOST /itemsPUT /itemsPUT /items/{id}

Page 14: Node frameworks talk_hackerdojo

Swagger using LoopBack

Page 15: Node frameworks talk_hackerdojo

Router using Sails

Page 16: Node frameworks talk_hackerdojo

Strengths and Weaknesses

Pros

Very quick RESTful API development

Convention over configuration (extends express)

Built in models ready to use (ORM)

RPC support, Web and Mobile SDKs

Data Connectors

Fully configurable when needed

Extensive documentation

Commercial support and full time team working on project (Loopback)

Mobile Services (Push, Geo, Storage, Sync, Offline, File, Device, User) - Loopback

Authentication, validation and Authorization

Cons

Higher learning curve

Opinionated

Page 17: Node frameworks talk_hackerdojo

Pattern 4: Isomorphic JS & Full Stack

✤ Share Server Model with Client / Remoting

✤ Omni-Channel (Mobile, Web, IoT)

Page 18: Node frameworks talk_hackerdojo
Page 19: Node frameworks talk_hackerdojo
Page 20: Node frameworks talk_hackerdojo

Pattern 5: MicroServices

✤ Decomposition

✤ Containment

✤ Flexibility

✤ Hyperscale

Page 21: Node frameworks talk_hackerdojo

Relational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one)

Laptop ( not requested but useful)

Connections

Tablet Phone IoT SDK API SERVER Items for ACL

Quick Example of Use

App Server Add On

App Server

Relational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one)

Laptop ( not requested but useful)

Connections

Tablet Phone IoT SDK API SERVER Items for ACL

Quick Example of Use

App Server Add On

App Server

Auth Routing Rate-Limit Proxy Mediation Orchestration Analytics

✤ RECOMPOSITION isn’t cutting it

Page 22: Node frameworks talk_hackerdojo

✤ The new need is DE-COMPOSITION

SaaS Mobile IoT Web

App Server API Server

HTML JSON

{JSON} {JSON}

{JSON}

<SOAP/XML>

<TABLE>

Page 23: Node frameworks talk_hackerdojo

Design Time

Page 24: Node frameworks talk_hackerdojo

Run Time

Page 25: Node frameworks talk_hackerdojo