SlideShare a Scribd company logo
1 of 35
Download to read offline
GROOVY UP YOUR CODE
                                             Paulo Traça
                                             CTO
                                             paulo.traca@logical-software.com


LOGICAL SOFTWARE
Human Capital | Enterprise Java | Research


Rua Gago Coutinho nº4 B
2675-509 Odivelas

T +351 21 931 50 33
F +351 21 931 82 52

E info@logical-software.com

Web www.logical-software.com
Groovy Up Your Code




                      Objectivos da Sessão

            Conhecer as principais potencialidade dos Groovy
        ●




            Perceber em que o Groovy pode ser útil
        ●




            “Be more Groovy” :-)
        ●
Groovy Up Your Code




                                    Agenda
          O que é o Groovy ?
      ●



          Será que preciso de mais uma linguagem de scripting ?
      ●



          Características Básicas
      ●



          Características Avançadas
      ●



          The Goodies
      ●



          Demos
      ●



          Conclusão
      ●



          Referências
      ●



          Q&A
      ●
Groovy Up Your Code




                                    Agenda
          O que é o Groovy ?
      ●



          Será que preciso de mais uma linguagem de scripting ?
      ●



          Características Básicas
      ●



          Características Avançadas
      ●



          Demos
      ●



          The Goodies
      ●



          Conclusão
      ●



          Referências
      ●



          Q&A
      ●
Groovy Up Your Code




                           O que é o Groovy ?

                                          “JAVA ON STEROIDS ...”
                                         e não é ilegal...


                         “ Groovy is like a super version of Java. It can leverage Java's
                      enterprise capabilities but also has cool productivity features like closures,
                      builders and dynamic typing. If you are a developer, tester or script guru, you
                      have to love Groovy.”
Groovy Up Your Code




                             O que é Groovy
            Linguagem ágil para JVM
        ●



            Sintaxe idêntica Java, curva da aprendizagem baixa para prog.
        ●



        Java
            Linguagem dinâmica, Orientada a objectos
        ●



            Características da linguagem derivadas do Ruby, Python e
        ●



        SmallTalk
            JCP 241
        ●
Groovy Up Your Code




                               O que é Groovy

            Suporte para DSL's (Domain Specific Languages)
        ●



            Suporte para Shell/ Builds scripts [cat | grep ... / Ant DSL]
        ●



            Unit Testing and Mock Object “out of the Box”
        ●



            Totalmente compatível com JAVA objects e bibliotecas
        ●



            Compila directamente para JVM bytecode
        ●
Groovy Up Your Code




                                    Agenda
          O que é o Groovy ?
      ●



          Será que preciso de mais uma linguagem de scripting ?
      ●



          Características Básicas
      ●



          Características Avançadas
      ●



          Demos
      ●



          The Goodies
      ●



          Conclusão
      ●



          Referências
      ●



          Q&A
      ●
Groovy Up Your Code




                      Porque investir no Groovy ?

               Proliferação de linguagens de scripting
           ●



               “The c00l new guy” - Ruby / RoR
           ●



               “The c00l new guy – Take 2” JRuby
           ●



               Python, Smalltalk ... { fill in with your favorite scripting language }
           ●
Groovy Up Your Code




            O que torna o Groovy diferente ?
            JAVA / JVM compatível
        ●



            Se sabes JAVA, praticamente sabes Groovy
        ●



            Não obriga um novo investimento para aprender uma nova      linguagem /
        ●



        nova sintaxe
            Tira partido de toda infra-estrutura JEE, com +10 anos de maturidade
        ●



            Deploy directo para qualquer container JEE
        ●



            Reutiliza todos o investimento feito a aprender um conjunto de tools em
        ●



        volta da plataforma JAVA [Sprint / Hibernate / Maven / Ant / JPA..]
            Permite “Mix and Match” entre código JAVA e código Groovy
        ●
Groovy Up Your Code




            O que torna o Groovy diferente ?
            All the JAVA Good Stuff
        ●



                Threading, Security, debugging
            ●



                Annotations (ver 1.1-betas/RC*)
            ●



            Tipos estáticos e tipos dinâmicos “Duck Typing”
        ●
Groovy Up Your Code




                      The Landscape of JVM Languages
 Feature rich                                                Optional
                                                             types
                      other
                                           Groovy
                              other


              Dynamic feature call
              for dynamic types
                                         Java bytecode calls for
                                         static type

                                           other
                                                     other



          Java Friendly
Groovy Up Your Code


   public class Filter {

          public static void main (String [] args) {

                                                                                Sample Code Java
                 List list = new ArrayList();
                 list.add(“Rod”);
                 list.add(“Neta”);
                 list.add(“Eric”);
                 list.add(“Missy”);

                 Filter filter = newFilter();
                 List shorts = filter.filterLongerThan(list, 4);
                 System.out.println(shorts.size());

                 Iterator it = shorts.iterator();

                 while(it.hasNext()) {
                        System.out.println(it.next());
                 }
          } //main

           public List filterLonger(List list, int lenght) {
                     List result = new ArrayList();
                     Iterator it = list.iterator();
                     while(it.hasNext()) {
                             String item = it.next();
                             if (item.length() <= length) {result.add(item);}
                     }
           } //filterLonger
   } //Filter
