SlideShare a Scribd company logo
© Catalysts GmbH

Magic with Groovy & Grails
The Search is over
© Catalysts GmbH
What is Groovy?
•

Dynamic language

•

It can leverage Java's enterprise capabilities but also has cool productivity
features like closures, builders and dynamic typing

•

1.0 released on 02.01.2007

•

Dynamically compiled to JVM bytecode

•

99% of Java code is also valid

•

Groovy = Java +
dynamic typing +

additional methods & operators + closures
© Catalysts GmbH
Dynamic Typing
Java
ArrayList<String> list = new ArrayList<String>() {
{

Groovy
add("A");
add("B");
add("C");

}
};
HashMap<Integer, String> map = new HashMap<Integer, String>() {
{
put(1, "A");
put(2, "B");
put(3, "C");
}
};

© Catalysts GmbH

?
Dynamic Method Invocation
class Dog {
def bark() { println "woof!" }
def sit() { println "(sitting)" }
def jump() { println "boing!" }
}
def doAction( animal, action ) {
animal."$action"() //action name is passed at invocation
}
def rex = new Dog()
doAction( rex, "bark" ) //prints 'woof!'
doAction( rex, "jump" ) //prints 'boing!'

© Catalysts GmbH
Additional Operators
•

Spread *.

parent*.action //equivalent to:

parent.collect{ child -> child?.action }
•

Elvis ?:

assert ['cat', 'elephant']*.size() == [3, 8]
•

Safe navigation ?.

•

Equals ==

© Catalysts GmbH
Closures
“A Groovy Closure is like a ‘code block’ or a method pointer. It is a piece of
code that is defined and then executed at a later point.”

http://groovy.codehaus.org/Closures

© Catalysts GmbH
Functional Programming(1)
•

Closures as functions

def multiply = { x, y -> return x * y }

println multiply.call(3, 4)
def triple = {x -> return 3*x }
•

Closures as function compositions

//like LISP, Haskell lambda functions
def composition = { f, g, x, y-> return f(g(x, y)) }
composition.call(triple, multiply, 5, 6)

© Catalysts GmbH
Functional Programming(2)
•

Fibonacci

def fibonacci

fibonacci = { n ->
n <= 1 ? n : fibonacci(n-1) + fibonacci(n-2)
}.memoize()
println fibonacci.call(35)

© Catalysts GmbH
What is Grails?
Grails is a full stack framework and attempts to solve as many pieces of the web development puzzle through the core technology
and its associated plugins. Included out the box are things like:
1. An easy to use Object Relational Mapping (ORM) layer built on Hibernate

2. An expressive view technology called Groovy Server Pages (GSP) ~ JSP
3. A controller layer built on Spring MVC
4. A command line scripting environment built on the Groovy-powered Gant
5. An embedded Tomcat container which is configured for on the fly reloading

6. Dependency injection with the inbuilt Spring container
7. Support for internationalization (i18n) built on Spring's core MessageSource concept
8. A transactional service layer built on Spring's transaction abstraction
All of these are made easy to use through the power of the Groovy language and the extensive
use of Domain Specific Languages (DSLs)

© Catalysts GmbH
What is Grails?
•

Web application framework

•

Convention over configuration

•

Spring MVC

•

Fast prototyping and development

© Catalysts GmbH
Convention over configuration
This typically means that the name and location of files is used instead of explicit configuration

© Catalysts GmbH
© Catalysts GmbH
© Catalysts GmbH
What does all these means?(1)
What does mean all these features of Grails?
1. An easy to use Object Relational

Mapping (ORM) layer built on

