grails & the world of tomorrow
Post on 10-May-2015
922 Views
Preview:
DESCRIPTION
TRANSCRIPT
Grails & the World of Tomorrow
Peter Ledbrook, Developer Advocatepledbrook@vmware.com / @pledbrook
© 2012 SpringOne 2GX. All rights reserved. Do not distribute without permission.
1
Cloud
NoSQL
CloudCloud
HTML5.js
Social
2
HTML5.js
Web sites Applications
Server-side HTMLLow interactivityNo offline
Client-side HTMLHigh interactivityOffline
Wikipedia
3
HTML5.js
Web sites Applications
Server-side HTMLLow interactivityNo offline
Client-side HTMLHigh interactivityOffline
4
HTML5.js
Web sites Applications
Server-side HTMLLow interactivityNo offline
Client-side HTMLHigh interactivityOffline
GMail
5
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
Google I/O 2012
Android activations to date
400 million
Apple WWDC 2012
iOS devices sold to date
365 million
7
Is this the end for server-side templates?
8
NoSQL / Big Data
Data the way you want it!
9
NoSQL / Big Data
Everyone has interesting data
10
11
Cloud
Scaling Reduced capital costs
Easier administration
12
Cloud
Ephemeral filesystems
Session management
No Multicast
13
14
A typical Grails app
Controller View
HTTP
Service
GORM/Hibernate
Database
15
16
What do these cars have in common?
17
Same platform, different components
18
Core Grails == Chassis
Plugins == Components
19
How can Grails help - Rich UIs?
URL mappings for REST
JSON & XML converters
Resources (for JS & CSS)
zipping, caching, compression
20
Static resource handling
App
Kickstart Bootstrap Plugin Shiro UI Plugin
Twitter Bootstrap Plugin
21
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
How can Grails help - Social?
oauth { providers { twitter { api = TwitterApi key = 'my-key' secret = 'my-secret' successUri = '/' failureUri = '/' } }}
Simplified OAuth via OAuth plugin:
23
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
How can Grails help - NoSQL?
Accessible NoSQL via GORM
Domain Model
GORM
25
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
27
PaaS deployment
AppRedis Plugin Rabbitmq Plugin
> grails cf-push
28
What about horizontal scalability?
29
Introducing CQRS
Updates
Views
Concurrency via event bus
Store changes
Separate data stores for queries
30
Event bus (Platform Core plugin)
Event Bus
Plugins ApplicationPluginsPlugins
Save entity IndexUpdate
read DBsCall REST
service
31
Event bus (Events SI plugin)
Event Bus (SI)
Plugins ApplicationPluginsPlugins
Save entity IndexUpdate
read DBsCall REST
service
AMQP
32
Event bus (Events Push plugin)
Event Bus (SI)
Plugins ApplicationPluginsPlugins
Event Bridge
Browser
33
grailsTodos sample
34
grailsTodos sample
35
grailsTodos sample
36
grailsTodos sample
37
grailsTodos sample
http://grailstodos.cloudfoundry.com/todos/
Try it:
See the code:
http://github.com/smaldini/grailsTodos
38
Enabling plugin authors
39
More Platform Core
Security API
Who is the current user?
Does the user have a particular role?
Is user permitted to do something?
40
More Platform Core
Navigation API
Menu
Application Plugin
Action
Action
41
More Platform Core
Config API
Declare config options
Automatic namespacing
Default values & automatic merging
42
More Platform Core
Convention API
static searchable = { ... } @Taggable
Convention overrides!
e.g.
43
Platform UI
Themes
+
UI tags
e.g. App Info plugin + Bootstrap Kickstart
44
Project archetypes?
45
SQL database
CRUD
jQuery
Multi page
46
SQL for write
REST endpoints
AngularJS
Redis for read
47
Events
Web Sockets (with emulation)
Spring Integration
48
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
More info
• w: http://grails.org/• f: http://grails.org/Mailing+Lists
• e: pledbrook@vmware.com• t: pledbrook• b: http://blog.springsource.com/author/peter-ledbrook/
50
Q & A
51
top related