Groovy Up Your Code




    Sample Code Groovy
    def list = [“Neeta”, “Rod”, “Eric”, “Missy”]

    def shorts = list.findAll { it.size () <= 4 }

    println shorts.size()

    shorts.each { println it }
Groovy Up Your Code




                                    Agenda
          O que é o Groovy ?
      ●



          Será que preciso de mais uma linguagem de scripting ?
      ●



          Características Básicas
      ●



          Características Avançadas
      ●



          Demos
      ●



          The Goodies
      ●



          Conclusão
      ●



          Referências
      ●



          Q&A
      ●
Groovy Up Your Code




                       Características Básicas
            Tipos dinâmicos e tipos estáticos (opcionais)
           ●



            Sintaxe nativa para listas e mapas
           ●



            Ranges
           ●



            Closures
           ●



            Overloading de operadores
           ●



            Suporte para expressões regulares na linguagem
           ●



            Groovy SDK
           ●
Groovy Up Your Code




                             Características Básicas
          Tipos dinâmicos e tipos estáticos (opcionais)
             int myVar = 3

            def myVar = “Welcome to CodeBits”


          Sintaxe nativa para listas e mapas
          def myList = [“Code”, “Bits” , 2007 ]

          printf myList[0]
               -- Code

          def myMap = [“CodeBits2007”: 400, “CodeBits:2008”:1100, “CodeBits:2008”:2000]

          printf myMap[“CodeBits2007”] ou println myMap.CodeBits2007
               -- 400
Groovy Up Your Code




                 Características Básicas(cont.)
         Ranges
               def alphabet = 'a'..'z'

               for (letter in alphabet) {
                       print letter + ' '
               }
                       -- a b c d e f g h i j k l m n o p q r s t u v w x y z
              -----------------------------------------------------

               for (count in 1..10) {
                     print count + ' '
               }
Groovy Up Your Code




                 Características Básicas(cont.)
          Closures

                def simponsMap = [quot;Homerquot;:quot;donutsquot;, quot;Margequot;:quot;Big Blue Hairquot;, quot;Lisaquot;:quot;the Saxquot;]

                simponsMap.each { name, what -> printf quot;$name Simpon likes $what.nquot;}

                      -- Homer Simpon likes donuts.

                      -- Marge Simpon likes Big Blue Hair.

                      -- Lisa Simpon likes The Sax.


           Overloading de operadores
                def list = [1,2,3,4,5,6] + [7,8,9,10]

                list.each { print it }

                      -- 12345678910
Groovy Up Your Code




                 Características Básicas(cont.)
            Suporte para expressões regulares na linguagem
                if ( “name” ==~ “na.*”) { println “It a Match!”}

                // -----------------------------------------------------------
                def regexp = /Paulo.*/

                def name1        = quot;PauloSilvaquot;
                def name2        = quot;JoseSilvaquot;

                def isFirstNamePaulo(name, reg) {
                   if (name ==~ reg) { println quot;matchnquot;}
                }
                isFirstNamePaulo(name1, regexp)
                isFirstNamePaulo(name2, regexp)
Groovy Up Your Code




                    Características Básicas(cont.)
         Groovy SDK - métodos extras ao JDK

                Manipulação de string
            ●



                    center(), contains(), count(), each(), padLeft(), padRight(), getAt(), etc
                ●



                Manipulação de colecções
            ●



                    reverseEach(), count(), collect(), join(),sort(), max(), min(), toList(), etc
                ●



                File
            ●



                    EachFile(), withPrintWriter(), write(), getText(), etc
                ●
Groovy Up Your Code




                                    Agenda
          O que é o Groovy ?
      ●



          Será que preciso de mais uma linguagem de scripting ?
      ●



          Características Básicas
      ●



          Características Avançadas
      ●



          Demos
      ●



          The Goodies
      ●



          Conclusão
      ●



          Referências
      ●



          Q&A
      ●
Groovy Up Your Code




                        Características Avançadas
               Suporte nativo para estruturas hierárquicas
           ●



                       XML
                   ●



                       HTML
                   ●



                       ANT
                   ●



                       SWING
                   ●



                   Navegação segura
               ●



                   Parâmetros com valores default
               ●



                   Currying
               ●
Groovy Up Your Code




           Características Avançadas (Cont.)
           Suporte para estruturas hierárquicas
       ●



               Builders
           ●



                   NodeBuilder
               ●



                   DomBuilder
               ●



                   SwingBuilder
               ●



                   AntBuilder
               ●



                   ...
               ●



               Relativamente fácil acrescentar novos
           ●