Hibernate
That means that you just have to define your domain classes, with all the attributes that you
want. These domain classes will be automatically mapped by Hibernate to tables inside the
database you have specified in Datasource.groovy, and the domain class attributes will be
mapped to table fields.
Having this domain classes mapped, you can now perform all CRUD operations on them, with
the usage of dynamic methods added by GORM to the domain classes such as “save(),
delete(), findAll, findAllBy, findAllWhere, count etc.”
These dynamic methods instantly boost your productivity since you dont have to worry anymore
about writing sql queries or managing the data layer. Grails does all of these for you! (*
however if you still want to customize how things are mapped, sql queries, you can dive into the
deep of Hibernate configs)
© Catalysts GmbH
2. An expressive view technology called
Groovyall these features of Grails? (GSP)
Server Pages
What does mean
Groovy Servers Pages (or GSP for short) is Grails' view technology. It is designed to be familiar
for users of technologies such as ASP and JSP, but to be far more flexible and intuitive.
You can be more flexible because you can use groovy code inside the pages, that is executed
before the page is sent, or use specific reusable componets - taglibs.

© Catalysts GmbH
3. A controller layer built on Spring MVC

Controllers are the classes that responds and handle requests from the
front-end.
A controller can generate the response directly or delegate it to a view.
Controller methods and views are tightened together, thus a controller
method called “search” will by default render the view “search”.

© Catalysts GmbH
4. A command line scripting environment
built on the Groovy-powered Gant
That means that you can use groovy console to run the application, the
tests, install plugins and so on.

© Catalysts GmbH
5. An embedded Tomcat container which
is configured for on the fly reloading
Grails provides an embedded Tomcat instance, where your application is
deployed automatically when you want it to run. This means that you don't
have to worry about a separate Tomcat container and deploy
configurations that takes time.
Also, you can make changes to your application on the fly, without the
need to redeploy the app. However, when changing domain classes, the
database will change too, so the application has to be deployed again.

© Catalysts GmbH
6. Dependency injection with the inbuilt
Spring container
Grails leverages Spring MVC in the following areas:
Basic controller logic - Grails subclasses Spring's DispatcherServlet and uses it
to delegate to Grails controllers
Data Binding and Validation - Grails' validation and data binding capabilities are
built on those provided by Spring
Runtime configuration - Grails' entire runtime convention based system is wired
together by a Spring ApplicationContext
Transactions - Grails uses Spring's transaction management in GORM
In other words Grails has Spring embedded running all the way through it.

© Catalysts GmbH
7. Support for internationalization (i18n)
built on Spring's core MessageSource
This means that your application can be written in as many languages as you want.
All you have to do is to use specific codes for each message that you use, and
provide different translations for these codes.
You can split and organise your language files as you like.

© Catalysts GmbH
8. A transactional service layer built on
Spring's transaction abstraction
The Grails team discourages the embedding of core application logic inside
controllers, as it does not promote reuse and a clean separation of concerns.

Services in Grails are the place to put the majority of the logic in your application,
leaving controllers responsible for handling request flow with redirects and so on.
Services are transactional by default. This means that if an operation on the
database fails, and this operations is performed in a service, that operation will be
automatically rolled back due to default transactional behaviour of services.

© Catalysts GmbH
Why would I use it?
1- Grails is Spring and Hibernate
Grails was a good replacement for vanilla Spring/Hibernate, but it’s even better. In
the real world it means that you can bootstrap a new project very quickly by using
default settings, but you have all the power of Spring and Hibernate under the
hood. If you really need to do some really specific stuff, you can easily go into deep
of configurations.
The best of both worlds! And it also means that you can use all the Spring modules
you already love and integrate with all the databases you are used to, without any
problem.
You just have to define your domain classes and with the usage of dynamic
scaffolding your application is ready to go with all the CRUD operations (views,
controllers ) already implemented.

