SlideShare a Scribd company logo
www.devoxx.com
Groovy & Grails in Action!

     Guillaume Laforge
     Groovy Project Manager


     Head of Groovy Development



                 www.devoxx.com
Overall Presentation Goal

Discover the Groovy dynamic language for the JVM
 Understand how you can create DSLs in Groovy
 Getting productive with the Grails agile web stack




                       www.devoxx.com
Guillaume Laforge
 Groovy Project Manager
 JSR-241 Spec Lead
 Head of Groovy Development
 at SpringSource
 Initiator of the Grails framework
 Co-author of Groovy in Action
 Speaker at numerous conferences
  JavaOne, QCon, JavaZone, Sun TechDays, JavaPolis,
  The Spring Experience, JAX, Dynamic Language World...

  4                         www.devoxx.com
G2One / SpringSource
 Back in 2007, Graeme Rocher and Guillaume Laforge
 created G2One, the Groovy/Grails company
 Professional services
      consulting, expertise, training, support
 Last november, SpringSource acquired G2One




  5                            www.devoxx.com
Groovy in Action

     A bit of history and background
           Groovy syntax basics
         Interesting Groovy APIs
      Domain-Speciļ¬c Languages
       Whatā€™s new in Groovy 1.6?
         The Groovy Ecosystem


                  www.devoxx.com
James Strachan to Bob McWhirter in 2003:
        Wouldnā€™t it be ā€œgroovyā€ if we could have
       native syntax for lists, maps and regexs
        in Java like in most scripting languages?
             Wouldnā€™t it be ā€œgroovyā€ if we
           could have duck typing in Java?
           Wouldnā€™t it be ā€œgroovyā€ if we had
           closures and properties in Java?




                        www.devoxx.com
Groovy agenda
 A bit of history and
 background
 Syntax basics
 Interesting Groovy APIs
 Domain-Speciļ¬c Languages
 Whatā€™s new in Groovy 1.6?
 The Groovy ecosystem



                        www.devoxx.com
Groovy is...
 Groovy is a dynamic language for the JVM
 Groovy directly compiles down to bytecode
 Inspired by other languages: Python, Ruby, Smalltalk
 Whose goal is to simplify the life of developers
 Apache 2 licensed Open Source project
 hosted at Codehaus
 Grammar directly deriving from the Java 5 language
 support for annotations, generics, enums, static imports

  9                       www.devoxx.com
Groovy is everywhere
 Integrated in Open Source projects
 Spring, JBoss SEAM, ServiceMix, Mule, Oracle OC4J
 Integrated in mission-critical applications
 Mutual of Omaha, US Fortune 500 insurance company
 US National Cancer Institute
 Integrated in commercial products
 IBM WebSphere Smash, SAP Composition on Grails
 Oracle Data Integrator, Oracle Fusion (ADF)

  10                      www.devoxx.com
Lots of books to read




 11           www.devoxx.com
Features at a glance
 Totally object-oriented
 Optional typing
 No need to wait for Java 7 / 8 / 9:
  Closures: reusable / assignable code blocks
  Properties: auto-generated getters / setters
 Multimethods: call the right method for the right type
 BigDecimal arithmetics
 Useful wrapper APIs: SQL, XML, Swing, templates, JMX...

  12                        www.devoxx.com
Java integration
 Groovy generates Java bytecode for the JVM
 Same strings, same regex
 Same APIs ā€” JDK, collections, 3rd party, etc.
 Same security model, same threading model
 Same OO concepts                         JInterface    GInterface

 Joint-compilation                   <<implements>>    <<implements>>


                                           GClass         JClass




                                           JClass         GClass

  13                     www.devoxx.com
Letā€™s get started
 Go to http://groovy.codehaus.org/Download
 Download the latest version
 Groovy 1.5.7 ā€” maintenance branch
 Groovy 1.6-beta-2 ā€” soon to be released
 Unzip the archive, set GROOVY_HOME
 Add $GROOVY_HOME/bin to your path


 Youā€™re ready!

  14                      www.devoxx.com
Tools at your disposal
 Shell and console: groovysh and groovyConsole
 An Ant task, a Maven plugin (GMaven)
 A joint compiler
 Lets you compile both Groovy and Java together!
 IDE support




  15                     www.devoxx.com
DEMO
Groovy shell
Groovy console




                 www.devoxx.com
Groovy agenda
 A bit of history and
 background
 Syntax basics
 Interesting Groovy APIs
 Domain-Speciļ¬c Languages
 Whatā€™s new in Groovy 1.6?
 The Groovy ecosystem



                        www.devoxx.com
A Java program
public class HelloWorld {
     private String name;

          public void setName(String name) {
              this.name = name;
          }

          public String getName() {
              return name;
          }

          public String greet() {
              return quot;Hello quot;+ name;
          }

          public static void main(String[] args) {
              HelloWorld helloWorld = new HelloWorld();
              helloWorld.setName(quot;Groovyquot;);
              System.out.println( helloWorld.greet() );
          }
 }


     18                                www.devoxx.com
A Groovy program
public class HelloWorld {
     private String name;

          public void setName(String name) {
              this.name = name;
          }

          public String getName() {
              return name;
          }

          public String greet() {
              return quot;Hello quot;+ name;
          }

          public static void main(String[] args) {
              HelloWorld helloWorld = new HelloWorld();
              helloWorld.setName(quot;Groovyquot;);
              System.out.println( helloWorld.greet() );
          }
 }


     19                                www.devoxx.com
DEMO
From Java to Groovy




                      www.devoxx.com
A groovier version

 class HelloWorld {
     String name
     String greet() { quot;Hello $namequot; }
 }

 def helloWorld = new HelloWorld(name: quot;Groovyquot;)
 println helloWorld.greet()




 21                   www.devoxx.com
Native syntax constructs
 Lists
  def numbers = [1, 2, 3, 4, 5]
 Maps
  def map = [FR: ā€œFranceā€, BE: ā€œBelgiumā€]
 Ranges
  def allowedAges = 18..65

 Regular expressions
  def whitespace = ~/s+?/

  22                   www.devoxx.com
Groovy Strings	
 GStrings: interpolated strings
  def person = ā€œJohnā€
  def letter = ā€œā€œā€œ${new Date()}
      Dear ${person},
      this is a Groovy letter!ā€ā€ā€
  println letter
 Multiline strings: triple single or double quotes
 Slashy syntax
  def whitespace = ~/s+?/


  23                        www.devoxx.com
Closures
 A reusable / assignable block of code
 delimited by curly braces
 can take parameters
 can be passed as parameters to methods, or inline
 def printer = { println it }
 def double = { int i -> 2 * i }
 new File(ā€œf.txtā€).eachLine { line ->
     println line
 }
 new File(ā€œf.txtā€).eachLine( printer )

  24                         www.devoxx.com
Time savers
 The Groovy Truth
  def blank = ā€œā€; assert !blank
  def empty = []; assert !empty
 Safe graph navigation
  def order = null
  assert order?.customer?.address == null
 Elvis operator
  def name = customer.name ?: ā€œUnknownā€



  25                     www.devoxx.com
Java 5 features
 Since Groovy 1.5
 Annotations, generics, static imports, enums, varargs


 You can leverage frameworks supporting annotations
 Spring, Hibernate, Guice, JPA, EJB3, TestNG, and more


 Sole dynamic language supporting annotations



  26                      www.devoxx.com
Annotation example
 @Entity
 @Name(ā€œhotelā€)
 class Hotel implements Serializable {
     @Id @GeneratedValue
     Long id

      @Length(max = 40) @NotNull
      String name

      @Override String toString() {
          ā€œHotel ${name}ā€
      }
 }

 27                  www.devoxx.com
Groovy agenda
 A bit of history and
 background
 Syntax basics
 Interesting Groovy APIs
 Domain-Speciļ¬c Languages
 Whatā€™s new in Groovy 1.6?
 The Groovy ecosystem



                        www.devoxx.com
The GDK ā€” Groovy Dev Kit
 Groovy ā€œdecoratesā€ existing JDK APIs
 We canā€™t extend java.lang.String or java.io.File, can we?
 new File(ā€œf.txtā€).eachLine { println it }
 (1..100).findAll { it % 2 == 1 }
 speakers.groupBy { it.lastname }
 ā€œ123ā€.padLeft(5, ā€˜0ā€™)
 ā€œls -laā€.execute()
 ā€œR3Jvb3Z5IHJvY2tzIQ==ā€.decodeBase64()
 Thread.start { /* code to be executed */ }


  29                      www.devoxx.com
JDBC made easy
With transparent resource handling, thanks to closures
 def sql = Sql.newInstance(url, usr, pwd, driver)
 sql.execute(quot;insert into table values ($foo, $bar)quot;)
 sql.execute(quot;insert into table values(?,?)quot;, [a, b])
 sql.eachRow(quot;select * from USERquot;) { print it.name }
 def list = sql.rows(quot;select * from USERquot;)




A poor-manā€™s dataset notion
 def set = sql.dataSet(quot;USERquot;)
 set.add(name: quot;Johnnyquot;, age: 33)
 set.each { user -> println user.name }
 set.findAll { it.age > 22 && it.age < 42 }




 30                        www.devoxx.com
Parsing XML
 With this multiline string XML fragment
       def xml = quot;quot;quot;
       <languages>
         <language name=quot;Groovyquot;>
           <feature coolness=quot;lowquot;>SQL</feature>
           <feature coolness=quot;highquot;>Template</feature>
         </language>
         <language name=quot;Perlquot;/>
       </languages>quot;quot;quot;

 Navigate your XML graph as an object graph!
       def root = new XmlParser().parseText(xml)
       println root.language.feature[1].text()

       root.language.feature
           .findAll{ it['@coolness'] == quot;lowquot; }
            .each{ println it.text() }

  31                            www.devoxx.com
Producing XML too!
 The same XML document as before
 new MarkupBuilder().languages {
     language(name: quot;Groovyquot;) {
         feature(coolness: quot;lowquot;, quot;SQLquot;)
         feature(coolness: quot;highquot;, quot;Templatequot;)
     }
     language(name: quot;Perlquot;)
 }




  32                       www.devoxx.com
Swing builder
 Following the same ā€œbuilder patternā€, but for Swing
 import javax.swing.WindowConstants as WC
 import groovy.swing.SwingBuilder
 def theMap = [color: quot;greenquot;, object: quot;pencilquot;]
 def swing = new SwingBuilder()
 def frame = swing.frame(
     title: 'A Groovy Swing', location: [240,240],
     defaultCloseOperation:WC.EXIT_ON_CLOSE) {
     panel {
         for (entry in theMap) {
              label(text: entry.key)
              textField(text: entry.value)
         }
         button(text: 'About', actionPerformed: {
              def pane = swing.optionPane(message: 'SwingBuilder')
              def dialog = pane.createDialog(null, 'About')
              dialog.show()
         })
         button(text:'Quit', actionPerformed:{ System.exit(0) })
     }
 }
 frame.pack()
 frame.show()
  33                               www.devoxx.com