Groovy Up Your Code




         Características Avançadas (Cont.)
               Navegação segura, com o operador (?)
           ●


                      def simpson = [quot;Homerquot;: [quot;donutsquot;:20, quot;bearquot;:50, quot;cakesquot;:40]]

                      println simpson.Homer.bear

                           -- 50

                      println simpson.marge.bear

                           -- NullPointerException

                      println simpson?.marge?.bear

                           -- null
Groovy Up Your Code




         Características Avançadas (Cont.)
        Parâmetros com valores default
    ●




               def getFullName(firstName = quot;Josequot;, lastName= quot;Silvaquot;) { return firstName + quot; quot; + lastName }


               getFullName()

                         -- Jose Silva

               getFullName(1,2)

                         -- 1 2

               def getFullName(String firstName = quot;Josequot;, String lastName= quot;Silvaquot;) { .. }
Groovy Up Your Code




           Características Avançadas (Cont.)
           Currying
       ●




                  def c1 = {name, age, location -> println quot;Hi, I'm $name, i have $age and i'm from $location.quot;}

                       .......

                  def c2 = c1.curry(quot;Pauloquot;)

                       .......

                  def c3 = c2.curry(25)

                  println c3(quot;Portugalquot;)

                       -- Hi, I'm Paulo, i have 25 and i'm from Portugal.
Groovy Up Your Code




                          DEMO
                      “Let's get groovy”
Groovy Up Your Code




                                    Agenda
          O que é o Groovy ?
      ●



          Será que preciso de mais uma linguagem de scripting ?
      ●



          Características Básicas
      ●



          Características Avançadas
      ●



          Demos
      ●



          The Goodies
      ●



          Conclusão
      ●



          Referências
      ●



          Q&A
      ●
Groovy Up Your Code




                                   The Goodies
           Grails –Web framework
       ●



           Integração com Web Service
       ●



               GroovySoap (ver 1.0 )
           ●



               GroovyWS (ver 1.1-RC*)
           ●



               XML / RPC
           ●



           Unit Testing Integrado
       ●



               GroovyTestCase, GroovyMock
           ●



           Shell scripting
       ●



               Existem api disponíveis para pipes | cat | grep ...
           ●



                   Groosh module
               ●
Groovy Up Your Code




                                  The Goodies
           Groovy Jabber-RPC
       ●



           Windows Active X ou COM [Scriptom 2.0 Beta]
       ●



               Programar e controlar excel / office ...
           Suporte para SQL com GSQL Module
       ●



           Muito mais ...
       ●



           Tooling
       ●



               Eclipse
           ●



               Intellij IDEA
           ●
Groovy Up Your Code




                                    Agenda
          O que é o Groovy ?
      ●



          Será que preciso de mais uma linguagem de scripting ?
      ●



          Características Básicas
      ●



          Características Avançadas
      ●



          Demos
      ●



          The Goodies
      ●



          Conclusão
      ●



          Referências
      ●



          Q&A
      ●
Groovy Up Your Code




                                Conclusões
           Óptima tool para programadores Java
       ●



           Pronta para projectos não “mission critical”
       ●



           massa critica
       ●



           Opção ao Ruby / Jruby
       ●



           Algumas partes ainda estão em beta, e falta alguma documentação
       ●



           “Lots of Rope to Hang Yourself”
       ●
Groovy Up Your Code




                                   Referências
           Web
       ●



               http://groovy.codehaus.org
           ●



               http://grails.org
           ●



           Books
       ●



               Groovy in Action- Manning 2007
           ●



               Getting Started with Grial – InfoQ by Jason Rudolph
           ●



               Groovy Recipes – Pragmatic Bookshelf
           ●
Groovy Up Your Code




                      Q&A

More Related Content

What's hot

Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012Guillaume Laforge
 
Dsl로 만나는 groovy
Dsl로 만나는 groovyDsl로 만나는 groovy
Dsl로 만나는 groovySeeyoung Chang
 
Improve extension API: C++ as better language for extension
Improve extension API: C++ as better language for extensionImprove extension API: C++ as better language for extension
Improve extension API: C++ as better language for extensionKouhei Sutou
 
Ruby Presentation
Ruby Presentation Ruby Presentation
Ruby Presentation platico_dev
 
Metaprogramming in Ruby
Metaprogramming in RubyMetaprogramming in Ruby
Metaprogramming in RubyRoss Lawley
 
Groovy Finesse
Groovy FinesseGroovy Finesse
Groovy Finessemzgubin
 
MacRuby & HotCocoa
MacRuby & HotCocoaMacRuby & HotCocoa
MacRuby & HotCocoaThilo Utke
 
High Performance Ruby - Golden Gate RubyConf 2012
High Performance Ruby - Golden Gate RubyConf 2012High Performance Ruby - Golden Gate RubyConf 2012
High Performance Ruby - Golden Gate RubyConf 2012Charles Nutter
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Hiroshi SHIBATA
 