© Catalysts GmbH
Why would I use it?
2- Groovy is actually Java
Java is a statically-typed language and it was designed to be, because it’s just easier to
understand. But recently, we have all come to envy the expressivity and power of dynamic
languages like Ruby and Python. The problem is that they are completely new languages,
which means 2 things: the learning curve is pretty steep, and it’s hard to find good developers
for those languages. Well, fear no more, because Groovy is here to save you.
Groovy is essentially a superset of Java as a language, which means that you don’t need to
learn an entirely new language, and it’s really easy to turn any Java developer into a Groovy
developer. Sure Groovy offers much more than Java in terms of power, and it can take some
time to get a good grasp of all the ins and outs of closures, dynamic typing or even metaprogramming.
But the good news is that you don’t need to master all those right away in order to leverage a lot
of the productivity you can get out of Groovy.
© Catalysts GmbH
Why would I use it?
3- And it runs on the JVM
And it gets even further than that: Groovy is so Java-rooted that it actually compiles
to run on a Java runtime. Groovy code compiles into JVM bytecode, which means
you can still make Groovy and Grails applications run on your favorite application
server (simplest is Tomcat, but I’ve made it run on JBoss and even Weblogic) AND
you can reuse all the awesome libraries available in the Java ecosystem in an
instant.
Just plug your environment with your Maven or Ivy repository of choice, or copy
some JARs over and you’re good to go! How amazing is that?

© Catalysts GmbH
Why would I use it?
4- Groovy is not just for scripting
I mean sure, Groovy is great for system scripting, in the same way as Ruby and
Python are. Not everything needs to be a class so you can write scripts in no time.
But a lot of people use Groovy just for that, and think it’s not ready for prime-time
big-fuss applications yet
Yes, Groovy is a dynamic language, which also means that there is a lot less stuff
checked at compilation time than with mere Java, but since your code is much
more expressive, there is a lot less opportunity for errors too, and unit tests are a
lot easier to write, especially thanks to DSL’s.

© Catalysts GmbH
Why would I use it?
5- A very dynamic ecosystem
Every experienced developer knows that a good framework is nothing without good
documentation, serious support and a large community of contributors.
Well, of course Groovy and Grails have all that. First of all, they are part of the portfolio of
SpringSource, the very company that brought you the Spring Framework and that is now a
division of VMWare. The documentation is really good, like most Spring documentations by the
way, and there are some excellent books out there. As for helpers and contributors, whether it is
on the mailing list or on StackOverflow, helpers are everywhere.
And in terms of ecosystem: Grails has a plugin mechanism that makes it really easy to extend
the framework in a lot of different ways. Now I won’t lie, all of the available plugins are not
necessarily supported or kept up-to-date on the long run, but they are so easy to write and fix,
that it’s not really an issue.

© Catalysts GmbH
Why would I use it?
Liquibase integration

When you already have your application in production, you need a way to modify your db
automatically, thus Liquibase.

© Catalysts GmbH
Why would I use it?
5- A very dynamic ecosystem
Every experienced developer knows that a good framework is nothing without good
documentation, serious support and a large community of contributors.
Well, of course Groovy and Grails have all that. First of all, they are part of the portfolio of
SpringSource, the very company that brought you the Spring Framework and that is now a
division of VMWare. The documentation is really good, like most Spring documentations by the
way, and there are some excellent books out there. As for helpers and contributors, whether it is
on the mailing list or on StackOverflow, helpers are everywhere.
And in terms of ecosystem: Grails has a plugin mechanism that makes it really easy to extend
the framework in a lot of different ways. Now I won’t lie, all of the available plugins are not
necessarily supported or kept up-to-date on the long run, but they are so easy to write and fix,
that it’s not really an issue.

© Catalysts GmbH

More Related Content

PDF
9 steps to awesome with kubernetes
PDF
Spring Boot on Amazon Web Services with Spring Cloud AWS
PDF
Reactive Applications with Apache Pulsar and Spring Boot
PDF
Cloud Native Java:GraalVM
PDF
Spring Boot—Production Boost
PDF
Everything-as-code: DevOps und Continuous Delivery aus Sicht des Entwicklers.
PDF
GR8Conf 2011: Adopting Grails
PDF
Spring Cloud Function: Where We Were, Where We Are, and Where We’re Going
9 steps to awesome with kubernetes
Spring Boot on Amazon Web Services with Spring Cloud AWS
Reactive Applications with Apache Pulsar and Spring Boot
Cloud Native Java:GraalVM
Spring Boot—Production Boost
Everything-as-code: DevOps und Continuous Delivery aus Sicht des Entwicklers.
GR8Conf 2011: Adopting Grails
Spring Cloud Function: Where We Were, Where We Are, and Where We’re Going