Swing builder
 Following the same ā€œbuilder patternā€, but for Swing
 import javax.swing.WindowConstants as WC
 import groovy.swing.SwingBuilder
 def theMap = [color: quot;greenquot;, object: quot;pencilquot;]
 def swing = new SwingBuilder()
 def frame = swing.frame(
     title: 'A Groovy Swing', location: [240,240],
     defaultCloseOperation:WC.EXIT_ON_CLOSE) {
     panel {
         for (entry in theMap) {
              label(text: entry.key)
              textField(text: entry.value)
         }
         button(text: 'About', actionPerformed: {
              def pane = swing.optionPane(message: 'SwingBuilder')
              def dialog = pane.createDialog(null, 'About')
              dialog.show()
         })
         button(text:'Quit', actionPerformed:{ System.exit(0) })
     }
 }
 frame.pack()
 frame.show()
  33                               www.devoxx.com
Another builder with Ant
 Reuse the wealth of Ant tasks for your build or system
 scripting needs
 // create sequantial Ant execution
 new AntBuilder().sequential {
     def buildClasses = ā€œbuild/classesā€

       // create classes directory
       mkdir(dir: buildClasses)

       // compile sources
       javac(srcdir: ā€œsrcā€,
            destdir: buildClasses)

       // jar everything
       jar(destfile: ā€œmy.jarā€,
            basedir: buildClasses)
 }


  34                         www.devoxx.com
Groovy agenda
 A bit of history and
 background
 Syntax basics
 Interesting Groovy APIs
 Domain-Speciļ¬c Languages
 Whatā€™s new in Groovy 1.6?
 The Groovy ecosystem



                        www.devoxx.com
Whatā€™s a DSL?
 A Domain-Speciļ¬c Language is a small language
 designed to be useful for a speciļ¬c set of tasks, for a
 given domain
 Not necessarily Turing-complete
 Produces some result
  conļ¬guration, data structures, simulation declarations...
 Can be internal or external
 Has a form: textual or visual


  36                       www.devoxx.com
Some examples
Technical
 SELECT * FROM USERS WHERE NAME LIKE ā€˜Guil%ā€™
 ^[w-.]+@([w-]+.)+[w-]{2,4}$
Notation
 1. e4 e5 2. Nf3 Nc6 3. Bb5 a6
 U Rā€™ U2 R U Rā€™ U R
Business oriented
 Risk calculation for insurance policies
 Human Resources employee skills representation
 Anti-malaria drug resistance simulation
 37                         www.devoxx.com
Towards more readability (1/2)




 38           www.devoxx.com
Towards more readability (1/2)




 38           www.devoxx.com
Towards more readability (1/2)




                               20%




 38           www.devoxx.com
Towards more readability (2/2)




 39           www.devoxx.com
Towards more readability (2/2)




 39           www.devoxx.com
Towards more readability (2/2)




                               80%




 39           www.devoxx.com
Groovyā€™s MOP to the rescue
 DSLs are possible in Groovy because of
 Groovyā€™s malleable syntax and APIs
       Omitting parentheses, semi-columns
       Named arguments, Closures
       Everything is an object
 Groovyā€™s dynamic nature
       MOP: Meta-Object Protocol
        Nothing hard-wired,
        behavior modiļ¬able at runtime!
  40                             www.devoxx.com
Parentheses & named args
 Optional parentheses
 move left
 Named arguments
 compare fund: ā€˜XYZā€™, withIndicator: ā€˜NIKEIā€™
 account.debit amount: 30.euros, in: 3.days
 Plus native syntax elements
 Lists: [NIKEI, CAC40, NASDAK]
 Maps: [CA: ā€˜Californiaā€™, CO: ā€˜Coloradoā€™]
 Ranges: Monday..Friday
  41                      www.devoxx.com
DEMO
Adding properties to
numbers
Categories
ExpandoMetaClass




                       www.devoxx.com
Operator overloading
Operators are a shorcut
for method calls
a + b == a.plus(b)

a - b == a.minus(b)

a * b == a.multiply(b)

a / b == a.divide(b)

a % b == a.modulo(b)

a | b == a.or(b)

a & b == a.and(b)

a[b] == a.getAt(b)

a << b == a.leftShift(b)
  43                       www.devoxx.com
Operator overloading
Operators are a shorcut     Currency arithmetics
for method calls
                                    30.euros + 15.dollars
a + b == a.plus(b)
                            Distances
a - b == a.minus(b)

a * b == a.multiply(b)              12.kilometers + 3.meters
a / b == a.divide(b)           Parallelism or workļ¬‚ow
a % b == a.modulo(b)
                                  taskA & taskB | taskC
a | b == a.or(b)
                               Banking
a & b == a.and(b)

a[b] == a.getAt(b)                account += 10.euros
a << b == a.leftShift(b)
  43                       www.devoxx.com
Closures and builders
 Remember the builder pattern? Ant, Swing, Markup...
 You can easily create your own
 Extend BuilderSupport or FactoryBuilderSupport
 Nested method calls with closures as last argument
 plan {
     artifact {
         name = ā€˜spring.coreā€™
         type = ā€˜bundleā€™
         version = ā€˜2.5.6ā€™
     }
 }
  44                      www.devoxx.com
Why creating your own DSL?
 Use a more expressive language than a general purpose
 Share a common metaphore between developers and
 subject matter experts
 Have domain experts help with the design of the
 business logic of an application
 Avoid cluttering business code with too much boilerplate
 technical code
 Cleanly separate business logic from application code
 Let business rules have their own lifecycle

  45                       www.devoxx.com
Groovy agenda
 A bit of history and
 background
 Syntax basics
 Interesting Groovy APIs
 Domain-Speciļ¬c Languages
 Whatā€™s new in Groovy 1.6?
 The Groovy ecosystem



                        www.devoxx.com
Groovy 1.6
 Main focus on performance
 to make Groovy the fastest dynamic language
 Multiple assignment
 def (a, b) = [1, 2]
 def (int i, String s) = [1, ā€˜Groovyā€™]
 (a, b) = functionReturningAList()
 AST Transformations
 @Lazy, @Immutable, @Singleton, @Delegate
 Annotation deļ¬nition

  47                    www.devoxx.com
Groovy agenda
 A bit of history and
 background
 Syntax basics
 Interesting Groovy APIs
 Domain-Speciļ¬c Languages
 Whatā€™s new in Groovy 1.6?
 The Groovy ecosystem



                        www.devoxx.com
More than just Groovy...
 First major Groovy child: Grails, but thereā€™s more...
  Griffon: a Grails-like MVC framework for building rich
  Swing applications
  Gradle: a new build system learning from the good ideas
  and mistakes of Ant, Maven and Ivy
  Easyb: a Behavior Driven Development toolkit which lets
  you write user stories with a Groovy DSL


 All three will be presented at Devoxx, check your agenda!

  49                        www.devoxx.com
Groovy Summary
The Groovy dynamic language for the JVM simpliļ¬es the
life of developers
Groovy opens up some interesting perspectives towards
extending and enhancing your applications
Groovy provides the most seamless Java integration
experience
Groovy lets you create Domain-Speciļ¬c Languages
Groovy protects your investment in skills, tools, libraries
and application servers


 50                       www.devoxx.com
Grails in Action

          A bit of history and background
                   The Grails stack
           Getting started with scaffolding
The layers: persistence, controllers & services, views
                The plugin ecosystem
              Whatā€™s new in Grails 1.1?


                        www.devoxx.com
Grails agenda
 A bit of history and
 background
 The Grails stack
 Getting started with
 scaffolding
 The various layers
 The plugin ecosystem
 Whatā€™s new in Grails 1.1?


                        www.devoxx.com
Guillaume Laforge on the Groovy lists in 2005:
    Ruby on Rails is all the rage these days, but you
 compromise on your past investment, if youā€™re a Java
 shop: developer and IT team skills, training, app servers,
      the great JVM platform, third-party libraries...
Canā€™t we leverage Groovy and proven technologies like
 Spring and Hibernate to bring the ā€œConvention over
 Conļ¬gurationā€ paradigm on the Java platform, without
           compromising on your investment?




                          www.devoxx.com
The Holy Grail(s)
 Observation: lack of productivity in webapp development
 We have all the tools at our disposal to change that
 Back in 2005, Graeme Rocher, Steven Devijsver and
 myself launched Grails
  Apache licensed OSS project, hosted at Codehaus
 Goal similar to Groovy: simplify the life of developers
 So whatā€™s under the hood?




  54                       www.devoxx.com
Grails agenda
 A bit of history and
 background
 The Grails stack
 Getting started with
 scaffolding
 The various layers
 The plugin ecosystem
 Whatā€™s new in Grails 1.1?


                        www.devoxx.com
From 10,000 feet
 Grails is an MVC action-based framework


 Grails follows good principles popularized by Rails
 CoC: Convention over Conļ¬guration
 DRY: Donā€™t Repeat Yourself


 The essence of Rails but with tight integration with the
 Java platform to protect your investment!


  56                       www.devoxx.com
From 1,000 feet



             =
       +                      +

 57          www.devoxx.com
Near the ground...
 Grails is built on rock-solid and proven technologies
 the JVM, the Java EE specs, existing app servers, and...
       Spring: IoC, DI, Spring MVC, Spring WebFlow
       Hibernate: Object-Relational Mapping
       SiteMesh: page layout and composition
       Quartz: for job scheduling
       Jetty and HSQLDB: for fast development cycles
 Productive out of the box with a full development stack

  58                           www.devoxx.com
Grails agenda
 A bit of history and
 background
 The Grails stack
 Getting started with
 scaffolding
 The various layers
 The plugin ecosystem
 Whatā€™s new in Grails 1.1?


                        www.devoxx.com
First step, download & install
 Go to http://grails.org/Download
 Download the latest archive
 Unzip it somewhere
 Create GRAILS_HOME
 Add $GRAILS_HOME/bin to your PATH


 Youā€™re ready to go!
 Next step: grails create-app

  60                      www.devoxx.com
DEMO
Getting started
with scaffolding


Remember scaffolding is nice for CRUD,
admin interfaces, prototyping, getting up
and running quickly, but Grails is more
than just a CRUD framework!




                                  www.devoxx.com
Layout and naming convention




 62          www.devoxx.com
Did you notice?
Where are my conļ¬guration ļ¬les?
Why havenā€™t I written any XML ļ¬le?
Where are my DAOs?
Where are my mapping ļ¬les?
No database to conļ¬gure?
Nor a servlet container or
app server to install?
Or tons of jars to download
from Maven repositories?
There must be some magic under the hood :-)
                              www.devoxx.com
Grails agenda
 A bit of history and
 background
 The Grails stack
 Getting started with
 scaffolding
 The various layers
 The plugin ecosystem
 Whatā€™s new in Grails 1.1?


                        www.devoxx.com
The usual problems
 When you start a project, you have to setup everything
  The build, wire all components together


 You suffer from impedance mismatch
  You have to handle the ORM mapping manually


 Itā€™s hard to write clean views
  Taglibs are a pain to develop

  65                        www.devoxx.com
Persistence
 Enters GORM: Grails Object Relational Mapping
 Hibernate under the hood
 Your domain model is a set of POGOs
 Your domain classes are transparentely mapped
 Although you can use legacy schemas with GORM DSL
 No conf: hibernate.cfg.xml, no *.hbm.xml ļ¬les!
 But you can bring your own existing ones if needed
 Always a path to conļ¬guration when in need

  66                      www.devoxx.com
Persistence
 Enters GORM: Grails Object Relational Mapping
 Hibernate under the hood                  Not limited by
 Your domain model is a set of POGOs       conventions?

 Your domain classes are transparentely mapped
 Although you can use legacy schemas with GORM DSL
 No conf: hibernate.cfg.xml, no *.hbm.xml ļ¬les!
 But you can bring your own existing ones if needed
 Always a path to conļ¬guration when in need

  66                      www.devoxx.com