Ruby Programming Introduction
Ruby Programming IntroductionRuby Programming Introduction
Ruby Programming IntroductionAnthony Brown
 
Pré Descobrimento Do Brasil
Pré Descobrimento Do BrasilPré Descobrimento Do Brasil
Pré Descobrimento Do Brasilecsette
 
Introduction to Ruby
Introduction to RubyIntroduction to Ruby
Introduction to Rubykim.mens
 

What's hot (15)

Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012
 
Start dart
Start dartStart dart
Start dart
 
Dsl로 만나는 groovy
Dsl로 만나는 groovyDsl로 만나는 groovy
Dsl로 만나는 groovy
 
Ruby programming
Ruby programmingRuby programming
Ruby programming
 
Improve extension API: C++ as better language for extension
Improve extension API: C++ as better language for extensionImprove extension API: C++ as better language for extension
Improve extension API: C++ as better language for extension
 
Ruby Presentation
Ruby Presentation Ruby Presentation
Ruby Presentation
 
Metaprogramming in Ruby
Metaprogramming in RubyMetaprogramming in Ruby
Metaprogramming in Ruby
 
Ruby Presentation - Beamer
Ruby Presentation - BeamerRuby Presentation - Beamer
Ruby Presentation - Beamer
 
Groovy Finesse
Groovy FinesseGroovy Finesse
Groovy Finesse
 
MacRuby & HotCocoa
MacRuby & HotCocoaMacRuby & HotCocoa
MacRuby & HotCocoa
 
High Performance Ruby - Golden Gate RubyConf 2012
High Performance Ruby - Golden Gate RubyConf 2012High Performance Ruby - Golden Gate RubyConf 2012
High Performance Ruby - Golden Gate RubyConf 2012
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
Ruby Programming Introduction
Ruby Programming IntroductionRuby Programming Introduction
Ruby Programming Introduction
 
Pré Descobrimento Do Brasil
Pré Descobrimento Do BrasilPré Descobrimento Do Brasil
Pré Descobrimento Do Brasil
 
Introduction to Ruby
Introduction to RubyIntroduction to Ruby
Introduction to Ruby
 

Viewers also liked

Tutorial Google
Tutorial  GoogleTutorial  Google
Tutorial Googlechemaboj
 
Future of Design Now with Michael Surtees
Future of Design Now with Michael SurteesFuture of Design Now with Michael Surtees
Future of Design Now with Michael SurteesMichael Surtees
 
The ICNP BaT from translation tool to translation server
The ICNP BaT from translation tool to translation serverThe ICNP BaT from translation tool to translation server
The ICNP BaT from translation tool to translation serverUlrich Schrader
 
Acceptance, Usage, and Communication Patters of a Blogging Exercise for Students
Acceptance, Usage, and Communication Patters of a Blogging Exercise for StudentsAcceptance, Usage, and Communication Patters of a Blogging Exercise for Students
Acceptance, Usage, and Communication Patters of a Blogging Exercise for StudentsUlrich Schrader
 
Offene Lehrveranstaltungen mit Web 2.0 Technologien
Offene Lehrveranstaltungen mit Web 2.0 TechnologienOffene Lehrveranstaltungen mit Web 2.0 Technologien
Offene Lehrveranstaltungen mit Web 2.0 TechnologienUlrich Schrader
 
Unexpected Narratives and Creating the Right Conditions
Unexpected Narratives and Creating the Right ConditionsUnexpected Narratives and Creating the Right Conditions
Unexpected Narratives and Creating the Right ConditionsMichael Surtees
 
The ICNP-BaT - A multilingual web-based tool to support the collaborative tra...
The ICNP-BaT - A multilingual web-based tool to support the collaborative tra...The ICNP-BaT - A multilingual web-based tool to support the collaborative tra...
The ICNP-BaT - A multilingual web-based tool to support the collaborative tra...Ulrich Schrader
 
Desenvolvimento Ágil e Scrum 101
Desenvolvimento Ágil e Scrum 101Desenvolvimento Ágil e Scrum 101
Desenvolvimento Ágil e Scrum 101Paulo Traça
 
Rahast
RahastRahast
Rahasttimpsu
 
Turning serendipity into predictable patterns of inspiration
Turning serendipity into predictable patterns of inspirationTurning serendipity into predictable patterns of inspiration
Turning serendipity into predictable patterns of inspirationMichael Surtees
 
Scaling Personalities (Adaption, White Labels And the Digital Ecosystem)
Scaling Personalities (Adaption, White Labels And the Digital Ecosystem)Scaling Personalities (Adaption, White Labels And the Digital Ecosystem)
Scaling Personalities (Adaption, White Labels And the Digital Ecosystem)Michael Surtees
 