What's hot (20)

PPT
Scripting Oracle Develop 2007
PDF
Spring5 New Features - Nov, 2017
PDF
Flux is incubating + the road ahead
PDF
Demystify LDAP and OIDC Providing Security to Your App on Kubernetes
PPTX
The Chef Prince of Azure - ChefConf 2015
PPTX
Containerizing ContentBox CMS
PDF
Spring boot wednesday
PDF
Introducing Spring Framework 5.3
PDF
Spring GraphQL
PDF
From Spring Framework 5.3 to 6.0
PDF
Migrating from Grails 2 to Grails 3
PDF
Cloud Native Java GraalVM 이상과 현실
PDF
Polyglot on the JVM with Graal (Japanese)
PDF
Building Distributed Systems with Netflix OSS and Spring Cloud
PDF
Leveraging Gradle @ Netflix (Madrid GUG Feb 2, 2021)
PDF
Cloud-Native Modernization or Death? A false dichotomy. | DevNation Tech Talk
PDF
Mete Atamel "Resilient microservices with kubernetes"
PDF
Rene Groeschke
PDF
TechEvent Graal(VM) Performance Interoperability
PPTX
Microsoft, java and you!
Scripting Oracle Develop 2007
Spring5 New Features - Nov, 2017
Flux is incubating + the road ahead
Demystify LDAP and OIDC Providing Security to Your App on Kubernetes
The Chef Prince of Azure - ChefConf 2015
Containerizing ContentBox CMS
Spring boot wednesday
Introducing Spring Framework 5.3
Spring GraphQL
From Spring Framework 5.3 to 6.0
Migrating from Grails 2 to Grails 3
Cloud Native Java GraalVM 이상과 현실
Polyglot on the JVM with Graal (Japanese)
Building Distributed Systems with Netflix OSS and Spring Cloud
Leveraging Gradle @ Netflix (Madrid GUG Feb 2, 2021)
Cloud-Native Modernization or Death? A false dichotomy. | DevNation Tech Talk
Mete Atamel "Resilient microservices with kubernetes"
Rene Groeschke
TechEvent Graal(VM) Performance Interoperability
Microsoft, java and you!
Ad

Similar to Magic with groovy & grails (20)

POT
intoduction to Grails Framework
ODP
Groovy and Grails intro
PPTX
One-stop solution for Grails web app development
PPTX
Introduction to Grails 2013
KEY
Introduction To Grails
PDF
Introduction To Groovy And Grails - SpringPeople
PPT
Fast web development using groovy on grails
PDF
Groovy - Grails as a modern scripting language for Web applications
PDF
Philip Stehlik at TechTalks.ph - Intro to Groovy and Grails
PPT
Introduction to Grails
PPT
Inrotograils 140211155206-phpapp01
PDF
Grails 3.0 Preview
PPT
Introduction to Grails
PPT
Groovygrails
PDF
Grails 101
PPT
GROOVY ON GRAILS
KEY
Polyglot Grails
PDF
Build your next application in weeks and not months with Groovy and Grails
PDF
Groovy grailstutorial
PPTX
Single-page applications and Grails
intoduction to Grails Framework
Groovy and Grails intro
One-stop solution for Grails web app development
Introduction to Grails 2013
Introduction To Grails
Introduction To Groovy And Grails - SpringPeople
Fast web development using groovy on grails
Groovy - Grails as a modern scripting language for Web applications
Philip Stehlik at TechTalks.ph - Intro to Groovy and Grails
Introduction to Grails
Inrotograils 140211155206-phpapp01
Grails 3.0 Preview
Introduction to Grails
Groovygrails
Grails 101
GROOVY ON GRAILS
Polyglot Grails
Build your next application in weeks and not months with Groovy and Grails
Groovy grailstutorial
Single-page applications and Grails
Ad