Dynamic ļ¬nders
 All domain classes have got injected methods like
 Book.count(), Book.list(), Book.get(id)
 book.save(), book.delete(), etc...
 Dynamic ļ¬nders
 Book.findByTitle(ā€œHarry Potterā€)
 Book.findAllByAuthorLike(ā€œ%Rowlinsā€)
 Book.findAllByTitleLikeAndReleaseDateLessThan(
     ā€˜%Grails%ā€™, 2007
 ) // donā€™t do that :-)




  67                       www.devoxx.com
Dynamic ļ¬nders
 All domain classes have got injected methods like
 Book.count(), Book.list(), Book.get(id)
 book.save(), book.delete(), etc...
 Dynamic ļ¬nders
 Book.findByTitle(ā€œHarry Potterā€)
 Book.findAllByAuthorLike(ā€œ%Rowlinsā€)
 Book.findAllByTitleLikeAndReleaseDateLessThan(
     ā€˜%Grails%ā€™, 2007
 ) // donā€™t do that :-)


                                            Whereā€™s
                                            my DAO?

  67                       www.devoxx.com
Queries
 You can use raw HQL queries
 Book.ļ¬nd(ā€œfrom Book b where b.title = ?ā€, [ā€˜Shiningā€™])


 Grails wraps the Hibernate Criteria API
 def results = Account.list {
     like ā€œholderFirstNameā€, ā€œFred%ā€
     and {
         between ā€œbalanceā€, 500, 1000
         eq ā€œbranchā€, ā€œLondonā€
     }
     order ā€œholderLastNameā€, ā€œdescā€
 }



  68                       www.devoxx.com
Constraints
 Constraints can be added to domain classes
 through a static constraints ļ¬eld
 static constraints = {
     isbn matches: /[0-9]{9}[0-9X]/
 }
 Many constraints available
 blank, creditcard, email, nullable, matches, range, unique
 Create your own validator
 myIntField = { it % 2 == 0 }
 You can also register your own constraints
  69                         www.devoxx.com
Controllers
 In the controller directory, name ending with Controller
  http://myserver:8080/app/controller/action
 Handy things at your disposal
  redirect, chain, render, ļ¬‚ash scope
 Controllers return Maps as models for the view to render
  Possible access to the raw output stream
 Easy databinding from form ļ¬elds
  book.properties = params

  70                        www.devoxx.com
Controllers
 In the controller directory, name ending with Controller
  http://myserver:8080/app/controller/action
                                                        a d
 Handy things at your disposal
                                                  e lo
  redirect, chain, render, ļ¬‚ash scope          R
 Controllers return Maps as models for the view to render
  Possible access to the raw output stream
 Easy databinding from form ļ¬elds
  book.properties = params

  70                        www.devoxx.com
Services
 Another naming convention and placement


 Transactional by default


 Just declare your service, itā€™ll be transparently injected!
  no need to conļ¬gure it in some XML ļ¬‚e




  71                         www.devoxx.com
The view tier
 The view tier is essentially composed of two things
 The Groovy Server Pages
       Similar to JSPs
       But with GString interpolation
 The Grails Tag Libraries
       Useful existing tag libraries
       So easy to write your own!
 Templates, URL mapping, conversations and more

  72                             www.devoxx.com
GSPs
  Auto-reloading
<html>
    <head>
        <meta name=quot;layoutquot; content=quot;mainquot; />
        <title>Book List</title>
    </head>
    <body>
        <a href=quot;${createLinkTo(dir:'')}quot;>Home</a>
        <g:link action=quot;createquot;>New Book</g:link>
        <g:if test=quot;${flash.message}quot;>
            ${flash.message}
        </g:if>
        <g:each in=quot;${bookList}quot;>${it.title}</g:each>
    </body>
</html>




    73                        www.devoxx.com
GSPs
  Auto-reloading
<html>
                                                            a d
    <head>
                                                        e lo
                                                   R
        <meta name=quot;layoutquot; content=quot;mainquot; />
        <title>Book List</title>
    </head>
    <body>
        <a href=quot;${createLinkTo(dir:'')}quot;>Home</a>
        <g:link action=quot;createquot;>New Book</g:link>
        <g:if test=quot;${flash.message}quot;>
            ${flash.message}
        </g:if>
        <g:each in=quot;${bookList}quot;>${it.title}</g:each>
    </body>
</html>




    73                        www.devoxx.com
Taglibs
 Lots of existing taglibs
  Logical: if, else, elseif
  Iterative: each, collect, ļ¬ndAll
  Linking: createLink, createLinkTo
  Ajax: remoteLink, remoteForm, remoteFunction
  Form: select, datePicker, currencySelect
  Validation: hasError, eachError
  UI: rich text editor

  74                          www.devoxx.com
Create your own taglib
 Yet another Grails convention
 class MyTaglib {
     def isAdmin = { attrs, body ->
         def user = attrs[ā€˜userā€™]
         if (user && checkUserPrivs(user)) {
             body()
         }
     }
 }

 Use it in your GSP
 <g:isAdmin user=ā€${user}ā€>
     Some restricted content
  75                      www.devoxx.com
Create your own taglib
 Yet another Grails convention
 class MyTaglib {
     def isAdmin = { attrs, body ->
         def user = attrs[ā€˜userā€™]
         if (user && checkUserPrivs(user)) {
             body()
         }
     }
                                                a d
 }
                                            e lo
 Use it in your GSP                        R
 <g:isAdmin user=ā€${user}ā€>
     Some restricted content
  75                      www.devoxx.com
Custom URL mappings
Not satisļ¬ed with the default URL mapping?
 Deļ¬ne your URLs yourself!


class UrlMapping {
    static mappings = {
        ā€œ$blog/$yeah?/$month?/$day?ā€ (controller: ā€˜blogā€™,
                                          action: ā€˜showā€™) {
            constraints {
                year matches: /d{4}/
            }
        }
    }
}



 76                        www.devoxx.com
What have I not shown?
 Conversation concept using Spring WebFlow
 Templates for reusing view logic and presentation
 Internationalization
 You can reuse JSP tag libraries (in Grails 1.1)
 SiteMesh layouts and page componentization
 Handling of REST style architecture
 Unit and integration tests
 Reuse legacy schemas
 or Spring conļ¬gurations
  77                          www.devoxx.com
What have I not shown?
 Conversation concept using Spring WebFlow
 Templates for reusing view logic and presentation
 Internationalization
 You can reuse JSP tag libraries (in Grails 1.1)
 SiteMesh layouts and page componentization
 Handling of REST style architecture
 Unit and integration tests                    Not limited by
                                               conventions?
 Reuse legacy schemas
 or Spring conļ¬gurations
  77                          www.devoxx.com
Grails agenda
 A bit of history and
 background
 The Grails stack
 Getting started with
 scaffolding
 The various layers
 The plugin ecosystem
 Whatā€™s new in Grails 1.1?


                        www.devoxx.com
A wealth of plugins
 Grails is built on top of a core plugin system
 100+ plugins already available
 Testing: Webtest, Easyb, Selenium, jsUnit, Fitnesse
 Rich client / AJAX: Yahoo, Ext-JS, GWT, jQuery, iUI
 Web Services: XFire, remoting, Axis2, Metro
 Security: Spring Security, JSecurity
 Search: Compass integration
 Other integration: Drools, Struts, GridGain, Terracotta

  79                        www.devoxx.com
Grails agenda
 A bit of history and
 background
 The Grails stack
 Getting started with
 scaffolding
 The various layers
 The plugin ecosystem
 Whatā€™s new in Grails 1.1?


                        www.devoxx.com
Grails 1.1
 JSP tag library support and reuse
 New GORM events
 Improvements to data binding
 Read-only access to domain objects
 More options for the GORM DSL
 Improvements to dynamic ļ¬nders
 More support for legacy mappings
 New testing plugin included for easier testing

  81                       www.devoxx.com
Grails Summary
 Grails is not just a web framework,
 but a full-blown development stack
 Grails is not a clone of Ruby on Rails
 Grails is built on proven rock-solid technologies
 Grails brings back the productivity to Java developers
 Grails is a new weapon for the war on Java complexity




  82                        www.devoxx.com
Q&A




      www.devoxx.com
Thanks for your attention!

        http://groovy.codehaus.org
               http://grails.org
   http://www.springsource.com/g2one
     http://glaforge.free.fr/blog/groovy

           glaforge@gmail.com


                   www.devoxx.com
Pictures from the web used in this presentation:

      Question marks: http://weblogs.newsday.com
              Agenda: http://www.jouy.inra.fr
               Mop: http://www.spitjack.com
Harry Potter: http://madhavgopalkrish.ļ¬les.wordpress.com




                         www.devoxx.com

More Related Content

What's hot

AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokusHamletDRC
Ā 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
Arturo Herrero
Ā 
Design Patterns
Design PatternsDesign Patterns
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
lutter
Ā 
Jersey framework
Jersey frameworkJersey framework
Jersey frameworkknight1128
Ā 
Reactive Access to MongoDB from Java 8
Reactive Access to MongoDB from Java 8Reactive Access to MongoDB from Java 8
Reactive Access to MongoDB from Java 8
Hermann Hueck
Ā 
Embedding Groovy in a Java Application
Embedding Groovy in a Java ApplicationEmbedding Groovy in a Java Application
Embedding Groovy in a Java ApplicationPaolo Predonzani
Ā 
groovy & grails - lecture 12
groovy & grails - lecture 12groovy & grails - lecture 12
groovy & grails - lecture 12
Alexandre Masselot
Ā 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about GradleEvgeny Goldin
Ā 
Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011Anton Arhipov
Ā 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoinknight1128
Ā 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
Sylvain Wallez
Ā 
Stub悋 - Mockingjay悒ä½æć£ćŸHTTPć‚Æćƒ©ć‚¤ć‚¢ćƒ³ćƒˆć®ćƒ†ć‚¹ćƒˆ -
Stub悋 - Mockingjay悒ä½æć£ćŸHTTPć‚Æćƒ©ć‚¤ć‚¢ćƒ³ćƒˆć®ćƒ†ć‚¹ćƒˆ -Stub悋 - Mockingjay悒ä½æć£ćŸHTTPć‚Æćƒ©ć‚¤ć‚¢ćƒ³ćƒˆć®ćƒ†ć‚¹ćƒˆ -
Stub悋 - Mockingjay悒ä½æć£ćŸHTTPć‚Æćƒ©ć‚¤ć‚¢ćƒ³ćƒˆć®ćƒ†ć‚¹ćƒˆ -
Kenji Tanaka
Ā 
groovy & grails - lecture 5
groovy & grails - lecture 5groovy & grails - lecture 5
groovy & grails - lecture 5
Alexandre Masselot
Ā 
Designing with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf IndiaDesigning with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf India
Naresha K
Ā 
NIO and NIO2
NIO and NIO2NIO and NIO2
XML-Free Programming
XML-Free ProgrammingXML-Free Programming
XML-Free Programming
Stephen Chin
Ā 
Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...
go_oh
Ā 
ClojureScript: The Good Parts
ClojureScript: The Good PartsClojureScript: The Good Parts
ClojureScript: The Good Parts
Kent Ohashi
Ā 
Bytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASMBytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASM
ashleypuls
Ā 

