Your SlideShare is downloading. ×
0
Álvaro Sánchez-Mariscal
Developing SPI applications using Grails and
AngularJS
@alvaro_sanchez - Odobo
About me
• Passionate software developer.
• Founded Salenda in 2005.
• Co-founded Escuela de Groovy in 2009.
• Groovy/Grai...
• HTML5 games platform for:
• Game developers.
• Casinos.
Typical Grails
Architecture

This is about architecture.
Grails is essentially MVC.
This can be fine for some projects, but...
Monolithic!

Although the individual Grails artifacts can be developed in a modular way, it still has the
views and the bu...
Slow GSP rendering!
Slow startup time!
Memory consumption,
reloading issues...
Sitemesh and the GSP rendering engine it’s ...
Other problems
• It’s tricky to decouple the view layer to
render views for different devices.

• It’s difficult to do fre...
Grails 3.0 will have
application profiles

The Grails roadmap is already embracing the change, and 3.0 will offer differen...
So... WTF is a Single
Page Application?

SPI or SPA.
• A webapp where you can navigate
without any page refresh.

• Ajax/REST is used to communicate with
the server.

• The MV...
Seriously??

WTF!?!?
Did you say
Javascript??
Oh yeah me
too!
I like
Javascript!
I’m fine with Grails.
Why should I care
about SPI?
• It’s faster.
• It has better user
experience.

• It may be easier for
the developer.

• How to gracefully
degrade?
• How...
Other benefits
• You get ready to expose a public API.
• It allows you to update the UI frequently.
• It’s easier to creat...
You got me!! How can I
do that with Grails!!
• Use Grails 2.3 REST capabilities.
• Define your backend: GORM? Other web
services?

• Make it a robust, powerful black b...
•

Focus on:

• Transactions.
• Efficient data manipulation.
• Security.
• Scalability.
What are the
alternatives for the
client side?
AngularJS, Ember, Backbone...
todomvc.com
• Todo app implemented in lot of
frameworks
Similar features
Grails

AngularJS

Domain class

Model

GSP’s and templates

Views and templates

${}

{{ }}

Controllers...
Grails & Angular
• Angular will issue an OPTIONS request
as per CORS:

• Use cors plugin.
• Manually configure URL mapping...
Demo
Álvaro Sánchez-Mariscal
Developing SPI applications using Grails and
AngularJS
@alvaro_sanchez - Odobo
Developing SPI applications using Grails and AngularJS
Developing SPI applications using Grails and AngularJS
Upcoming SlideShare
Loading in...5
×

Developing SPI applications using Grails and AngularJS

6,261

Published on

Client-side MVC frameworks like AngularJS are getting more popular over time. They represent a big architectural change to what web developers are used to: moving from server-side MVC to a browser based one. In this talk I will speak about how Grails can fit with a single-page architecture and discuss the pros and cons of developing that kind of applications.

The companion code is published at https://bitbucket.org/alvaro_sanchez/backoffice

Published in: Technology
3 Comments
9 Likes
Statistics
Notes
  • The question is whether you really want to drag the whole Grails combo around with you for this one. In my experience a direct Spring + JPA approach is easier to maintain, it scales better and it is significantly easier to test. I do not see any benefits of using Grails in this scenario except for some doubtful syntactic sugar for the domain classes. Spring also gives you REST and Security support out of the box.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • It is published at https://bitbucket.org/alvaro_sanchez/backoffice
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • thanks for a good presentation, do you have the demo publicly available?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
6,261
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
61
Comments
3
Likes
9
Embeds 0
No embeds

No notes for slide

Transcript of "Developing SPI applications using Grails and AngularJS"

  1. 1. Álvaro Sánchez-Mariscal Developing SPI applications using Grails and AngularJS @alvaro_sanchez - Odobo
  2. 2. About me • Passionate software developer. • Founded Salenda in 2005. • Co-founded Escuela de Groovy in 2009. • Groovy/Grails lover since 2007. • Working now at Odobo.
  3. 3. • HTML5 games platform for: • Game developers. • Casinos.
  4. 4. Typical Grails Architecture This is about architecture. Grails is essentially MVC. This can be fine for some projects, but may have drawbacks in large projects
  5. 5. Monolithic! Although the individual Grails artifacts can be developed in a modular way, it still has the views and the business logic on the same artifact.
  6. 6. Slow GSP rendering! Slow startup time! Memory consumption, reloading issues... Sitemesh and the GSP rendering engine it’s not the fastest thing in the world... Large projects may suffer slow startup times, intensive resource usage, ....
  7. 7. Other problems • It’s tricky to decouple the view layer to render views for different devices. • It’s difficult to do frequent deployments. • It’s hard to scale development. Although there are plugins to solve this, it’s not that agile to have different renderings for different devices. Changes on the UI will require to redeploy the whole thing. The development efforts must be synchronized.
  8. 8. Grails 3.0 will have application profiles The Grails roadmap is already embracing the change, and 3.0 will offer different profiles: - Classic MVC. - Netty. - Vert.x. - Etc.
  9. 9. So... WTF is a Single Page Application? SPI or SPA.
  10. 10. • A webapp where you can navigate without any page refresh. • Ajax/REST is used to communicate with the server. • The MVC is in the browser, written in Javascript.
  11. 11. Seriously?? WTF!?!? Did you say Javascript??
  12. 12. Oh yeah me too! I like Javascript!
  13. 13. I’m fine with Grails. Why should I care about SPI?
  14. 14. • It’s faster. • It has better user experience. • It may be easier for the developer. • How to gracefully degrade? • How to deal with communication failures? • Can I use the application offline? need • Do IMVC? to duplicate the The applications are usually faster and more responsive, so the user experience is better. It may be easier for developers, as they don’t need to deal with callbacks, the views are updated automatically. ---What if there is no Javascript enabled? How to handle network issues? Are we going to have duplicated efforts?
  15. 15. Other benefits • You get ready to expose a public API. • It allows you to update the UI frequently. • It’s easier to create mobile apps. • You can organize/scale your teams better. Separating the view you get ready for exposing an API. The UI can be redeployed frequently, without affecting the platform. It’s easier to create different views, for different devices. The dev teams can be reorganized and some development can be done in parallel.
  16. 16. You got me!! How can I do that with Grails!!
  17. 17. • Use Grails 2.3 REST capabilities. • Define your backend: GORM? Other web services? • Make it a robust, powerful black box for the front end. Grails 2.3 comes with significant improvements to build REST API’s. You can still use all Groovy ecosystem to consume any backend. Then, you can concentrate on building a robust, tested, black boxed Grails layer.
  18. 18. • Focus on: • Transactions. • Efficient data manipulation. • Security. • Scalability.
  19. 19. What are the alternatives for the client side?
  20. 20. AngularJS, Ember, Backbone...
  21. 21. todomvc.com • Todo app implemented in lot of frameworks
  22. 22. Similar features Grails AngularJS Domain class Model GSP’s and templates Views and templates ${} {{ }} Controllers Controllers URL Mappings Routing
  23. 23. Grails & Angular • Angular will issue an OPTIONS request as per CORS: • Use cors plugin. • Manually configure URL mappings to avoid 405 responses.
  24. 24. Demo
  25. 25. Álvaro Sánchez-Mariscal Developing SPI applications using Grails and AngularJS @alvaro_sanchez - Odobo
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×