DevOps, Agile methods and Continuous Improvement in the Software development ...
DevOps, Agile methods and Continuous Improvement in the Software development ...DevOps, Agile methods and Continuous Improvement in the Software development ...
DevOps, Agile methods and Continuous Improvement in the Software development ...Paulo Traça
 
Technology Use v. Technology Integration
Technology Use v. Technology IntegrationTechnology Use v. Technology Integration
Technology Use v. Technology Integrationesharff
 
Observing, Remembering & Sharing
Observing, Remembering & SharingObserving, Remembering & Sharing
Observing, Remembering & SharingMichael Surtees
 

Viewers also liked (19)

Tutorial Google
Tutorial  GoogleTutorial  Google
Tutorial Google
 
Future of Design Now with Michael Surtees
Future of Design Now with Michael SurteesFuture of Design Now with Michael Surtees
Future of Design Now with Michael Surtees
 
The ICNP BaT from translation tool to translation server
The ICNP BaT from translation tool to translation serverThe ICNP BaT from translation tool to translation server
The ICNP BaT from translation tool to translation server
 
Acceptance, Usage, and Communication Patters of a Blogging Exercise for Students
Acceptance, Usage, and Communication Patters of a Blogging Exercise for StudentsAcceptance, Usage, and Communication Patters of a Blogging Exercise for Students
Acceptance, Usage, and Communication Patters of a Blogging Exercise for Students
 
Statistik - Teil 6
Statistik - Teil 6Statistik - Teil 6
Statistik - Teil 6
 
Offene Lehrveranstaltungen mit Web 2.0 Technologien
Offene Lehrveranstaltungen mit Web 2.0 TechnologienOffene Lehrveranstaltungen mit Web 2.0 Technologien
Offene Lehrveranstaltungen mit Web 2.0 Technologien
 
Unexpected Narratives and Creating the Right Conditions
Unexpected Narratives and Creating the Right ConditionsUnexpected Narratives and Creating the Right Conditions
Unexpected Narratives and Creating the Right Conditions
 
The ICNP-BaT - A multilingual web-based tool to support the collaborative tra...
The ICNP-BaT - A multilingual web-based tool to support the collaborative tra...The ICNP-BaT - A multilingual web-based tool to support the collaborative tra...
The ICNP-BaT - A multilingual web-based tool to support the collaborative tra...
 
Desenvolvimento Ágil e Scrum 101
Desenvolvimento Ágil e Scrum 101Desenvolvimento Ágil e Scrum 101
Desenvolvimento Ágil e Scrum 101
 
Rahast
RahastRahast
Rahast
 
Babylon in der pflege
Babylon in der pflegeBabylon in der pflege
Babylon in der pflege
 
Turning serendipity into predictable patterns of inspiration
Turning serendipity into predictable patterns of inspirationTurning serendipity into predictable patterns of inspiration
Turning serendipity into predictable patterns of inspiration
 
Scaling Personalities (Adaption, White Labels And the Digital Ecosystem)
Scaling Personalities (Adaption, White Labels And the Digital Ecosystem)Scaling Personalities (Adaption, White Labels And the Digital Ecosystem)
Scaling Personalities (Adaption, White Labels And the Digital Ecosystem)
 
Week 1 Evidence
Week 1  EvidenceWeek 1  Evidence
Week 1 Evidence
 
Google Suite
Google SuiteGoogle Suite
Google Suite
 
DevOps, Agile methods and Continuous Improvement in the Software development ...
DevOps, Agile methods and Continuous Improvement in the Software development ...DevOps, Agile methods and Continuous Improvement in the Software development ...
DevOps, Agile methods and Continuous Improvement in the Software development ...
 
Technology Use v. Technology Integration
Technology Use v. Technology IntegrationTechnology Use v. Technology Integration
Technology Use v. Technology Integration
 
2 Pflegeterminologien
2 Pflegeterminologien2 Pflegeterminologien
2 Pflegeterminologien
 
Observing, Remembering & Sharing
Observing, Remembering & SharingObserving, Remembering & Sharing
Observing, Remembering & Sharing
 

Similar to Groovy Up Your Code

Gr8Conf US 2017 - From Java to Groovy: Adventure Time!
Gr8Conf US 2017 - From Java to Groovy: Adventure Time!Gr8Conf US 2017 - From Java to Groovy: Adventure Time!
Gr8Conf US 2017 - From Java to Groovy: Adventure Time!Iván López Martín
 
Groovy a Scripting Language for Java
Groovy a Scripting Language for JavaGroovy a Scripting Language for Java
Groovy a Scripting Language for JavaCharles Anderson
 
Groovy Finesse
Groovy FinesseGroovy Finesse
Groovy Finessemzgubin
 
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume LaforgeGroovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume LaforgeGuillaume Laforge
 
Groovy And Grails Introduction
Groovy And Grails IntroductionGroovy And Grails Introduction
Groovy And Grails IntroductionEric Weimer
 