What's hot (20)

AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
Ā 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
Ā 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
Ā 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
Ā 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
Ā 
Reactive Access to MongoDB from Java 8
Reactive Access to MongoDB from Java 8Reactive Access to MongoDB from Java 8
Reactive Access to MongoDB from Java 8
Ā 
Embedding Groovy in a Java Application
Embedding Groovy in a Java ApplicationEmbedding Groovy in a Java Application
Embedding Groovy in a Java Application
Ā 
groovy & grails - lecture 12
groovy & grails - lecture 12groovy & grails - lecture 12
groovy & grails - lecture 12
Ā 
10 Cool Facts about Gradle
10 Cool Facts about Gradle10 Cool Facts about Gradle
10 Cool Facts about Gradle
Ā 
Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011
Ā 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoin
Ā 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
Ā 
Stub悋 - Mockingjay悒ä½æć£ćŸHTTPć‚Æćƒ©ć‚¤ć‚¢ćƒ³ćƒˆć®ćƒ†ć‚¹ćƒˆ -
Stub悋 - Mockingjay悒ä½æć£ćŸHTTPć‚Æćƒ©ć‚¤ć‚¢ćƒ³ćƒˆć®ćƒ†ć‚¹ćƒˆ -Stub悋 - Mockingjay悒ä½æć£ćŸHTTPć‚Æćƒ©ć‚¤ć‚¢ćƒ³ćƒˆć®ćƒ†ć‚¹ćƒˆ -
Stub悋 - Mockingjay悒ä½æć£ćŸHTTPć‚Æćƒ©ć‚¤ć‚¢ćƒ³ćƒˆć®ćƒ†ć‚¹ćƒˆ -
Ā 
groovy & grails - lecture 5
groovy & grails - lecture 5groovy & grails - lecture 5
groovy & grails - lecture 5
Ā 
Designing with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf IndiaDesigning with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf India
Ā 
NIO and NIO2
NIO and NIO2NIO and NIO2
NIO and NIO2
Ā 
XML-Free Programming
XML-Free ProgrammingXML-Free Programming
XML-Free Programming
Ā 
Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...
Ā 
ClojureScript: The Good Parts
ClojureScript: The Good PartsClojureScript: The Good Parts
ClojureScript: The Good Parts
Ā 
Bytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASMBytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASM
Ā 

Viewers also liked

ćƒ¬ć‚¬ć‚·ćƒ¼ć‚³ćƒ¼ćƒ‰ę”¹å–„ćÆć˜ć‚ć¾ć—ćŸ ęØŖęµœé“å “
ćƒ¬ć‚¬ć‚·ćƒ¼ć‚³ćƒ¼ćƒ‰ę”¹å–„ćÆć˜ć‚ć¾ć—ćŸ ęØŖęµœé“å “ćƒ¬ć‚¬ć‚·ćƒ¼ć‚³ćƒ¼ćƒ‰ę”¹å–„ćÆć˜ć‚ć¾ć—ćŸ ęØŖęµœé“å “
ćƒ¬ć‚¬ć‚·ćƒ¼ć‚³ćƒ¼ćƒ‰ę”¹å–„ćÆć˜ć‚ć¾ć—ćŸ ęØŖęµœé“å “Hiroyuki Ohnaka
Ā 
Spock悒ä½æ恊恆ļ¼
Spock悒ä½æ恊恆ļ¼Spock悒ä½æ恊恆ļ¼
Spock悒ä½æ恊恆ļ¼Takuma Watabiki
Ā 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010
Tomek Kaczanowski
Ā 
The outlineoftestprocess
The outlineoftestprocessThe outlineoftestprocess
The outlineoftestprocess
kyon mm
Ā 
恆恕恎ēµ„ in G* WorkShop -恆恕ćæćæ恮ꗄåøø-
恆恕恎ēµ„ in G* WorkShop -恆恕ćæćæ恮ꗄåøø-恆恕恎ēµ„ in G* WorkShop -恆恕ćæćæ恮ꗄåøø-
恆恕恎ēµ„ in G* WorkShop -恆恕ćæćæ恮ꗄåøø-
kyon mm
Ā 
AgileJapan2010 åŸŗčŖæč¬›ę¼”ļ¼šé‡Žäø­éƒę¬”郎先ē”Ÿć«ć‚ˆć‚‹ć€Œå®Ÿč·µēŸ„恮ćƒŖćƒ¼ćƒ€ć‚·ćƒƒćƒ—ļ½žć‚¹ć‚Æ惩惠ćØēŸ„ć®å “ä½œć‚Šć€
AgileJapan2010 åŸŗčŖæč¬›ę¼”ļ¼šé‡Žäø­éƒę¬”郎先ē”Ÿć«ć‚ˆć‚‹ć€Œå®Ÿč·µēŸ„恮ćƒŖćƒ¼ćƒ€ć‚·ćƒƒćƒ—ļ½žć‚¹ć‚Æ惩惠ćØēŸ„ć®å “ä½œć‚Šć€AgileJapan2010 åŸŗčŖæč¬›ę¼”ļ¼šé‡Žäø­éƒę¬”郎先ē”Ÿć«ć‚ˆć‚‹ć€Œå®Ÿč·µēŸ„恮ćƒŖćƒ¼ćƒ€ć‚·ćƒƒćƒ—ļ½žć‚¹ć‚Æ惩惠ćØēŸ„ć®å “ä½œć‚Šć€
AgileJapan2010 åŸŗčŖæč¬›ę¼”ļ¼šé‡Žäø­éƒę¬”郎先ē”Ÿć«ć‚ˆć‚‹ć€Œå®Ÿč·µēŸ„恮ćƒŖćƒ¼ćƒ€ć‚·ćƒƒćƒ—ļ½žć‚¹ć‚Æ惩惠ćØēŸ„ć®å “ä½œć‚Šć€
Kenji Hiranabe
Ā 
Groovy 1.8ć®ę–°ę©Ÿčƒ½ć«ć¤ć„ć¦
Groovy 1.8ć®ę–°ę©Ÿčƒ½ć«ć¤ć„ć¦Groovy 1.8ć®ę–°ę©Ÿčƒ½ć«ć¤ć„ć¦
Groovy 1.8ć®ę–°ę©Ÿčƒ½ć«ć¤ć„ć¦
Uehara Junji
Ā 
Groovier testing with Spock
Groovier testing with SpockGroovier testing with Spock
Groovier testing with Spock
Robert Fletcher
Ā 
Spock Framework 2
Spock Framework 2Spock Framework 2
Spock Framework 2
Ismael
Ā 
Groovy Testing Aug2009
Groovy Testing Aug2009Groovy Testing Aug2009
Groovy Testing Aug2009
guest4a266c
Ā 
Jenkinså°Žå…„ćƒ©ć‚¤ćƒ–
Jenkinså°Žå…„ćƒ©ć‚¤ćƒ–Jenkinså°Žå…„ćƒ©ć‚¤ćƒ–
Jenkinså°Žå…„ćƒ©ć‚¤ćƒ–
Hiasyoshi Suehiro
Ā 
Groovy, Transforming Language
Groovy, Transforming LanguageGroovy, Transforming Language
Groovy, Transforming Language
Uehara Junji
Ā 
AndroidćƒŖćƒŖćƒ¼ć‚¹ä½œę„­ć®åŠ¹ēŽ‡åŒ–(2)
AndroidćƒŖćƒŖćƒ¼ć‚¹ä½œę„­ć®åŠ¹ēŽ‡åŒ–(2)AndroidćƒŖćƒŖćƒ¼ć‚¹ä½œę„­ć®åŠ¹ēŽ‡åŒ–(2)
AndroidćƒŖćƒŖćƒ¼ć‚¹ä½œę„­ć®åŠ¹ēŽ‡åŒ–(2)
Kenichi Kambara
Ā 
Spock Framework
Spock FrameworkSpock Framework
Spock Framework
Ismael
Ā 
Spock: A Highly Logical Way To Test
Spock: A Highly Logical Way To TestSpock: A Highly Logical Way To Test
Spock: A Highly Logical Way To Test
Howard Lewis Ship
Ā 
Gradleć«ć‚ˆć‚‹G*ćŖćƒ“ćƒ«ćƒ‰ć‚·ć‚¹ćƒ†ćƒ ć®ę§‹ēƉ
Gradleć«ć‚ˆć‚‹G*ćŖćƒ“ćƒ«ćƒ‰ć‚·ć‚¹ćƒ†ćƒ ć®ę§‹ēƉGradleć«ć‚ˆć‚‹G*ćŖćƒ“ćƒ«ćƒ‰ć‚·ć‚¹ćƒ†ćƒ ć®ę§‹ēƉ
Gradleć«ć‚ˆć‚‹G*ćŖćƒ“ćƒ«ćƒ‰ć‚·ć‚¹ćƒ†ćƒ ć®ę§‹ēƉ
Masatoshi Hayashi
Ā 
Jenkins悒ē”Ø恄恟Androidć‚¢ćƒ—ćƒŖćƒ“ćƒ«ćƒ‰ä½œę„­åŠ¹ēŽ‡åŒ–
Jenkins悒ē”Ø恄恟Androidć‚¢ćƒ—ćƒŖćƒ“ćƒ«ćƒ‰ä½œę„­åŠ¹ēŽ‡åŒ–Jenkins悒ē”Ø恄恟Androidć‚¢ćƒ—ćƒŖćƒ“ćƒ«ćƒ‰ä½œę„­åŠ¹ēŽ‡åŒ–
Jenkins悒ē”Ø恄恟Androidć‚¢ćƒ—ćƒŖćƒ“ćƒ«ćƒ‰ä½œę„­åŠ¹ēŽ‡åŒ–Kenichi Kambara
Ā 
Jenkinsćƒ—ćƒ©ć‚°ć‚¤ćƒ³é–‹ē™ŗ
Jenkinsćƒ—ćƒ©ć‚°ć‚¤ćƒ³é–‹ē™ŗJenkinsćƒ—ćƒ©ć‚°ć‚¤ćƒ³é–‹ē™ŗ
Jenkinsćƒ—ćƒ©ć‚°ć‚¤ćƒ³é–‹ē™ŗTakahisa Wada
Ā 
function list
function listfunction list
function listkyon mm
Ā 

Viewers also liked (20)

