modern architectures with spring and javascript

31
MODERN ARCHITECTURES WITH SPRING AND JAVASCRIPT Mar$n Lippert [email protected] @mar$nlippert

Upload: martinlippert

Post on 22-Jun-2015

6.591 views

Category:

Technology


5 download

DESCRIPTION

JavaScript becomes more and more important for implementing full-featured rich client applications in the browser. Therefore our classical ideas and blueprints for Spring-based architectures have to change. This talks provides a high-level overview of these changes and talks about how to combine Spring on the server side to implement RESTful and HATEOAS APIs and JavaScript in the client side to realize full client side apps in your browser. The talk discusses the basic ideas and motivations behind this shift in architectures without going too deep into all the technical details.

TRANSCRIPT

Page 1: Modern Architectures with Spring and JavaScript

MODERN  ARCHITECTURES  WITH  SPRING  AND  JAVASCRIPT

Mar$n  Lippert

[email protected]@mar$nlippert

Page 2: Modern Architectures with Spring and JavaScript

2

about me

Mar6n  LippertStaff  Engineer,  R&D,  at  SpringSource/VMware  and  lead  of  Spring  Tool  Suite  development

Working  areas•Eclipse  Tooling  for  the  Spring  plaAorm•Open  Source  CommiDer•Aspect-­‐Weaving  for  OSGi•Cloud  IDEs  and  JavaScript•Agile  soKware  development

Page 3: Modern Architectures with Spring and JavaScript

Typical Runtime Structures

Tomcat / tc Server

Relational Database

Browser

contains data

business logic &page rendering

render HTML

Page 4: Modern Architectures with Spring and JavaScript

More Detail...

Controllers

RDBMS

Browser-basedHTML Rendering

Repositories

Service Layer

View Generation

Channels

Browser

Application Server

Page 5: Modern Architectures with Spring and JavaScript

What happens?

Tomcat / tc Server

Relational Database

Browser

contains data & newchallenges (structure, size)

business logic &page rendering & APIs

render HTML & improved experience using JavaScript

AJAX calls

Page 6: Modern Architectures with Spring and JavaScript

A few observations

Tomcat / tc Server

Relational Database

Browser

contains data & newchallenges (structure, size)

business logic &page rendering & APIs

render HTML & improved experience using JavaScript

AJAX calls

duplicated logic, no modularization

APIs are challenging, Java not the only language anymore

relational & transactional don‘t fit anymore

Page 7: Modern Architectures with Spring and JavaScript

Different pictures

modern apps old style apps

NoSQL

JavaScript

Scala

Clojure

CoffeeScript

node.js

Hadoop

Ruby/Rails

PaaS

AWSJava

RDBMS

Application Server

JavaScript

HTML5/CSS3

HTML/CSS

Page 8: Modern Architectures with Spring and JavaScript

Where do we go from here?

Page 9: Modern Architectures with Spring and JavaScript

The

ClientSide

Page 10: Modern Architectures with Spring and JavaScript

Innovation happens here

Page 11: Modern Architectures with Spring and JavaScript

The JavaScript Story

http://www.maztek.com/blog/wp-content/uploads/javascript.jpg

Page 12: Modern Architectures with Spring and JavaScript

My assumptions- on the client side -

Browser only (HTML5/CSS3)JavaScript only

„The browser-based application written in JavaScript becomes the new

rich client architecture“

Page 13: Modern Architectures with Spring and JavaScript

Browser-basedHTML Rendering

More Detail...

HTML5 & JS Engine

Controllers

Client-side Model

DOM

Web Storage

Page 14: Modern Architectures with Spring and JavaScript

Existing JavaScript libs are UI centric(focus on making life with the DOM easier)

most prominent:jquery

Page 15: Modern Architectures with Spring and JavaScript

JavaScript versions of„good old rich client patterns“

begin to appear(and are highly necessary)

Examplesbackbone.jsangular.jsember.js

...

Page 16: Modern Architectures with Spring and JavaScript

Browser App (JavaScript)

forget about JSF ;-)

maybe GWT, but likely not

maybe also CoffeeScript, TypeScript, Dart

Page 17: Modern Architectures with Spring and JavaScript

The

ServerSide

Page 18: Modern Architectures with Spring and JavaScript

Controllers

RDBMSRepositories

Service Layer

View Generation

Channels

RDBMS

Service

NoSQL

Service Service

Service

other

Service Service

business/domain services

platform services

Page 19: Modern Architectures with Spring and JavaScript

Service Service Service Service Service

this is where Spring is really powerfulready to run „in the cloud“ (scalability)

(no client-side rendering or logic)

Page 20: Modern Architectures with Spring and JavaScript

Service

Spring MVC + Spring HATEOASis a powerful combination

APIs are JSON and HATEOAS based

Spring MVC is the easiest way to implement RESTful APIs and services

more on Spring HATEOAS:https://github.com/SpringSource/spring-hateoas

Page 21: Modern Architectures with Spring and JavaScript

Service

Spring Batch

Spring Integration & Messaging

Page 22: Modern Architectures with Spring and JavaScript

My assumptions- server side languages -

many different languages in usechoose the right language for the right job

don‘t use a new language for fun

Page 23: Modern Architectures with Spring and JavaScript

My assumptions- data storage -

more and more data (big data)different storage techniques combined

(rdbms, nosql, graph databases)scalability is important

Page 24: Modern Architectures with Spring and JavaScript

The picture

RDBMS

Service

Browser

PaaS

HTML5 & JS Engine

Controllers

Client-side Model

DOM

Web Storage

NoSQL

Service Service

Service

other

Service Service

business/domain services

platform services

Page 25: Modern Architectures with Spring and JavaScript

Browser App(JavaScript)

Service

RESTful API(JSON over http)

Push(JSON over WebSockets)

Communication

Page 26: Modern Architectures with Spring and JavaScript

The

Challenges

Page 27: Modern Architectures with Spring and JavaScript

Modularityin

JavaScript

Page 28: Modern Architectures with Spring and JavaScript

AMD(asynchronous module definition)

wire.js(Dependency Injection for JavaScript)

Micro Services for JavaScript(OSGi services written in JavaScript)

Page 29: Modern Architectures with Spring and JavaScript

More Challengesofflinecloud-ready servicesdefine good APIs versioned APIsTDD for JavaScript

Page 30: Modern Architectures with Spring and JavaScript

Adrian Colyer on Application Development in the Cloud Erahttp://www.youtube.com/watch?v=axOPJbrIjkY

Example app using Spring for providing RESTful APIs and JavaScript for a rich client and mobile app

https://github.com/SpringSource/html5expense

Asynchronous Module Definition for JavaScript (AMD)https://github.com/amdjs/amdjs-api

http://requirejs.org/docs/whyamd.html

wire.jshttps://github.com/cujojs/wire

hello world with wire.jshttps://github.com/briancavalier/hello-wire.js

more advanced example for wire.jshttps://github.com/briancavalier/piratescript

Cloud Foundry PaaShttp://www.cloudfoundry.comhttp://www.cloudfoundry.org

more information

Page 31: Modern Architectures with Spring and JavaScript

Martin Lippert, [email protected], @martinlippert

Q&Aand thank you for your attention