Why don't you Groovy?
Why don't you Groovy?Why don't you Groovy?
Why don't you Groovy?Orest Ivasiv
 
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 LaforgeGuillaume Laforge
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyelliando dias
 
Developing cross platform desktop application with Ruby
Developing cross platform desktop application with RubyDeveloping cross platform desktop application with Ruby
Developing cross platform desktop application with RubyAnis Ahmad
 
Practical Domain-Specific Languages in Groovy
Practical Domain-Specific Languages in GroovyPractical Domain-Specific Languages in Groovy
Practical Domain-Specific Languages in GroovyGuillaume Laforge
 
JRuby - Enterprise 2.0
JRuby - Enterprise 2.0JRuby - Enterprise 2.0
JRuby - Enterprise 2.0Jan Sifra
 
Dynamic Languages on the JVM
Dynamic Languages on the JVMDynamic Languages on the JVM
Dynamic Languages on the JVMelliando dias
 
Startup groovysession1
Startup groovysession1Startup groovysession1
Startup groovysession1kyon mm
 
Java Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easyroialdaag
 

Similar to Groovy Up Your Code (20)

Practical Groovy DSL
Practical Groovy DSLPractical Groovy DSL
Practical Groovy DSL
 
Gr8Conf US 2017 - From Java to Groovy: Adventure Time!
Gr8Conf US 2017 - From Java to Groovy: Adventure Time!Gr8Conf US 2017 - From Java to Groovy: Adventure Time!
Gr8Conf US 2017 - From Java to Groovy: Adventure Time!
 
Groovy a Scripting Language for Java
Groovy a Scripting Language for JavaGroovy a Scripting Language for Java
Groovy a Scripting Language for Java
 
Groovy Finesse
Groovy FinesseGroovy Finesse
Groovy Finesse
 
Groovy & Grails
Groovy & GrailsGroovy & Grails
Groovy & Grails
 
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume LaforgeGroovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
 
OpenLogic
OpenLogicOpenLogic
OpenLogic
 
Groovy And Grails Introduction
Groovy And Grails IntroductionGroovy And Grails Introduction
Groovy And Grails Introduction
 
Why don't you Groovy?
Why don't you Groovy?Why don't you Groovy?
Why don't you Groovy?
 
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
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRuby
 
Developing cross platform desktop application with Ruby
Developing cross platform desktop application with RubyDeveloping cross platform desktop application with Ruby
Developing cross platform desktop application with Ruby
 
Practical Domain-Specific Languages in Groovy
Practical Domain-Specific Languages in GroovyPractical Domain-Specific Languages in Groovy
Practical Domain-Specific Languages in Groovy
 
Amoocon May 2009 Germany
Amoocon May 2009   GermanyAmoocon May 2009   Germany
Amoocon May 2009 Germany
 
JRuby - Enterprise 2.0
JRuby - Enterprise 2.0JRuby - Enterprise 2.0
JRuby - Enterprise 2.0
 
Dynamic Languages on the JVM
Dynamic Languages on the JVMDynamic Languages on the JVM
Dynamic Languages on the JVM
 
Startup groovysession1
Startup groovysession1Startup groovysession1
Startup groovysession1
 
Ruby
RubyRuby
Ruby
 
Intro to J Ruby
Intro to J RubyIntro to J Ruby
Intro to J Ruby
 
Java Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easy
 

