Transcript
Page 1: Grails & the World of Tomorrow

Grails & the World of Tomorrow

Peter Ledbrook, Developer [email protected] / @pledbrook

© 2012 SpringOne 2GX. All rights reserved. Do not distribute without permission.

1

Page 2: Grails & the World of Tomorrow

Cloud

NoSQL

CloudCloud

HTML5.js

Social

2

Page 3: Grails & the World of Tomorrow

HTML5.js

Web sites Applications

Server-side HTMLLow interactivityNo offline

Client-side HTMLHigh interactivityOffline

Wikipedia

3

Page 4: Grails & the World of Tomorrow

HTML5.js

Web sites Applications

Server-side HTMLLow interactivityNo offline

Client-side HTMLHigh interactivityOffline

Twitter

4

Page 5: Grails & the World of Tomorrow

HTML5.js

Web sites Applications

Server-side HTMLLow interactivityNo offline

Client-side HTMLHigh interactivityOffline

GMail

5

Page 6: Grails & the World of Tomorrow

HTML5.js

Web sites Applications

Server-side HTMLLow interactivityNo offline

Client-side HTMLHigh interactivityOffline

We’re going this way!

Example:

REST + JSON

Backbone.js + Moustache

6

Page 7: Grails & the World of Tomorrow

Google I/O 2012

Android activations to date

400 million

Apple WWDC 2012

iOS devices sold to date

365 million

7

Page 8: Grails & the World of Tomorrow

Is this the end for server-side templates?

8

Page 9: Grails & the World of Tomorrow

NoSQL / Big Data

Data the way you want it!

9

Page 10: Grails & the World of Tomorrow

NoSQL / Big Data

Everyone has interesting data

10

Page 11: Grails & the World of Tomorrow

11

Page 12: Grails & the World of Tomorrow

Cloud

Scaling Reduced capital costs

Easier administration

12

Page 13: Grails & the World of Tomorrow

Cloud

Ephemeral filesystems

Session management

No Multicast

13

Page 14: Grails & the World of Tomorrow

14

Page 15: Grails & the World of Tomorrow

A typical Grails app

Controller View

HTTP

Service

GORM/Hibernate

Database

15

Page 16: Grails & the World of Tomorrow

16

Page 17: Grails & the World of Tomorrow

What do these cars have in common?

17

Page 18: Grails & the World of Tomorrow

Same platform, different components

18

Page 19: Grails & the World of Tomorrow

Core Grails == Chassis

Plugins == Components

19

Page 20: Grails & the World of Tomorrow

How can Grails help - Rich UIs?

URL mappings for REST

JSON & XML converters

Resources (for JS & CSS)

zipping, caching, compression

20

Page 21: Grails & the World of Tomorrow

Static resource handling

App

Kickstart Bootstrap Plugin Shiro UI Plugin

Twitter Bootstrap Plugin

21

Page 22: Grails & the World of Tomorrow

Scaffolding libraries

> grails install-plugin jquery-mobile-scaffolding> grails install-mobile-templates> grails create-domain-class org.example.Todo

<edit Book.groovy>

> grails generate-all org.example.Todo> grails run-app

22

Page 23: Grails & the World of Tomorrow

How can Grails help - Social?

oauth { providers { twitter { api = TwitterApi key = 'my-key' secret = 'my-secret' successUri = '/' failureUri = '/' } }}

Simplified OAuth via OAuth plugin:

23

Page 24: Grails & the World of Tomorrow

How can Grails help - Social?

<oauth:connect provider="twitter"> Connect to Twitter</oauth:connect>

class MyService { def oauthService

def myMethod() { def twitterUsers = oauthService.getTwitterResource( twitterAccessToken, "http://api.yourprovider.com/users/list") ... }}

24

Page 25: Grails & the World of Tomorrow

How can Grails help - NoSQL?

Accessible NoSQL via GORM

Domain Model

GORM

25

Page 26: Grails & the World of Tomorrow

How can Grails help - Cloud?

Cache plugin

RedisEhcache

For HTTP sessions, Database Session plugin

Solve the caching problem with the Cache plugin

Database Session plugin

CookieMongoDB

26

Page 27: Grails & the World of Tomorrow

27

Page 28: Grails & the World of Tomorrow

PaaS deployment

AppRedis Plugin Rabbitmq Plugin

> grails cf-push

28

Page 29: Grails & the World of Tomorrow

What about horizontal scalability?

29

Page 30: Grails & the World of Tomorrow

Introducing CQRS

Updates

Views

Concurrency via event bus

Store changes

Separate data stores for queries

30

Page 31: Grails & the World of Tomorrow

Event bus (Platform Core plugin)

Event Bus

Plugins ApplicationPluginsPlugins

Save entity IndexUpdate

read DBsCall REST

service

31

Page 32: Grails & the World of Tomorrow

Event bus (Events SI plugin)

Event Bus (SI)

Plugins ApplicationPluginsPlugins

Save entity IndexUpdate

read DBsCall REST

service

AMQP

32

Page 33: Grails & the World of Tomorrow

Event bus (Events Push plugin)

Event Bus (SI)

Plugins ApplicationPluginsPlugins

Event Bridge

Browser

33

Page 34: Grails & the World of Tomorrow

grailsTodos sample

34

Page 35: Grails & the World of Tomorrow

grailsTodos sample

35

Page 36: Grails & the World of Tomorrow

grailsTodos sample

36

Page 37: Grails & the World of Tomorrow

grailsTodos sample

37

Page 38: Grails & the World of Tomorrow

grailsTodos sample

http://grailstodos.cloudfoundry.com/todos/

Try it:

See the code:

http://github.com/smaldini/grailsTodos

38

Page 39: Grails & the World of Tomorrow

Enabling plugin authors

39

Page 40: Grails & the World of Tomorrow

More Platform Core

Security API

Who is the current user?

Does the user have a particular role?

Is user permitted to do something?

40

Page 41: Grails & the World of Tomorrow

More Platform Core

Navigation API

Menu

Application Plugin

Action

Action

41

Page 42: Grails & the World of Tomorrow

More Platform Core

Config API

Declare config options

Automatic namespacing

Default values & automatic merging

42

Page 43: Grails & the World of Tomorrow

More Platform Core

Convention API

static searchable = { ... } @Taggable

Convention overrides!

e.g.

43

Page 44: Grails & the World of Tomorrow

Platform UI

Themes

+

UI tags

e.g. App Info plugin + Bootstrap Kickstart

44

Page 45: Grails & the World of Tomorrow

Project archetypes?

45

Page 46: Grails & the World of Tomorrow

SQL database

CRUD

jQuery

Multi page

46

Page 47: Grails & the World of Tomorrow

SQL for write

REST endpoints

AngularJS

Redis for read

47

Page 48: Grails & the World of Tomorrow

Events

Web Sockets (with emulation)

Spring Integration

48

Page 49: Grails & the World of Tomorrow

Summary

• The way applications are architected will change– Websites will still be built (GSP not gone yet)– Not everyone will need the same architecture– Project archetypes and scaffolding!

• No single framework has everything you need• Pick and choose the appropriate components for your

49

Page 50: Grails & the World of Tomorrow

More info

• w: http://grails.org/• f: http://grails.org/Mailing+Lists

• e: [email protected]• t: pledbrook• b: http://blog.springsource.com/author/peter-ledbrook/

50

Page 51: Grails & the World of Tomorrow

Q & A

51


Top Related