ćƒ¬ć‚¬ć‚·ćƒ¼ć‚³ćƒ¼ćƒ‰ę”¹å–„ćÆć˜ć‚ć¾ć—ćŸ ęØŖęµœé“å “
ćƒ¬ć‚¬ć‚·ćƒ¼ć‚³ćƒ¼ćƒ‰ę”¹å–„ćÆć˜ć‚ć¾ć—ćŸ ęØŖęµœé“å “ćƒ¬ć‚¬ć‚·ćƒ¼ć‚³ćƒ¼ćƒ‰ę”¹å–„ćÆć˜ć‚ć¾ć—ćŸ ęØŖęµœé“å “
ćƒ¬ć‚¬ć‚·ćƒ¼ć‚³ćƒ¼ćƒ‰ę”¹å–„ćÆć˜ć‚ć¾ć—ćŸ ęØŖęµœé“å “
Ā 
Spock悒ä½æ恊恆ļ¼
Spock悒ä½æ恊恆ļ¼Spock悒ä½æ恊恆ļ¼
Spock悒ä½æ恊恆ļ¼
Ā 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010
Ā 
The outlineoftestprocess
The outlineoftestprocessThe outlineoftestprocess
The outlineoftestprocess
Ā 
恆恕恎ēµ„ in G* WorkShop -恆恕ćæćæ恮ꗄåøø-
恆恕恎ēµ„ in G* WorkShop -恆恕ćæćæ恮ꗄåøø-恆恕恎ēµ„ in G* WorkShop -恆恕ćæćæ恮ꗄåøø-
恆恕恎ēµ„ in G* WorkShop -恆恕ćæćæ恮ꗄåøø-
Ā 
AgileJapan2010 åŸŗčŖæč¬›ę¼”ļ¼šé‡Žäø­éƒę¬”郎先ē”Ÿć«ć‚ˆć‚‹ć€Œå®Ÿč·µēŸ„恮ćƒŖćƒ¼ćƒ€ć‚·ćƒƒćƒ—ļ½žć‚¹ć‚Æ惩惠ćØēŸ„ć®å “ä½œć‚Šć€
AgileJapan2010 åŸŗčŖæč¬›ę¼”ļ¼šé‡Žäø­éƒę¬”郎先ē”Ÿć«ć‚ˆć‚‹ć€Œå®Ÿč·µēŸ„恮ćƒŖćƒ¼ćƒ€ć‚·ćƒƒćƒ—ļ½žć‚¹ć‚Æ惩惠ćØēŸ„ć®å “ä½œć‚Šć€AgileJapan2010 åŸŗčŖæč¬›ę¼”ļ¼šé‡Žäø­éƒę¬”郎先ē”Ÿć«ć‚ˆć‚‹ć€Œå®Ÿč·µēŸ„恮ćƒŖćƒ¼ćƒ€ć‚·ćƒƒćƒ—ļ½žć‚¹ć‚Æ惩惠ćØēŸ„ć®å “ä½œć‚Šć€
AgileJapan2010 åŸŗčŖæč¬›ę¼”ļ¼šé‡Žäø­éƒę¬”郎先ē”Ÿć«ć‚ˆć‚‹ć€Œå®Ÿč·µēŸ„恮ćƒŖćƒ¼ćƒ€ć‚·ćƒƒćƒ—ļ½žć‚¹ć‚Æ惩惠ćØēŸ„ć®å “ä½œć‚Šć€
Ā 
Groovy 1.8ć®ę–°ę©Ÿčƒ½ć«ć¤ć„ć¦
Groovy 1.8ć®ę–°ę©Ÿčƒ½ć«ć¤ć„ć¦Groovy 1.8ć®ę–°ę©Ÿčƒ½ć«ć¤ć„ć¦
Groovy 1.8ć®ę–°ę©Ÿčƒ½ć«ć¤ć„ć¦
Ā 
Groovier testing with Spock
Groovier testing with SpockGroovier testing with Spock
Groovier testing with Spock
Ā 
Spock Framework 2
Spock Framework 2Spock Framework 2
Spock Framework 2
Ā 
Groovy Testing Aug2009
Groovy Testing Aug2009Groovy Testing Aug2009
Groovy Testing Aug2009
Ā 
Jenkinså°Žå…„ćƒ©ć‚¤ćƒ–
Jenkinså°Žå…„ćƒ©ć‚¤ćƒ–Jenkinså°Žå…„ćƒ©ć‚¤ćƒ–
Jenkinså°Žå…„ćƒ©ć‚¤ćƒ–
Ā 
Groovy, Transforming Language
Groovy, Transforming LanguageGroovy, Transforming Language
Groovy, Transforming Language
Ā 
AndroidćƒŖćƒŖćƒ¼ć‚¹ä½œę„­ć®åŠ¹ēŽ‡åŒ–(2)
AndroidćƒŖćƒŖćƒ¼ć‚¹ä½œę„­ć®åŠ¹ēŽ‡åŒ–(2)AndroidćƒŖćƒŖćƒ¼ć‚¹ä½œę„­ć®åŠ¹ēŽ‡åŒ–(2)
AndroidćƒŖćƒŖćƒ¼ć‚¹ä½œę„­ć®åŠ¹ēŽ‡åŒ–(2)
Ā 
Spock Framework
Spock FrameworkSpock Framework
Spock Framework
Ā 
Spock: A Highly Logical Way To Test
Spock: A Highly Logical Way To TestSpock: A Highly Logical Way To Test
Spock: A Highly Logical Way To Test
Ā 
Gradleć«ć‚ˆć‚‹G*ćŖćƒ“ćƒ«ćƒ‰ć‚·ć‚¹ćƒ†ćƒ ć®ę§‹ēƉ
Gradleć«ć‚ˆć‚‹G*ćŖćƒ“ćƒ«ćƒ‰ć‚·ć‚¹ćƒ†ćƒ ć®ę§‹ēƉGradleć«ć‚ˆć‚‹G*ćŖćƒ“ćƒ«ćƒ‰ć‚·ć‚¹ćƒ†ćƒ ć®ę§‹ēƉ
Gradleć«ć‚ˆć‚‹G*ćŖćƒ“ćƒ«ćƒ‰ć‚·ć‚¹ćƒ†ćƒ ć®ę§‹ēƉ
Ā 
Jenkins悒ē”Ø恄恟Androidć‚¢ćƒ—ćƒŖćƒ“ćƒ«ćƒ‰ä½œę„­åŠ¹ēŽ‡åŒ–
Jenkins悒ē”Ø恄恟Androidć‚¢ćƒ—ćƒŖćƒ“ćƒ«ćƒ‰ä½œę„­åŠ¹ēŽ‡åŒ–Jenkins悒ē”Ø恄恟Androidć‚¢ćƒ—ćƒŖćƒ“ćƒ«ćƒ‰ä½œę„­åŠ¹ēŽ‡åŒ–
Jenkins悒ē”Ø恄恟Androidć‚¢ćƒ—ćƒŖćƒ“ćƒ«ćƒ‰ä½œę„­åŠ¹ēŽ‡åŒ–
Ā 
Jenkinsćƒ—ćƒ©ć‚°ć‚¤ćƒ³é–‹ē™ŗ
Jenkinsćƒ—ćƒ©ć‚°ć‚¤ćƒ³é–‹ē™ŗJenkinsćƒ—ćƒ©ć‚°ć‚¤ćƒ³é–‹ē™ŗ
Jenkinsćƒ—ćƒ©ć‚°ć‚¤ćƒ³é–‹ē™ŗ
Ā 
How about Gradle?
How about Gradle?How about Gradle?
How about Gradle?
Ā 
function list
function listfunction list
function list
Ā 

Similar to Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge

2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws
loffenauer
Ā 
What's New in Groovy 1.6?
What's New in Groovy 1.6?What's New in Groovy 1.6?
What's New in Groovy 1.6?Guillaume Laforge
Ā 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007
Guillaume Laforge
Ā 
Groovy a Scripting Language for Java
Groovy a Scripting Language for JavaGroovy a Scripting Language for Java
Groovy a Scripting Language for Java
Charles Anderson
Ā 
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume LaforgeGroovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Guillaume Laforge
Ā 
Oscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneOscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast Lane
Andres Almiray
Ā 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
Guillaume Laforge
Ā 
Groovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web ApplicationsGroovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web Applications
rohitnayak
Ā 
Eclipsecon08 Introduction To Groovy
Eclipsecon08 Introduction To GroovyEclipsecon08 Introduction To Groovy
Eclipsecon08 Introduction To Groovy
Andres Almiray
Ā 
Javaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingJavaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 Groovytesting
Andres Almiray
Ā 
Boosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyBoosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyJames Williams
Ā 
Groovy And Grails Introduction
Groovy And Grails IntroductionGroovy And Grails Introduction
Groovy And Grails Introduction
Eric Weimer
Ā 
GTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with GroovyGTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with Groovy
Andres Almiray
Ā 
Groovy and Grails
Groovy and GrailsGroovy and Grails
Groovy and Grails
GiltTech
Ā 
Introduction To Groovy
Introduction To GroovyIntroduction To Groovy
Introduction To Groovymanishkp84
Ā 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...Guillaume Laforge
Ā 
Groovy - Grails as a modern scripting language for Web applications
Groovy - Grails as a modern scripting language for Web applicationsGroovy - Grails as a modern scripting language for Web applications
Groovy - Grails as a modern scripting language for Web applications
IndicThreads
Ā 
LISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial HandoutsLISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial Handouts
Tobias Oetiker
Ā 
Groovy Finesse
Groovy FinesseGroovy Finesse
Groovy Finesse
mzgubin
Ā 

Similar to Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge (20)

2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws
Ā 
What's New in Groovy 1.6?
What's New in Groovy 1.6?What's New in Groovy 1.6?
What's New in Groovy 1.6?
Ā 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007
Ā 
Groovy a Scripting Language for Java
Groovy a Scripting Language for JavaGroovy a Scripting Language for Java
Groovy a Scripting Language for Java
Ā 
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume LaforgeGroovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Ā 
Oscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneOscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast Lane
Ā 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
Ā 
Groovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web ApplicationsGroovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web Applications
Ā 
Eclipsecon08 Introduction To Groovy
Eclipsecon08 Introduction To GroovyEclipsecon08 Introduction To Groovy
Eclipsecon08 Introduction To Groovy
Ā 
Javaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingJavaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 Groovytesting
Ā 
Boosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyBoosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with Groovy
Ā 
Groovy And Grails Introduction
Groovy And Grails IntroductionGroovy And Grails Introduction
Groovy And Grails Introduction
Ā 
GTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with GroovyGTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with Groovy
Ā 
Groovy and Grails
Groovy and GrailsGroovy and Grails
Groovy and Grails
Ā 
OpenLogic
OpenLogicOpenLogic
OpenLogic
Ā 
Introduction To Groovy
Introduction To GroovyIntroduction To Groovy
Introduction To Groovy
Ā 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
Ā 
Groovy - Grails as a modern scripting language for Web applications
Groovy - Grails as a modern scripting language for Web applicationsGroovy - Grails as a modern scripting language for Web applications
Groovy - Grails as a modern scripting language for Web applications
Ā 
LISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial HandoutsLISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial Handouts
Ā 
Groovy Finesse
Groovy FinesseGroovy Finesse
Groovy Finesse
Ā 

More from Guillaume Laforge