Recently uploaded

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Groovy Up Your Code

  • 1. GROOVY UP YOUR CODE Paulo Traça CTO paulo.traca@logical-software.com LOGICAL SOFTWARE Human Capital | Enterprise Java | Research Rua Gago Coutinho nº4 B 2675-509 Odivelas T +351 21 931 50 33 F +351 21 931 82 52 E info@logical-software.com Web www.logical-software.com
  • 2. Groovy Up Your Code Objectivos da Sessão Conhecer as principais potencialidade dos Groovy ● Perceber em que o Groovy pode ser útil ● “Be more Groovy” :-) ●
  • 3. Groovy Up Your Code Agenda O que é o Groovy ? ● Será que preciso de mais uma linguagem de scripting ? ● Características Básicas ● Características Avançadas ● The Goodies ● Demos ● Conclusão ● Referências ● Q&A ●
  • 4. Groovy Up Your Code Agenda O que é o Groovy ? ● Será que preciso de mais uma linguagem de scripting ? ● Características Básicas ● Características Avançadas ● Demos ● The Goodies ● Conclusão ● Referências ● Q&A ●
  • 5. Groovy Up Your Code O que é o Groovy ? “JAVA ON STEROIDS ...” e não é ilegal... “ Groovy is like a super version of Java. It can leverage Java's enterprise capabilities but also has cool productivity features like closures, builders and dynamic typing. If you are a developer, tester or script guru, you have to love Groovy.”
  • 6. Groovy Up Your Code O que é Groovy Linguagem ágil para JVM ● Sintaxe idêntica Java, curva da aprendizagem baixa para prog. ● Java Linguagem dinâmica, Orientada a objectos ● Características da linguagem derivadas do Ruby, Python e ● SmallTalk JCP 241 ●
  • 7. Groovy Up Your Code O que é Groovy Suporte para DSL's (Domain Specific Languages) ● Suporte para Shell/ Builds scripts [cat | grep ... / Ant DSL] ● Unit Testing and Mock Object “out of the Box” ● Totalmente compatível com JAVA objects e bibliotecas ● Compila directamente para JVM bytecode ●
  • 8. Groovy Up Your Code Agenda O que é o Groovy ? ● Será que preciso de mais uma linguagem de scripting ? ● Características Básicas ● Características Avançadas ● Demos ● The Goodies ● Conclusão ● Referências ● Q&A ●
  • 9. Groovy Up Your Code Porque investir no Groovy ? Proliferação de linguagens de scripting ● “The c00l new guy” - Ruby / RoR ● “The c00l new guy – Take 2” JRuby ● Python, Smalltalk ... { fill in with your favorite scripting language } ●
  • 10. Groovy Up Your Code O que torna o Groovy diferente ? JAVA / JVM compatível ● Se sabes JAVA, praticamente sabes Groovy ● Não obriga um novo investimento para aprender uma nova linguagem / ● nova sintaxe Tira partido de toda infra-estrutura JEE, com +10 anos de maturidade ● Deploy directo para qualquer container JEE ● Reutiliza todos o investimento feito a aprender um conjunto de tools em ● volta da plataforma JAVA [Sprint / Hibernate / Maven / Ant / JPA..] Permite “Mix and Match” entre código JAVA e código Groovy ●
  • 11. Groovy Up Your Code O que torna o Groovy diferente ? All the JAVA Good Stuff ● Threading, Security, debugging ● Annotations (ver 1.1-betas/RC*) ● Tipos estáticos e tipos dinâmicos “Duck Typing” ●
  • 12. Groovy Up Your Code The Landscape of JVM Languages Feature rich Optional types other Groovy other Dynamic feature call for dynamic types Java bytecode calls for static type other other Java Friendly
  • 13. Groovy Up Your Code public class Filter { public static void main (String [] args) { Sample Code Java List list = new ArrayList(); list.add(“Rod”); list.add(“Neta”); list.add(“Eric”); list.add(“Missy”); Filter filter = newFilter(); List shorts = filter.filterLongerThan(list, 4); System.out.println(shorts.size()); Iterator it = shorts.iterator(); while(it.hasNext()) { System.out.println(it.next()); } } //main public List filterLonger(List list, int lenght) { List result = new ArrayList(); Iterator it = list.iterator(); while(it.hasNext()) { String item = it.next(); if (item.length() <= length) {result.add(item);} } } //filterLonger } //Filter
  • 14. Groovy Up Your Code Sample Code Groovy def list = [“Neeta”, “Rod”, “Eric”, “Missy”] def shorts = list.findAll { it.size () <= 4 } println shorts.size() shorts.each { println it }
  • 15. Groovy Up Your Code Agenda O que é o Groovy ? ● Será que preciso de mais uma linguagem de scripting ? ● Características Básicas ● Características Avançadas ● Demos ● The Goodies ● Conclusão ● Referências ● Q&A ●
  • 16. Groovy Up Your Code Características Básicas Tipos dinâmicos e tipos estáticos (opcionais) ● Sintaxe nativa para listas e mapas ● Ranges ● Closures ● Overloading de operadores ● Suporte para expressões regulares na linguagem ● Groovy SDK ●
  • 17. Groovy Up Your Code Características Básicas Tipos dinâmicos e tipos estáticos (opcionais) int myVar = 3 def myVar = “Welcome to CodeBits” Sintaxe nativa para listas e mapas def myList = [“Code”, “Bits” , 2007 ] printf myList[0] -- Code def myMap = [“CodeBits2007”: 400, “CodeBits:2008”:1100, “CodeBits:2008”:2000] printf myMap[“CodeBits2007”] ou println myMap.CodeBits2007 -- 400
  • 18. Groovy Up Your Code Características Básicas(cont.) Ranges def alphabet = 'a'..'z' for (letter in alphabet) { print letter + ' ' } -- a b c d e f g h i j k l m n o p q r s t u v w x y z ----------------------------------------------------- for (count in 1..10) { print count + ' ' }
  • 19. Groovy Up Your Code Características Básicas(cont.) Closures def simponsMap = [quot;Homerquot;:quot;donutsquot;, quot;Margequot;:quot;Big Blue Hairquot;, quot;Lisaquot;:quot;the Saxquot;] simponsMap.each { name, what -> printf quot;$name Simpon likes $what.nquot;} -- Homer Simpon likes donuts. -- Marge Simpon likes Big Blue Hair. -- Lisa Simpon likes The Sax. Overloading de operadores def list = [1,2,3,4,5,6] + [7,8,9,10] list.each { print it } -- 12345678910
  • 20. Groovy Up Your Code Características Básicas(cont.) Suporte para expressões regulares na linguagem if ( “name” ==~ “na.*”) { println “It a Match!”} // ----------------------------------------------------------- def regexp = /Paulo.*/ def name1 = quot;PauloSilvaquot; def name2 = quot;JoseSilvaquot; def isFirstNamePaulo(name, reg) { if (name ==~ reg) { println quot;matchnquot;} } isFirstNamePaulo(name1, regexp) isFirstNamePaulo(name2, regexp)
  • 21. Groovy Up Your Code Características Básicas(cont.) Groovy SDK - métodos extras ao JDK Manipulação de string ● center(), contains(), count(), each(), padLeft(), padRight(), getAt(), etc ● Manipulação de colecções ● reverseEach(), count(), collect(), join(),sort(), max(), min(), toList(), etc ● File ● EachFile(), withPrintWriter(), write(), getText(), etc ●
  • 22. Groovy Up Your Code Agenda O que é o Groovy ? ● Será que preciso de mais uma linguagem de scripting ? ● Características Básicas ● Características Avançadas ● Demos ● The Goodies ● Conclusão ● Referências ● Q&A ●
  • 23. Groovy Up Your Code Características Avançadas Suporte nativo para estruturas hierárquicas ● XML ● HTML ● ANT ● SWING ● Navegação segura ● Parâmetros com valores default ● Currying ●
  • 24. Groovy Up Your Code Características Avançadas (Cont.) Suporte para estruturas hierárquicas ● Builders ● NodeBuilder ● DomBuilder ● SwingBuilder ● AntBuilder ● ... ● Relativamente fácil acrescentar novos ●
  • 25. Groovy Up Your Code Características Avançadas (Cont.) Navegação segura, com o operador (?) ● def simpson = [quot;Homerquot;: [quot;donutsquot;:20, quot;bearquot;:50, quot;cakesquot;:40]] println simpson.Homer.bear -- 50 println simpson.marge.bear -- NullPointerException println simpson?.marge?.bear -- null
  • 26. Groovy Up Your Code Características Avançadas (Cont.) Parâmetros com valores default ● def getFullName(firstName = quot;Josequot;, lastName= quot;Silvaquot;) { return firstName + quot; quot; + lastName } getFullName() -- Jose Silva getFullName(1,2) -- 1 2 def getFullName(String firstName = quot;Josequot;, String lastName= quot;Silvaquot;) { .. }
  • 27. Groovy Up Your Code Características Avançadas (Cont.) Currying ● def c1 = {name, age, location -> println quot;Hi, I'm $name, i have $age and i'm from $location.quot;} ....... def c2 = c1.curry(quot;Pauloquot;) ....... def c3 = c2.curry(25) println c3(quot;Portugalquot;) -- Hi, I'm Paulo, i have 25 and i'm from Portugal.
  • 28. Groovy Up Your Code DEMO “Let's get groovy”
  • 29. Groovy Up Your Code Agenda O que é o Groovy ? ● Será que preciso de mais uma linguagem de scripting ? ● Características Básicas ● Características Avançadas ● Demos ● The Goodies ● Conclusão ● Referências ● Q&A ●
  • 30. Groovy Up Your Code The Goodies Grails –Web framework ● Integração com Web Service ● GroovySoap (ver 1.0 ) ● GroovyWS (ver 1.1-RC*) ● XML / RPC ● Unit Testing Integrado ● GroovyTestCase, GroovyMock ● Shell scripting ● Existem api disponíveis para pipes | cat | grep ... ● Groosh module ●
  • 31. Groovy Up Your Code The Goodies Groovy Jabber-RPC ● Windows Active X ou COM [Scriptom 2.0 Beta] ● Programar e controlar excel / office ... Suporte para SQL com GSQL Module ● Muito mais ... ● Tooling ● Eclipse ● Intellij IDEA ●
  • 32. Groovy Up Your Code Agenda O que é o Groovy ? ● Será que preciso de mais uma linguagem de scripting ? ● Características Básicas ● Características Avançadas ● Demos ● The Goodies ● Conclusão ● Referências ● Q&A ●
  • 33. Groovy Up Your Code Conclusões Óptima tool para programadores Java ● Pronta para projectos não “mission critical” ● massa critica ● Opção ao Ruby / Jruby ● Algumas partes ainda estão em beta, e falta alguma documentação ● “Lots of Rope to Hang Yourself” ●
  • 34. Groovy Up Your Code Referências Web ● http://groovy.codehaus.org ● http://grails.org ● Books ● Groovy in Action- Manning 2007 ● Getting Started with Grial – InfoQ by Jason Rudolph ● Groovy Recipes – Pragmatic Bookshelf ●
  • 35. Groovy Up Your Code Q&A