More from George Platon (6)

PPTX
Building strategies for success in startup ecosystem
PPTX
Open coffee tech 2nd meetup
PPTX
Caching solutions with Varnish
PPTX
Caching solutions with Redis
PPTX
Open coffee planning
PPTX
Open coffee planning
Building strategies for success in startup ecosystem
Open coffee tech 2nd meetup
Caching solutions with Varnish
Caching solutions with Redis
Open coffee planning
Open coffee planning

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Cloud computing and distributed systems.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Modernizing your data center with Dell and AMD
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Review of recent advances in non-invasive hemoglobin estimation
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Chapter 3 Spatial Domain Image Processing.pdf
The AUB Centre for AI in Media Proposal.docx
20250228 LYD VKU AI Blended-Learning.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Unlocking AI with Model Context Protocol (MCP)
Cloud computing and distributed systems.
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Monthly Chronicles - July 2025
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MYSQL Presentation for SQL database connectivity
Modernizing your data center with Dell and AMD
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The Rise and Fall of 3GPP – Time for a Sabbatical?

Magic with groovy & grails

  • 1. © Catalysts GmbH Magic with Groovy & Grails The Search is over © Catalysts GmbH
  • 2. What is Groovy? • Dynamic language • It can leverage Java's enterprise capabilities but also has cool productivity features like closures, builders and dynamic typing • 1.0 released on 02.01.2007 • Dynamically compiled to JVM bytecode • 99% of Java code is also valid • Groovy = Java + dynamic typing + additional methods & operators + closures © Catalysts GmbH
  • 3. Dynamic Typing Java ArrayList<String> list = new ArrayList<String>() { { Groovy add("A"); add("B"); add("C"); } }; HashMap<Integer, String> map = new HashMap<Integer, String>() { { put(1, "A"); put(2, "B"); put(3, "C"); } }; © Catalysts GmbH ?
  • 4. Dynamic Method Invocation class Dog { def bark() { println "woof!" } def sit() { println "(sitting)" } def jump() { println "boing!" } } def doAction( animal, action ) { animal."$action"() //action name is passed at invocation } def rex = new Dog() doAction( rex, "bark" ) //prints 'woof!' doAction( rex, "jump" ) //prints 'boing!' © Catalysts GmbH
  • 5. Additional Operators • Spread *. parent*.action //equivalent to: parent.collect{ child -> child?.action } • Elvis ?: assert ['cat', 'elephant']*.size() == [3, 8] • Safe navigation ?. • Equals == © Catalysts GmbH
  • 6. Closures “A Groovy Closure is like a ‘code block’ or a method pointer. It is a piece of code that is defined and then executed at a later point.” http://groovy.codehaus.org/Closures © Catalysts GmbH
  • 7. Functional Programming(1) • Closures as functions def multiply = { x, y -> return x * y } println multiply.call(3, 4) def triple = {x -> return 3*x } • Closures as function compositions //like LISP, Haskell lambda functions def composition = { f, g, x, y-> return f(g(x, y)) } composition.call(triple, multiply, 5, 6) © Catalysts GmbH
  • 8. Functional Programming(2) • Fibonacci def fibonacci fibonacci = { n -> n <= 1 ? n : fibonacci(n-1) + fibonacci(n-2) }.memoize() println fibonacci.call(35) © Catalysts GmbH
  • 9. What is Grails? Grails is a full stack framework and attempts to solve as many pieces of the web development puzzle through the core technology and its associated plugins. Included out the box are things like: 1. An easy to use Object Relational Mapping (ORM) layer built on Hibernate 2. An expressive view technology called Groovy Server Pages (GSP) ~ JSP 3. A controller layer built on Spring MVC 4. A command line scripting environment built on the Groovy-powered Gant 5. An embedded Tomcat container which is configured for on the fly reloading 6. Dependency injection with the inbuilt Spring container 7. Support for internationalization (i18n) built on Spring's core MessageSource concept 8. A transactional service layer built on Spring's transaction abstraction All of these are made easy to use through the power of the Groovy language and the extensive use of Domain Specific Languages (DSLs) © Catalysts GmbH
  • 10. What is Grails? • Web application framework • Convention over configuration • Spring MVC • Fast prototyping and development © Catalysts GmbH
  • 11. Convention over configuration This typically means that the name and location of files is used instead of explicit configuration © Catalysts GmbH
  • 14. What does all these means?(1) What does mean all these features of Grails? 1. An easy to use Object Relational Mapping (ORM) layer built on Hibernate That means that you just have to define your domain classes, with all the attributes that you want. These domain classes will be automatically mapped by Hibernate to tables inside the database you have specified in Datasource.groovy, and the domain class attributes will be mapped to table fields. Having this domain classes mapped, you can now perform all CRUD operations on them, with the usage of dynamic methods added by GORM to the domain classes such as “save(), delete(), findAll, findAllBy, findAllWhere, count etc.” These dynamic methods instantly boost your productivity since you dont have to worry anymore about writing sql queries or managing the data layer. Grails does all of these for you! (* however if you still want to customize how things are mapped, sql queries, you can dive into the deep of Hibernate configs) © Catalysts GmbH
  • 15. 2. An expressive view technology called Groovyall these features of Grails? (GSP) Server Pages What does mean Groovy Servers Pages (or GSP for short) is Grails' view technology. It is designed to be familiar for users of technologies such as ASP and JSP, but to be far more flexible and intuitive. You can be more flexible because you can use groovy code inside the pages, that is executed before the page is sent, or use specific reusable componets - taglibs. © Catalysts GmbH
  • 16. 3. A controller layer built on Spring MVC Controllers are the classes that responds and handle requests from the front-end. A controller can generate the response directly or delegate it to a view. Controller methods and views are tightened together, thus a controller method called “search” will by default render the view “search”. © Catalysts GmbH
  • 17. 4. A command line scripting environment built on the Groovy-powered Gant That means that you can use groovy console to run the application, the tests, install plugins and so on. © Catalysts GmbH
  • 18. 5. An embedded Tomcat container which is configured for on the fly reloading Grails provides an embedded Tomcat instance, where your application is deployed automatically when you want it to run. This means that you don't have to worry about a separate Tomcat container and deploy configurations that takes time. Also, you can make changes to your application on the fly, without the need to redeploy the app. However, when changing domain classes, the database will change too, so the application has to be deployed again. © Catalysts GmbH
  • 19. 6. Dependency injection with the inbuilt Spring container Grails leverages Spring MVC in the following areas: Basic controller logic - Grails subclasses Spring's DispatcherServlet and uses it to delegate to Grails controllers Data Binding and Validation - Grails' validation and data binding capabilities are built on those provided by Spring Runtime configuration - Grails' entire runtime convention based system is wired together by a Spring ApplicationContext Transactions - Grails uses Spring's transaction management in GORM In other words Grails has Spring embedded running all the way through it. © Catalysts GmbH
  • 20. 7. Support for internationalization (i18n) built on Spring's core MessageSource This means that your application can be written in as many languages as you want. All you have to do is to use specific codes for each message that you use, and provide different translations for these codes. You can split and organise your language files as you like. © Catalysts GmbH
  • 21. 8. A transactional service layer built on Spring's transaction abstraction The Grails team discourages the embedding of core application logic inside controllers, as it does not promote reuse and a clean separation of concerns. Services in Grails are the place to put the majority of the logic in your application, leaving controllers responsible for handling request flow with redirects and so on. Services are transactional by default. This means that if an operation on the database fails, and this operations is performed in a service, that operation will be automatically rolled back due to default transactional behaviour of services. © Catalysts GmbH
  • 22. Why would I use it? 1- Grails is Spring and Hibernate Grails was a good replacement for vanilla Spring/Hibernate, but it’s even better. In the real world it means that you can bootstrap a new project very quickly by using default settings, but you have all the power of Spring and Hibernate under the hood. If you really need to do some really specific stuff, you can easily go into deep of configurations. The best of both worlds! And it also means that you can use all the Spring modules you already love and integrate with all the databases you are used to, without any problem. You just have to define your domain classes and with the usage of dynamic scaffolding your application is ready to go with all the CRUD operations (views, controllers ) already implemented. © Catalysts GmbH
  • 23. Why would I use it? 2- Groovy is actually Java Java is a statically-typed language and it was designed to be, because it’s just easier to understand. But recently, we have all come to envy the expressivity and power of dynamic languages like Ruby and Python. The problem is that they are completely new languages, which means 2 things: the learning curve is pretty steep, and it’s hard to find good developers for those languages. Well, fear no more, because Groovy is here to save you. Groovy is essentially a superset of Java as a language, which means that you don’t need to learn an entirely new language, and it’s really easy to turn any Java developer into a Groovy developer. Sure Groovy offers much more than Java in terms of power, and it can take some time to get a good grasp of all the ins and outs of closures, dynamic typing or even metaprogramming. But the good news is that you don’t need to master all those right away in order to leverage a lot of the productivity you can get out of Groovy. © Catalysts GmbH
  • 24. Why would I use it? 3- And it runs on the JVM And it gets even further than that: Groovy is so Java-rooted that it actually compiles to run on a Java runtime. Groovy code compiles into JVM bytecode, which means you can still make Groovy and Grails applications run on your favorite application server (simplest is Tomcat, but I’ve made it run on JBoss and even Weblogic) AND you can reuse all the awesome libraries available in the Java ecosystem in an instant. Just plug your environment with your Maven or Ivy repository of choice, or copy some JARs over and you’re good to go! How amazing is that? © Catalysts GmbH
  • 25. Why would I use it? 4- Groovy is not just for scripting I mean sure, Groovy is great for system scripting, in the same way as Ruby and Python are. Not everything needs to be a class so you can write scripts in no time. But a lot of people use Groovy just for that, and think it’s not ready for prime-time big-fuss applications yet Yes, Groovy is a dynamic language, which also means that there is a lot less stuff checked at compilation time than with mere Java, but since your code is much more expressive, there is a lot less opportunity for errors too, and unit tests are a lot easier to write, especially thanks to DSL’s. © Catalysts GmbH
  • 26. Why would I use it? 5- A very dynamic ecosystem Every experienced developer knows that a good framework is nothing without good documentation, serious support and a large community of contributors. Well, of course Groovy and Grails have all that. First of all, they are part of the portfolio of SpringSource, the very company that brought you the Spring Framework and that is now a division of VMWare. The documentation is really good, like most Spring documentations by the way, and there are some excellent books out there. As for helpers and contributors, whether it is on the mailing list or on StackOverflow, helpers are everywhere. And in terms of ecosystem: Grails has a plugin mechanism that makes it really easy to extend the framework in a lot of different ways. Now I won’t lie, all of the available plugins are not necessarily supported or kept up-to-date on the long run, but they are so easy to write and fix, that it’s not really an issue. © Catalysts GmbH
  • 27. Why would I use it? Liquibase integration When you already have your application in production, you need a way to modify your db automatically, thus Liquibase. © Catalysts GmbH
  • 28. Why would I use it? 5- A very dynamic ecosystem Every experienced developer knows that a good framework is nothing without good documentation, serious support and a large community of contributors. Well, of course Groovy and Grails have all that. First of all, they are part of the portfolio of SpringSource, the very company that brought you the Spring Framework and that is now a division of VMWare. The documentation is really good, like most Spring documentations by the way, and there are some excellent books out there. As for helpers and contributors, whether it is on the mailing list or on StackOverflow, helpers are everywhere. And in terms of ecosystem: Grails has a plugin mechanism that makes it really easy to extend the framework in a lot of different ways. Now I won’t lie, all of the available plugins are not necessarily supported or kept up-to-date on the long run, but they are so easy to write and fix, that it’s not really an issue. © Catalysts GmbH