Lift off with Groovy 2 at JavaOne 2013
Lift off with Groovy 2 at JavaOne 2013Lift off with Groovy 2 at JavaOne 2013
Lift off with Groovy 2 at JavaOne 2013
Guillaume Laforge
Ā 
Groovy workshop Ć  Mix-IT 2013
Groovy workshop Ć  Mix-IT 2013Groovy workshop Ć  Mix-IT 2013
Groovy workshop Ć  Mix-IT 2013
Guillaume Laforge
Ā 
Les nouveautƩs de Groovy 2 -- Mix-IT 2013
Les nouveautƩs de Groovy 2 -- Mix-IT 2013Les nouveautƩs de Groovy 2 -- Mix-IT 2013
Les nouveautƩs de Groovy 2 -- Mix-IT 2013
Guillaume Laforge
Ā 
Groovy 2 and beyond
Groovy 2 and beyondGroovy 2 and beyond
Groovy 2 and beyond
Guillaume Laforge
Ā 
Groovy 2.0 update at Devoxx 2012
Groovy 2.0 update at Devoxx 2012Groovy 2.0 update at Devoxx 2012
Groovy 2.0 update at Devoxx 2012Guillaume Laforge
Ā 
Groovy 2.0 webinar
Groovy 2.0 webinarGroovy 2.0 webinar
Groovy 2.0 webinar
Guillaume Laforge
Ā 
Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012
Guillaume Laforge
Ā 
Groovy update at SpringOne2GX 2012
Groovy update at SpringOne2GX 2012Groovy update at SpringOne2GX 2012
Groovy update at SpringOne2GX 2012
Guillaume Laforge
Ā 
JavaOne 2012 Groovy update
JavaOne 2012 Groovy updateJavaOne 2012 Groovy update
JavaOne 2012 Groovy update
Guillaume Laforge
Ā 
Groovy 1.8 et 2.0 au BreizhC@mp 2012
Groovy 1.8 et 2.0 au BreizhC@mp 2012Groovy 1.8 et 2.0 au BreizhC@mp 2012
Groovy 1.8 et 2.0 au BreizhC@mp 2012Guillaume Laforge
Ā 
Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Groovy 1.8 and 2.0 at GR8Conf Europe 2012Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Groovy 1.8 and 2.0 at GR8Conf Europe 2012Guillaume Laforge
Ā 
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume LaforgeGroovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
Guillaume Laforge
Ā 
Going to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGoing to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific Languages
Guillaume Laforge
Ā 
Groovy 2.0 - Devoxx France 2012
Groovy 2.0 - Devoxx France 2012Groovy 2.0 - Devoxx France 2012
Groovy 2.0 - Devoxx France 2012
Guillaume Laforge
Ā 
Whats new in Groovy 2.0?
Whats new in Groovy 2.0?Whats new in Groovy 2.0?
Whats new in Groovy 2.0?
Guillaume Laforge
Ā 
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011Guillaume Laforge
Ā 
GPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
GPars et PrettyTime - Paris JUG 2011 - Guillaume LaforgeGPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
GPars et PrettyTime - Paris JUG 2011 - Guillaume LaforgeGuillaume Laforge
Ā 
Groovy Update - Guillaume Laforge - Greach 2011
Groovy Update - Guillaume Laforge - Greach 2011Groovy Update - Guillaume Laforge - Greach 2011
Groovy Update - Guillaume Laforge - Greach 2011
Guillaume Laforge
Ā 
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
Guillaume Laforge
Ā 
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
Guillaume Laforge
Ā 

More from Guillaume Laforge (20)

Lift off with Groovy 2 at JavaOne 2013
Lift off with Groovy 2 at JavaOne 2013Lift off with Groovy 2 at JavaOne 2013
Lift off with Groovy 2 at JavaOne 2013
Ā 
Groovy workshop Ć  Mix-IT 2013
Groovy workshop Ć  Mix-IT 2013Groovy workshop Ć  Mix-IT 2013
Groovy workshop Ć  Mix-IT 2013
Ā 
Les nouveautƩs de Groovy 2 -- Mix-IT 2013
Les nouveautƩs de Groovy 2 -- Mix-IT 2013Les nouveautƩs de Groovy 2 -- Mix-IT 2013
Les nouveautƩs de Groovy 2 -- Mix-IT 2013
Ā 
Groovy 2 and beyond
Groovy 2 and beyondGroovy 2 and beyond
Groovy 2 and beyond
Ā 
Groovy 2.0 update at Devoxx 2012
Groovy 2.0 update at Devoxx 2012Groovy 2.0 update at Devoxx 2012
Groovy 2.0 update at Devoxx 2012
Ā 
Groovy 2.0 webinar
Groovy 2.0 webinarGroovy 2.0 webinar
Groovy 2.0 webinar
Ā 
Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012
Ā 
Groovy update at SpringOne2GX 2012
Groovy update at SpringOne2GX 2012Groovy update at SpringOne2GX 2012
Groovy update at SpringOne2GX 2012
Ā 
JavaOne 2012 Groovy update
JavaOne 2012 Groovy updateJavaOne 2012 Groovy update
JavaOne 2012 Groovy update
Ā 
Groovy 1.8 et 2.0 au BreizhC@mp 2012
Groovy 1.8 et 2.0 au BreizhC@mp 2012Groovy 1.8 et 2.0 au BreizhC@mp 2012
Groovy 1.8 et 2.0 au BreizhC@mp 2012
Ā 
Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Groovy 1.8 and 2.0 at GR8Conf Europe 2012Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Ā 
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume LaforgeGroovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
Ā 
Going to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGoing to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific Languages
Ā 
Groovy 2.0 - Devoxx France 2012
Groovy 2.0 - Devoxx France 2012Groovy 2.0 - Devoxx France 2012
Groovy 2.0 - Devoxx France 2012
Ā 
Whats new in Groovy 2.0?
Whats new in Groovy 2.0?Whats new in Groovy 2.0?
Whats new in Groovy 2.0?
Ā 
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Ā 
GPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
GPars et PrettyTime - Paris JUG 2011 - Guillaume LaforgeGPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
GPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
Ā 
Groovy Update - Guillaume Laforge - Greach 2011
Groovy Update - Guillaume Laforge - Greach 2011Groovy Update - Guillaume Laforge - Greach 2011
Groovy Update - Guillaume Laforge - Greach 2011
Ā 
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
Ā 
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
Ā 

Recently uploaded

How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
Ā 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
Ā 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
Ā 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
Ā 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
Ā 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
Ā 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
Ā 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
Ā 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
Ā 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
Ā 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
Ā 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
Ā 
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
UiPathCommunity
Ā 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
Ā 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
Ā 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
Ā 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
Ā 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
Ā 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
Ā 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
Ā 

Recently uploaded (20)

How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Ā 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Ā 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Ā 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Ā 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
Ā 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Ā 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Ā 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
Ā 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Ā 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
Ā 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
Ā 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Ā 
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Ā 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Ā 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Ā 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Ā 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Ā 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
Ā 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Ā 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
Ā 

Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge

  • 2. Groovy & Grails in Action! Guillaume Laforge Groovy Project Manager Head of Groovy Development www.devoxx.com
  • 3. Overall Presentation Goal Discover the Groovy dynamic language for the JVM Understand how you can create DSLs in Groovy Getting productive with the Grails agile web stack www.devoxx.com
  • 4. Guillaume Laforge Groovy Project Manager JSR-241 Spec Lead Head of Groovy Development at SpringSource Initiator of the Grails framework Co-author of Groovy in Action Speaker at numerous conferences JavaOne, QCon, JavaZone, Sun TechDays, JavaPolis, The Spring Experience, JAX, Dynamic Language World... 4 www.devoxx.com
  • 5. G2One / SpringSource Back in 2007, Graeme Rocher and Guillaume Laforge created G2One, the Groovy/Grails company Professional services consulting, expertise, training, support Last november, SpringSource acquired G2One 5 www.devoxx.com
  • 6. Groovy in Action A bit of history and background Groovy syntax basics Interesting Groovy APIs Domain-Speciļ¬c Languages Whatā€™s new in Groovy 1.6? The Groovy Ecosystem www.devoxx.com
  • 7. James Strachan to Bob McWhirter in 2003: Wouldnā€™t it be ā€œgroovyā€ if we could have native syntax for lists, maps and regexs in Java like in most scripting languages? Wouldnā€™t it be ā€œgroovyā€ if we could have duck typing in Java? Wouldnā€™t it be ā€œgroovyā€ if we had closures and properties in Java? www.devoxx.com
  • 8. Groovy agenda A bit of history and background Syntax basics Interesting Groovy APIs Domain-Speciļ¬c Languages Whatā€™s new in Groovy 1.6? The Groovy ecosystem www.devoxx.com
  • 9. Groovy is... Groovy is a dynamic language for the JVM Groovy directly compiles down to bytecode Inspired by other languages: Python, Ruby, Smalltalk Whose goal is to simplify the life of developers Apache 2 licensed Open Source project hosted at Codehaus Grammar directly deriving from the Java 5 language support for annotations, generics, enums, static imports 9 www.devoxx.com
  • 10. Groovy is everywhere Integrated in Open Source projects Spring, JBoss SEAM, ServiceMix, Mule, Oracle OC4J Integrated in mission-critical applications Mutual of Omaha, US Fortune 500 insurance company US National Cancer Institute Integrated in commercial products IBM WebSphere Smash, SAP Composition on Grails Oracle Data Integrator, Oracle Fusion (ADF) 10 www.devoxx.com
  • 11. Lots of books to read 11 www.devoxx.com
  • 12. Features at a glance Totally object-oriented Optional typing No need to wait for Java 7 / 8 / 9: Closures: reusable / assignable code blocks Properties: auto-generated getters / setters Multimethods: call the right method for the right type BigDecimal arithmetics Useful wrapper APIs: SQL, XML, Swing, templates, JMX... 12 www.devoxx.com
  • 13. Java integration Groovy generates Java bytecode for the JVM Same strings, same regex Same APIs ā€” JDK, collections, 3rd party, etc. Same security model, same threading model Same OO concepts JInterface GInterface Joint-compilation <<implements>> <<implements>> GClass JClass JClass GClass 13 www.devoxx.com
  • 14. Letā€™s get started Go to http://groovy.codehaus.org/Download Download the latest version Groovy 1.5.7 ā€” maintenance branch Groovy 1.6-beta-2 ā€” soon to be released Unzip the archive, set GROOVY_HOME Add $GROOVY_HOME/bin to your path Youā€™re ready! 14 www.devoxx.com
  • 15. Tools at your disposal Shell and console: groovysh and groovyConsole An Ant task, a Maven plugin (GMaven) A joint compiler Lets you compile both Groovy and Java together! IDE support 15 www.devoxx.com
  • 17. Groovy agenda A bit of history and background Syntax basics Interesting Groovy APIs Domain-Speciļ¬c Languages Whatā€™s new in Groovy 1.6? The Groovy ecosystem www.devoxx.com
  • 18. A Java program public class HelloWorld { private String name; public void setName(String name) { this.name = name; } public String getName() { return name; } public String greet() { return quot;Hello quot;+ name; } public static void main(String[] args) { HelloWorld helloWorld = new HelloWorld(); helloWorld.setName(quot;Groovyquot;); System.out.println( helloWorld.greet() ); } } 18 www.devoxx.com
  • 19. A Groovy program public class HelloWorld { private String name; public void setName(String name) { this.name = name; } public String getName() { return name; } public String greet() { return quot;Hello quot;+ name; } public static void main(String[] args) { HelloWorld helloWorld = new HelloWorld(); helloWorld.setName(quot;Groovyquot;); System.out.println( helloWorld.greet() ); } } 19 www.devoxx.com
  • 20. DEMO From Java to Groovy www.devoxx.com
  • 21. A groovier version class HelloWorld { String name String greet() { quot;Hello $namequot; } } def helloWorld = new HelloWorld(name: quot;Groovyquot;) println helloWorld.greet() 21 www.devoxx.com
  • 22. Native syntax constructs Lists def numbers = [1, 2, 3, 4, 5] Maps def map = [FR: ā€œFranceā€, BE: ā€œBelgiumā€] Ranges def allowedAges = 18..65 Regular expressions def whitespace = ~/s+?/ 22 www.devoxx.com
  • 23. Groovy Strings GStrings: interpolated strings def person = ā€œJohnā€ def letter = ā€œā€œā€œ${new Date()} Dear ${person}, this is a Groovy letter!ā€ā€ā€ println letter Multiline strings: triple single or double quotes Slashy syntax def whitespace = ~/s+?/ 23 www.devoxx.com
  • 24. Closures A reusable / assignable block of code delimited by curly braces can take parameters can be passed as parameters to methods, or inline def printer = { println it } def double = { int i -> 2 * i } new File(ā€œf.txtā€).eachLine { line -> println line } new File(ā€œf.txtā€).eachLine( printer ) 24 www.devoxx.com
  • 25. Time savers The Groovy Truth def blank = ā€œā€; assert !blank def empty = []; assert !empty Safe graph navigation def order = null assert order?.customer?.address == null Elvis operator def name = customer.name ?: ā€œUnknownā€ 25 www.devoxx.com
  • 26. Java 5 features Since Groovy 1.5 Annotations, generics, static imports, enums, varargs You can leverage frameworks supporting annotations Spring, Hibernate, Guice, JPA, EJB3, TestNG, and more Sole dynamic language supporting annotations 26 www.devoxx.com
  • 27. Annotation example @Entity @Name(ā€œhotelā€) class Hotel implements Serializable { @Id @GeneratedValue Long id @Length(max = 40) @NotNull String name @Override String toString() { ā€œHotel ${name}ā€ } } 27 www.devoxx.com
  • 28. Groovy agenda A bit of history and background Syntax basics Interesting Groovy APIs Domain-Speciļ¬c Languages Whatā€™s new in Groovy 1.6? The Groovy ecosystem www.devoxx.com
  • 29. The GDK ā€” Groovy Dev Kit Groovy ā€œdecoratesā€ existing JDK APIs We canā€™t extend java.lang.String or java.io.File, can we? new File(ā€œf.txtā€).eachLine { println it } (1..100).findAll { it % 2 == 1 } speakers.groupBy { it.lastname } ā€œ123ā€.padLeft(5, ā€˜0ā€™) ā€œls -laā€.execute() ā€œR3Jvb3Z5IHJvY2tzIQ==ā€.decodeBase64() Thread.start { /* code to be executed */ } 29 www.devoxx.com
  • 30. JDBC made easy With transparent resource handling, thanks to closures def sql = Sql.newInstance(url, usr, pwd, driver) sql.execute(quot;insert into table values ($foo, $bar)quot;) sql.execute(quot;insert into table values(?,?)quot;, [a, b]) sql.eachRow(quot;select * from USERquot;) { print it.name } def list = sql.rows(quot;select * from USERquot;) A poor-manā€™s dataset notion def set = sql.dataSet(quot;USERquot;) set.add(name: quot;Johnnyquot;, age: 33) set.each { user -> println user.name } set.findAll { it.age > 22 && it.age < 42 } 30 www.devoxx.com
  • 31. Parsing XML With this multiline string XML fragment def xml = quot;quot;quot; <languages> <language name=quot;Groovyquot;> <feature coolness=quot;lowquot;>SQL</feature> <feature coolness=quot;highquot;>Template</feature> </language> <language name=quot;Perlquot;/> </languages>quot;quot;quot; Navigate your XML graph as an object graph! def root = new XmlParser().parseText(xml) println root.language.feature[1].text() root.language.feature .findAll{ it['@coolness'] == quot;lowquot; } .each{ println it.text() } 31 www.devoxx.com
  • 32. Producing XML too! The same XML document as before new MarkupBuilder().languages { language(name: quot;Groovyquot;) { feature(coolness: quot;lowquot;, quot;SQLquot;) feature(coolness: quot;highquot;, quot;Templatequot;) } language(name: quot;Perlquot;) } 32 www.devoxx.com
  • 33. Swing builder Following the same ā€œbuilder patternā€, but for Swing import javax.swing.WindowConstants as WC import groovy.swing.SwingBuilder def theMap = [color: quot;greenquot;, object: quot;pencilquot;] def swing = new SwingBuilder() def frame = swing.frame( title: 'A Groovy Swing', location: [240,240], defaultCloseOperation:WC.EXIT_ON_CLOSE) { panel { for (entry in theMap) { label(text: entry.key) textField(text: entry.value) } button(text: 'About', actionPerformed: { def pane = swing.optionPane(message: 'SwingBuilder') def dialog = pane.createDialog(null, 'About') dialog.show() }) button(text:'Quit', actionPerformed:{ System.exit(0) }) } } frame.pack() frame.show() 33 www.devoxx.com
  • 34. Swing builder Following the same ā€œbuilder patternā€, but for Swing import javax.swing.WindowConstants as WC import groovy.swing.SwingBuilder def theMap = [color: quot;greenquot;, object: quot;pencilquot;] def swing = new SwingBuilder() def frame = swing.frame( title: 'A Groovy Swing', location: [240,240], defaultCloseOperation:WC.EXIT_ON_CLOSE) { panel { for (entry in theMap) { label(text: entry.key) textField(text: entry.value) } button(text: 'About', actionPerformed: { def pane = swing.optionPane(message: 'SwingBuilder') def dialog = pane.createDialog(null, 'About') dialog.show() }) button(text:'Quit', actionPerformed:{ System.exit(0) }) } } frame.pack() frame.show() 33 www.devoxx.com
  • 35. Another builder with Ant Reuse the wealth of Ant tasks for your build or system scripting needs // create sequantial Ant execution new AntBuilder().sequential { def buildClasses = ā€œbuild/classesā€ // create classes directory mkdir(dir: buildClasses) // compile sources javac(srcdir: ā€œsrcā€, destdir: buildClasses) // jar everything jar(destfile: ā€œmy.jarā€, basedir: buildClasses) } 34 www.devoxx.com
  • 36. Groovy agenda A bit of history and background Syntax basics Interesting Groovy APIs Domain-Speciļ¬c Languages Whatā€™s new in Groovy 1.6? The Groovy ecosystem www.devoxx.com
  • 37. Whatā€™s a DSL? A Domain-Speciļ¬c Language is a small language designed to be useful for a speciļ¬c set of tasks, for a given domain Not necessarily Turing-complete Produces some result conļ¬guration, data structures, simulation declarations... Can be internal or external Has a form: textual or visual 36 www.devoxx.com
  • 38. Some examples Technical SELECT * FROM USERS WHERE NAME LIKE ā€˜Guil%ā€™ ^[w-.]+@([w-]+.)+[w-]{2,4}$ Notation 1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 U Rā€™ U2 R U Rā€™ U R Business oriented Risk calculation for insurance policies Human Resources employee skills representation Anti-malaria drug resistance simulation 37 www.devoxx.com
  • 39. Towards more readability (1/2) 38 www.devoxx.com
  • 40. Towards more readability (1/2) 38 www.devoxx.com
  • 41. Towards more readability (1/2) 20% 38 www.devoxx.com
  • 42. Towards more readability (2/2) 39 www.devoxx.com
  • 43. Towards more readability (2/2) 39 www.devoxx.com
  • 44. Towards more readability (2/2) 80% 39 www.devoxx.com
  • 45. Groovyā€™s MOP to the rescue DSLs are possible in Groovy because of Groovyā€™s malleable syntax and APIs Omitting parentheses, semi-columns Named arguments, Closures Everything is an object Groovyā€™s dynamic nature MOP: Meta-Object Protocol Nothing hard-wired, behavior modiļ¬able at runtime! 40 www.devoxx.com
  • 46. Parentheses & named args Optional parentheses move left Named arguments compare fund: ā€˜XYZā€™, withIndicator: ā€˜NIKEIā€™ account.debit amount: 30.euros, in: 3.days Plus native syntax elements Lists: [NIKEI, CAC40, NASDAK] Maps: [CA: ā€˜Californiaā€™, CO: ā€˜Coloradoā€™] Ranges: Monday..Friday 41 www.devoxx.com
  • 48. Operator overloading Operators are a shorcut for method calls a + b == a.plus(b) a - b == a.minus(b) a * b == a.multiply(b) a / b == a.divide(b) a % b == a.modulo(b) a | b == a.or(b) a & b == a.and(b) a[b] == a.getAt(b) a << b == a.leftShift(b) 43 www.devoxx.com
  • 49. Operator overloading Operators are a shorcut Currency arithmetics for method calls 30.euros + 15.dollars a + b == a.plus(b) Distances a - b == a.minus(b) a * b == a.multiply(b) 12.kilometers + 3.meters a / b == a.divide(b) Parallelism or workļ¬‚ow a % b == a.modulo(b) taskA & taskB | taskC a | b == a.or(b) Banking a & b == a.and(b) a[b] == a.getAt(b) account += 10.euros a << b == a.leftShift(b) 43 www.devoxx.com
  • 50. Closures and builders Remember the builder pattern? Ant, Swing, Markup... You can easily create your own Extend BuilderSupport or FactoryBuilderSupport Nested method calls with closures as last argument plan { artifact { name = ā€˜spring.coreā€™ type = ā€˜bundleā€™ version = ā€˜2.5.6ā€™ } } 44 www.devoxx.com
  • 51. Why creating your own DSL? Use a more expressive language than a general purpose Share a common metaphore between developers and subject matter experts Have domain experts help with the design of the business logic of an application Avoid cluttering business code with too much boilerplate technical code Cleanly separate business logic from application code Let business rules have their own lifecycle 45 www.devoxx.com
  • 52. Groovy agenda A bit of history and background Syntax basics Interesting Groovy APIs Domain-Speciļ¬c Languages Whatā€™s new in Groovy 1.6? The Groovy ecosystem www.devoxx.com
  • 53. Groovy 1.6 Main focus on performance to make Groovy the fastest dynamic language Multiple assignment def (a, b) = [1, 2] def (int i, String s) = [1, ā€˜Groovyā€™] (a, b) = functionReturningAList() AST Transformations @Lazy, @Immutable, @Singleton, @Delegate Annotation deļ¬nition 47 www.devoxx.com
  • 54. Groovy agenda A bit of history and background Syntax basics Interesting Groovy APIs Domain-Speciļ¬c Languages Whatā€™s new in Groovy 1.6? The Groovy ecosystem www.devoxx.com
  • 55. More than just Groovy... First major Groovy child: Grails, but thereā€™s more... Griffon: a Grails-like MVC framework for building rich Swing applications Gradle: a new build system learning from the good ideas and mistakes of Ant, Maven and Ivy Easyb: a Behavior Driven Development toolkit which lets you write user stories with a Groovy DSL All three will be presented at Devoxx, check your agenda! 49 www.devoxx.com
  • 56. Groovy Summary The Groovy dynamic language for the JVM simpliļ¬es the life of developers Groovy opens up some interesting perspectives towards extending and enhancing your applications Groovy provides the most seamless Java integration experience Groovy lets you create Domain-Speciļ¬c Languages Groovy protects your investment in skills, tools, libraries and application servers 50 www.devoxx.com
  • 57. Grails in Action A bit of history and background The Grails stack Getting started with scaffolding The layers: persistence, controllers & services, views The plugin ecosystem Whatā€™s new in Grails 1.1? www.devoxx.com
  • 58. Grails agenda A bit of history and background The Grails stack Getting started with scaffolding The various layers The plugin ecosystem Whatā€™s new in Grails 1.1? www.devoxx.com
  • 59. Guillaume Laforge on the Groovy lists in 2005: Ruby on Rails is all the rage these days, but you compromise on your past investment, if youā€™re a Java shop: developer and IT team skills, training, app servers, the great JVM platform, third-party libraries... Canā€™t we leverage Groovy and proven technologies like Spring and Hibernate to bring the ā€œConvention over Conļ¬gurationā€ paradigm on the Java platform, without compromising on your investment? www.devoxx.com
  • 60. The Holy Grail(s) Observation: lack of productivity in webapp development We have all the tools at our disposal to change that Back in 2005, Graeme Rocher, Steven Devijsver and myself launched Grails Apache licensed OSS project, hosted at Codehaus Goal similar to Groovy: simplify the life of developers So whatā€™s under the hood? 54 www.devoxx.com
  • 61. Grails agenda A bit of history and background The Grails stack Getting started with scaffolding The various layers The plugin ecosystem Whatā€™s new in Grails 1.1? www.devoxx.com
  • 62. From 10,000 feet Grails is an MVC action-based framework Grails follows good principles popularized by Rails CoC: Convention over Conļ¬guration DRY: Donā€™t Repeat Yourself The essence of Rails but with tight integration with the Java platform to protect your investment! 56 www.devoxx.com
  • 63. From 1,000 feet = + + 57 www.devoxx.com
  • 64. Near the ground... Grails is built on rock-solid and proven technologies the JVM, the Java EE specs, existing app servers, and... Spring: IoC, DI, Spring MVC, Spring WebFlow Hibernate: Object-Relational Mapping SiteMesh: page layout and composition Quartz: for job scheduling Jetty and HSQLDB: for fast development cycles Productive out of the box with a full development stack 58 www.devoxx.com
  • 65. Grails agenda A bit of history and background The Grails stack Getting started with scaffolding The various layers The plugin ecosystem Whatā€™s new in Grails 1.1? www.devoxx.com
  • 66. First step, download & install Go to http://grails.org/Download Download the latest archive Unzip it somewhere Create GRAILS_HOME Add $GRAILS_HOME/bin to your PATH Youā€™re ready to go! Next step: grails create-app 60 www.devoxx.com
  • 67. DEMO Getting started with scaffolding Remember scaffolding is nice for CRUD, admin interfaces, prototyping, getting up and running quickly, but Grails is more than just a CRUD framework! www.devoxx.com
  • 68. Layout and naming convention 62 www.devoxx.com
  • 69. Did you notice? Where are my conļ¬guration ļ¬les? Why havenā€™t I written any XML ļ¬le? Where are my DAOs? Where are my mapping ļ¬les? No database to conļ¬gure? Nor a servlet container or app server to install? Or tons of jars to download from Maven repositories? There must be some magic under the hood :-) www.devoxx.com
  • 70. Grails agenda A bit of history and background The Grails stack Getting started with scaffolding The various layers The plugin ecosystem Whatā€™s new in Grails 1.1? www.devoxx.com
  • 71. The usual problems When you start a project, you have to setup everything The build, wire all components together You suffer from impedance mismatch You have to handle the ORM mapping manually Itā€™s hard to write clean views Taglibs are a pain to develop 65 www.devoxx.com
  • 72. Persistence Enters GORM: Grails Object Relational Mapping Hibernate under the hood Your domain model is a set of POGOs Your domain classes are transparentely mapped Although you can use legacy schemas with GORM DSL No conf: hibernate.cfg.xml, no *.hbm.xml ļ¬les! But you can bring your own existing ones if needed Always a path to conļ¬guration when in need 66 www.devoxx.com
  • 73. Persistence Enters GORM: Grails Object Relational Mapping Hibernate under the hood Not limited by Your domain model is a set of POGOs conventions? Your domain classes are transparentely mapped Although you can use legacy schemas with GORM DSL No conf: hibernate.cfg.xml, no *.hbm.xml ļ¬les! But you can bring your own existing ones if needed Always a path to conļ¬guration when in need 66 www.devoxx.com
  • 74. Dynamic ļ¬nders All domain classes have got injected methods like Book.count(), Book.list(), Book.get(id) book.save(), book.delete(), etc... Dynamic ļ¬nders Book.findByTitle(ā€œHarry Potterā€) Book.findAllByAuthorLike(ā€œ%Rowlinsā€) Book.findAllByTitleLikeAndReleaseDateLessThan( ā€˜%Grails%ā€™, 2007 ) // donā€™t do that :-) 67 www.devoxx.com
  • 75. Dynamic ļ¬nders All domain classes have got injected methods like Book.count(), Book.list(), Book.get(id) book.save(), book.delete(), etc... Dynamic ļ¬nders Book.findByTitle(ā€œHarry Potterā€) Book.findAllByAuthorLike(ā€œ%Rowlinsā€) Book.findAllByTitleLikeAndReleaseDateLessThan( ā€˜%Grails%ā€™, 2007 ) // donā€™t do that :-) Whereā€™s my DAO? 67 www.devoxx.com
  • 76. Queries You can use raw HQL queries Book.ļ¬nd(ā€œfrom Book b where b.title = ?ā€, [ā€˜Shiningā€™]) Grails wraps the Hibernate Criteria API def results = Account.list { like ā€œholderFirstNameā€, ā€œFred%ā€ and { between ā€œbalanceā€, 500, 1000 eq ā€œbranchā€, ā€œLondonā€ } order ā€œholderLastNameā€, ā€œdescā€ } 68 www.devoxx.com
  • 77. Constraints Constraints can be added to domain classes through a static constraints ļ¬eld static constraints = { isbn matches: /[0-9]{9}[0-9X]/ } Many constraints available blank, creditcard, email, nullable, matches, range, unique Create your own validator myIntField = { it % 2 == 0 } You can also register your own constraints 69 www.devoxx.com
  • 78. Controllers In the controller directory, name ending with Controller http://myserver:8080/app/controller/action Handy things at your disposal redirect, chain, render, ļ¬‚ash scope Controllers return Maps as models for the view to render Possible access to the raw output stream Easy databinding from form ļ¬elds book.properties = params 70 www.devoxx.com
  • 79. Controllers In the controller directory, name ending with Controller http://myserver:8080/app/controller/action a d Handy things at your disposal e lo redirect, chain, render, ļ¬‚ash scope R Controllers return Maps as models for the view to render Possible access to the raw output stream Easy databinding from form ļ¬elds book.properties = params 70 www.devoxx.com
  • 80. Services Another naming convention and placement Transactional by default Just declare your service, itā€™ll be transparently injected! no need to conļ¬gure it in some XML ļ¬‚e 71 www.devoxx.com
  • 81. The view tier The view tier is essentially composed of two things The Groovy Server Pages Similar to JSPs But with GString interpolation The Grails Tag Libraries Useful existing tag libraries So easy to write your own! Templates, URL mapping, conversations and more 72 www.devoxx.com
  • 82. GSPs Auto-reloading <html> <head> <meta name=quot;layoutquot; content=quot;mainquot; /> <title>Book List</title> </head> <body> <a href=quot;${createLinkTo(dir:'')}quot;>Home</a> <g:link action=quot;createquot;>New Book</g:link> <g:if test=quot;${flash.message}quot;> ${flash.message} </g:if> <g:each in=quot;${bookList}quot;>${it.title}</g:each> </body> </html> 73 www.devoxx.com
  • 83. GSPs Auto-reloading <html> a d <head> e lo R <meta name=quot;layoutquot; content=quot;mainquot; /> <title>Book List</title> </head> <body> <a href=quot;${createLinkTo(dir:'')}quot;>Home</a> <g:link action=quot;createquot;>New Book</g:link> <g:if test=quot;${flash.message}quot;> ${flash.message} </g:if> <g:each in=quot;${bookList}quot;>${it.title}</g:each> </body> </html> 73 www.devoxx.com
  • 84. Taglibs Lots of existing taglibs Logical: if, else, elseif Iterative: each, collect, ļ¬ndAll Linking: createLink, createLinkTo Ajax: remoteLink, remoteForm, remoteFunction Form: select, datePicker, currencySelect Validation: hasError, eachError UI: rich text editor 74 www.devoxx.com
  • 85. Create your own taglib Yet another Grails convention class MyTaglib { def isAdmin = { attrs, body -> def user = attrs[ā€˜userā€™] if (user && checkUserPrivs(user)) { body() } } } Use it in your GSP <g:isAdmin user=ā€${user}ā€> Some restricted content 75 www.devoxx.com
  • 86. Create your own taglib Yet another Grails convention class MyTaglib { def isAdmin = { attrs, body -> def user = attrs[ā€˜userā€™] if (user && checkUserPrivs(user)) { body() } } a d } e lo Use it in your GSP R <g:isAdmin user=ā€${user}ā€> Some restricted content 75 www.devoxx.com
  • 87. Custom URL mappings Not satisļ¬ed with the default URL mapping? Deļ¬ne your URLs yourself! class UrlMapping { static mappings = { ā€œ$blog/$yeah?/$month?/$day?ā€ (controller: ā€˜blogā€™, action: ā€˜showā€™) { constraints { year matches: /d{4}/ } } } } 76 www.devoxx.com
  • 88. What have I not shown? Conversation concept using Spring WebFlow Templates for reusing view logic and presentation Internationalization You can reuse JSP tag libraries (in Grails 1.1) SiteMesh layouts and page componentization Handling of REST style architecture Unit and integration tests Reuse legacy schemas or Spring conļ¬gurations 77 www.devoxx.com
  • 89. What have I not shown? Conversation concept using Spring WebFlow Templates for reusing view logic and presentation Internationalization You can reuse JSP tag libraries (in Grails 1.1) SiteMesh layouts and page componentization Handling of REST style architecture Unit and integration tests Not limited by conventions? Reuse legacy schemas or Spring conļ¬gurations 77 www.devoxx.com
  • 90. Grails agenda A bit of history and background The Grails stack Getting started with scaffolding The various layers The plugin ecosystem Whatā€™s new in Grails 1.1? www.devoxx.com
  • 91. A wealth of plugins Grails is built on top of a core plugin system 100+ plugins already available Testing: Webtest, Easyb, Selenium, jsUnit, Fitnesse Rich client / AJAX: Yahoo, Ext-JS, GWT, jQuery, iUI Web Services: XFire, remoting, Axis2, Metro Security: Spring Security, JSecurity Search: Compass integration Other integration: Drools, Struts, GridGain, Terracotta 79 www.devoxx.com
  • 92. Grails agenda A bit of history and background The Grails stack Getting started with scaffolding The various layers The plugin ecosystem Whatā€™s new in Grails 1.1? www.devoxx.com
  • 93. Grails 1.1 JSP tag library support and reuse New GORM events Improvements to data binding Read-only access to domain objects More options for the GORM DSL Improvements to dynamic ļ¬nders More support for legacy mappings New testing plugin included for easier testing 81 www.devoxx.com
  • 94. Grails Summary Grails is not just a web framework, but a full-blown development stack Grails is not a clone of Ruby on Rails Grails is built on proven rock-solid technologies Grails brings back the productivity to Java developers Grails is a new weapon for the war on Java complexity 82 www.devoxx.com
  • 95. Q&A www.devoxx.com
  • 96. Thanks for your attention! http://groovy.codehaus.org http://grails.org http://www.springsource.com/g2one http://glaforge.free.fr/blog/groovy glaforge@gmail.com www.devoxx.com
  • 97. Pictures from the web used in this presentation: Question marks: http://weblogs.newsday.com Agenda: http://www.jouy.inra.fr Mop: http://www.spitjack.com Harry Potter: http://madhavgopalkrish.ļ¬les.wordpress.com www.devoxx.com