SlideShare a Scribd company logo
1 of 96
Download to read offline
2011.1.24
Slide # 2   DevLOVE   Groovy 2011.1.24
http://d.hatena.ne.jp/uehaj/




Slide # 3   DevLOVE   Groovy 2011.1.24
new!          JJUG CCC
               update
Slide # 4   DevLOVE   Groovy 2011.1.24
Slide # 5   DevLOVE   Groovy 2011.1.24
Slide # 6   DevLOVE   Groovy 2011.1.24
import java.io.*;                                     BufferedReader bis = new BufferedReader
import java.net.*;                              (new InputStreamReader(ins));
                                                      String line;
public class SocketAccess {                           while ((line = bis.readLine()) != null) {
                                                        System.out.println(line);
  public static void main(String[] args) {            }
   Socket soc = null;                               }
   InputStream ins = null;                          catch (IOException e) {
   OutputStream outs = null;                          e.printStackTrace();
   try {                                              try {
     soc = new Socket("www.java-users.jp", 80);         if (soc != null) soc.close();
     ins = soc.getInputStream();                      }
     outs = soc.getOutputStream();                    catch(IOException ex) {}
     outs.write("GET / HTTP/1.0nn".getBytes       }
());                                              }
                                                }


  Slide # 7      DevLOVE          Groovy 2011.1.24
import java.io.*;                                     BufferedReader bis = new BufferedReader
import java.net.*;                              (new InputStreamReader(ins));
                                                      String line;
public class SocketAccess {                           while ((line = bis.readLine()) != null) {
                                                        System.out.println(line);
  public static void main(String[] args) {            }
   Socket soc = null;                               }
   InputStream ins = null;                          catch (IOException e) {
   OutputStream outs = null;                          e.printStackTrace();
   try {                                              try {
     soc = new Socket("www.java-users.jp", 80);         if (soc != null) soc.close();
     ins = soc.getInputStream();                      }
     outs = soc.getOutputStream();                    catch(IOException ex) {}
     outs.write("GET / HTTP/1.0nn".getBytes       }
());                                              }
                                                }


  Slide # 8      DevLOVE          Groovy 2011.1.24
import java.io.*;                                     BufferedReader bis = new BufferedReader
import java.net.*;                              (new InputStreamReader(ins));
                                                      String line;
public class SocketAccess {                           while ((line = bis.readLine()) != null) {
                                                        System.out.println(line);
  public static void main(String[] args) {            }
   Socket soc = null;                               }
   InputStream ins = null;                          catch (IOException e) {
   OutputStream outs = null;                          e.printStackTrace();
   try {                                              try {
     soc = new Socket("www.java-users.jp", 80);         if (soc != null) soc.close();
     ins = soc.getInputStream();                      }
     outs = soc.getOutputStream();                    catch(IOException ex) {}
     outs.write("GET / HTTP/1.0nn".getBytes       }
());                                              }
                                                }


  Slide # 8      DevLOVE          Groovy 2011.1.24
import java.io.*;                                     BufferedReader bis = new BufferedReader
import java.net.*;                              (new InputStreamReader(ins));
                                                      String line;
public class SocketAccess {                           while ((line = bis.readLine()) != null) {
                                                        System.out.println(line);
  public static void main(String[] args) {            }
   Socket soc = null;                               }
   InputStream ins = null;                          catch (IOException e) {
   OutputStream outs = null;                          e.printStackTrace();
   try {                                              try {
     soc = new Socket("www.java-users.jp", 80);         if (soc != null) soc.close();
     ins = soc.getInputStream();                      }
     outs = soc.getOutputStream();                    catch(IOException ex) {}
     outs.write("GET / HTTP/1.0nn".getBytes       }
());                                              }
                                                }


  Slide # 9      DevLOVE          Groovy 2011.1.24
import java.io.*;                                     BufferedReader bis = new BufferedReader
import java.net.*;                              (new InputStreamReader(ins));
                                                      String line;
public class SocketAccess {                           while ((line = bis.readLine()) != null) {
                                                        System.out.println(line);
  public static void main(String[] args) {            }
   Socket soc = null;                               }
   InputStream ins = null;                          catch (IOException e) {
   OutputStream outs = null;                          e.printStackTrace();
   try {                                              try {
     soc = new Socket("www.java-users.jp", 80);         if (soc != null) soc.close();
     ins = soc.getInputStream();                      }
     outs = soc.getOutputStream();                    catch(IOException ex) {}
     outs.write("GET / HTTP/1.0nn".getBytes       }
());                                              }
                                                }


  Slide # 9      DevLOVE          Groovy 2011.1.24
BufferedReader bis = new BufferedReader
                                                (new InputStreamReader(ins));
                                                      String line;
public class SocketAccess {                           while ((line = bis.readLine()) != null) {
                                                        System.out.println(line);
  public static void main(String[] args) {            }
   Socket soc = null;                               }
   InputStream ins = null;                          catch (IOException e) {
   OutputStream outs = null;                          e.printStackTrace();
   try {                                              try {
     soc = new Socket("www.java-users.jp", 80);         if (soc != null) soc.close();
     ins = soc.getInputStream();                      }
     outs = soc.getOutputStream();                    catch(IOException ex) {}
     outs.write("GET / HTTP/1.0nn".getBytes       }
());                                              }
                                                }


  Slide #10     DevLOVE           Groovy 2011.1.24
BufferedReader bis = new BufferedReader
                                                (new InputStreamReader(ins));
                                                      String line;
public class SocketAccess {                           while ((line = bis.readLine()) != null) {
                                                        System.out.println(line);
  public static void main(String[] args) {            }
   Socket soc = null;                               }
   InputStream ins = null;                          catch (IOException e) {
   OutputStream outs = null;                          e.printStackTrace();
   try {                                              try {
     soc = new Socket("www.java-users.jp", 80);         if (soc != null) soc.close();
     ins = soc.getInputStream();                      }
     outs = soc.getOutputStream();                    catch(IOException ex) {}
     outs.write("GET / HTTP/1.0nn".getBytes       }
());                                              }
                                                }


  Slide #10     DevLOVE           Groovy 2011.1.24
BufferedReader bis = new BufferedReader
                                                (new InputStreamReader(ins));
                                                    String line;
                                                    while ((line = bis.readLine()) != null) {
                                                      System.out.println(line);
                                                    }
   Socket soc = null;                             }
   InputStream ins = null;                        catch (IOException e) {
   OutputStream outs = null;                        e.printStackTrace();
   try {                                            try {
     soc = new Socket("www.java-users.jp", 80);       if (soc != null) soc.close();
     ins = soc.getInputStream();                    }
     outs = soc.getOutputStream();                  catch(IOException ex) {}
     outs.write("GET / HTTP/1.0nn".getBytes     }
());



  Slide #11     DevLOVE          Groovy 2011.1.24
BufferedReader bis = new BufferedReader
                                                (new InputStreamReader(ins));
                                                    String line;
                                                    while ((line = bis.readLine()) != null) {
                                                      System.out.println(line);
                                                    }
   Socket soc = null;                             }
   InputStream ins = null;                        catch (IOException e) {
   OutputStream outs = null;                        e.printStackTrace();
   try {                                            try {
     soc = new Socket("www.java-users.jp", 80);       if (soc != null) soc.close();
     ins = soc.getInputStream();                    }
     outs = soc.getOutputStream();                  catch(IOException ex) {}
     outs.write("GET / HTTP/1.0nn".getBytes     }
());



  Slide #11     DevLOVE          Groovy 2011.1.24
BufferedReader bis = new BufferedReader
                                                    (new InputStreamReader(ins));
                                                       String line;
                                                       while ((line = bis.readLine()) != null) {
                                                         System.out.println(line);
                                                       }
   Socket soc = null;
   InputStream ins = null;
   OutputStream outs = null;

       soc = new Socket("www.java-users.jp", 80);       if (soc != null) soc.close();
       ins = soc.getInputStream();
       outs = soc.getOutputStream();
       outs.write("GET / HTTP/1.0nn".getBytes
());



   Slide #12       DevLOVE          Groovy 2011.1.24
BufferedReader bis = new BufferedReader
                                                    (new InputStreamReader(ins));
                                                       String line;
                                                       while ((line = bis.readLine()) != null) {
                                                         System.out.println(line);
                                                       }
   Socket soc = null;
   InputStream ins = null;
   OutputStream outs = null;

       soc = new Socket("www.java-users.jp", 80);       if (soc != null) soc.close();
       ins = soc.getInputStream();
       outs = soc.getOutputStream();
       outs.write("GET / HTTP/1.0nn".getBytes
());



   Slide #12       DevLOVE          Groovy 2011.1.24
bis = new BufferedReader(new
                                                    InputStreamReader(ins));
                                                       def line = null;
                                                       while ((line = bis.readLine()) != null) {
                                                         System.out.println(line);
                                                       }
   def soc = null;
   def ins = null;
   def outs = null;

       soc = new Socket("www.java-users.jp", 80);        if (soc != null) soc.close();
       ins = soc.getInputStream();
       outs = soc.getOutputStream();
       outs.write("GET / HTTP/1.0nn".getBytes
());



   Slide #13       DevLOVE          Groovy 2011.1.24
bis = new BufferedReader(new
                                                    InputStreamReader(ins));
                                                       def line = null;
                                                       while ((line = bis.readLine()) != null) {
                                                         System.out.println(line);
                                                       }
   def soc = null;
   def ins = null;
   def outs = null;

       soc = new Socket("www.java-users.jp", 80);        if (soc != null) soc.close();
       ins = soc.getInputStream();
       outs = soc.getOutputStream();
       outs.write("GET / HTTP/1.0nn".getBytes
());



   Slide #13       DevLOVE          Groovy 2011.1.24
bis = new BufferedReader(new
                                                  InputStreamReader(ins));
                                                      def line = null;
                                                      while ((line = bis.readLine()) != null) {
                                                        System.out.println(line);
                                                      }
                                                    }



    new Socket("www.java-users.jp",
80).withStreams { ins, outs ->

       outs.write("GET / HTTP/1.0nn".getBytes
());



   Slide #14       DevLOVE          Groovy 2011.1.24
bis = new BufferedReader(new
                                                  InputStreamReader(ins));
                                                      def line = null;
                                                      while ((line = bis.readLine()) != null) {
                                                        System.out.println(line);
                                                      }
                                                    }



    new Socket("www.java-users.jp",
80).withStreams { ins, outs ->

       outs.write("GET / HTTP/1.0nn".getBytes
());



   Slide #14       DevLOVE          Groovy 2011.1.24
ins.eachLine{ line ->
                                                          System.out.println(line);
                                                        }
                                                   }



    new Socket("www.java-users.jp",
80).withStreams { ins, outs ->

       outs.write("GET / HTTP/1.0nn".getBytes
());



   Slide #15       DevLOVE          Groovy 2011.1.24
new Socket("www.java-users.jp", 80).withStreams { ins, outs ->
    outs.write("GET / HTTP/1.0nn".getBytes());
    ins.eachLine { line ->
     System.out.println(line);
   }
 }




Slide #16    DevLOVE           Groovy 2011.1.24
new Socket("www.java-users.jp", 80).withStreams { ins, outs ->
    outs.write("GET / HTTP/1.0nn".getBytes());
    ins.eachLine { line ->
     System.out.println(line);
   }
 }




Slide #17    DevLOVE           Groovy 2011.1.24
new Socket("www.java-users.jp", 80).withStreams { ins, outs ->
    outs.write("GET / HTTP/1.0nn".getBytes());
    ins.eachLine { line ->
     System.out.println(line);
   }
 }




Slide #17    DevLOVE           Groovy 2011.1.24
new Socket("www.java-users.jp", 80).withStreams { ins, outs ->
    outs.write("GET / HTTP/1.0nn".bytes);
    ins.eachLine { line ->
     System.out.println(line);
   }
 }




Slide #18    DevLOVE           Groovy 2011.1.24
new Socket("www.java-users.jp", 80).withStreams { ins, outs ->
    outs.write("GET / HTTP/1.0nn".bytes);
    ins.eachLine { line ->
     System.out.println(line);
   }
 }




Slide #18    DevLOVE           Groovy 2011.1.24
new Socket("www.java-users.jp", 80).withStreams { ins, outs ->
    outs.write("GET / HTTP/1.0nn".bytes);
    ins.eachLine { line ->
     println(line);
   }
 }




Slide #19    DevLOVE           Groovy 2011.1.24
new Socket("www.java-users.jp", 80).withStreams { ins, outs ->
    outs.write("GET / HTTP/1.0nn".bytes);
    ins.eachLine { line ->
     println(line);
   }
 }




Slide #19    DevLOVE           Groovy 2011.1.24
new Socket("www.java-users.jp", 80).withStreams { ins, outs ->
    outs.write("GET / HTTP/1.0nn".bytes);
    ins.eachLine {
     println(it);
   }
 }




Slide #20    DevLOVE           Groovy 2011.1.24
new Socket("www.java-users.jp", 80).withStreams { ins, outs ->
    outs.write("GET / HTTP/1.0nn".bytes);
    ins.eachLine {
     println(it);
   }
 }




Slide #20    DevLOVE           Groovy 2011.1.24
new Socket("www.java-users.jp", 80).withStreams { ins, outs ->
    outs.write("GET / HTTP/1.0nn".bytes)
    ins.eachLine {
     println(it)
   }
 }




Slide #21    DevLOVE           Groovy 2011.1.24
new Socket("www.java-users.jp", 80).withStreams { ins, outs ->
    outs.write("GET / HTTP/1.0nn".bytes)
    ins.eachLine {
     println(it)
   }
 }




Slide #21    DevLOVE           Groovy 2011.1.24
new Socket("www.java-users.jp", 80).withStreams { ins, outs ->
     outs.write "GET / HTTP/1.0nn".bytes
     ins.eachLine {
      println it
    }
  }




Slide #22   DevLOVE       Groovy 2011.1.24
println new URL("http://www.java-users.jp").text




Slide #23   DevLOVE   Groovy 2011.1.24
println new URL("http://www.java-users.jp").text




       Java      Groovy




                                         Java 7



Slide #23   DevLOVE   Groovy 2011.1.24
Gaelyk
                                Grails(Web)
     GSQL                        GSP,GORM
     SwingBuilder               Griffon(GUI)
     MarkupBuilder
                                           GMaven,Maven3
                 /DSL
                                           Hudson   JBoss
      Gant                                 FreeMind
      Gradle
      Spock,EasyB              Gpars
                               Groovy++
Slide #24   DevLOVE     Groovy 2011.1.24
Slide # 25   DevLOVE   Groovy 2011.1.24
Slide #26   DevLOVE   Groovy 2011.1.24
Slide #27   DevLOVE   Groovy 2011.1.24
@Grab('net.sourceforge.htmlunit:htmlunit:2.8')
  import com.gargoylesoftware.htmlunit.WebClient;

  // Ant Bzip2
  new AntBuilder().bzip2(src:args[0], zipfile:args[0]+".bz2")
  // HtmlUnit
  url = "http://pukiwiki.example.com/index.php?
  plugin=attach&pcmd=upload&page=test"
  page = new WebClient().getPage(url)
  file = page.getElementById('_p_attach_file')
  file.valueAttribute = args[0]+".bz2"
  page.getByXPath("//input[@value='          ']")[0].click()




Slide #28   DevLOVE   Groovy 2011.1.24
@Grab('net.sourceforge.htmlunit:htmlunit:2.8')
  import com.gargoylesoftware.htmlunit.WebClient;

  // Ant Bzip2
  new AntBuilder().bzip2(src:args[0], zipfile:args[0]+".bz2")
  // HtmlUnit
  url = "http://pukiwiki.example.com/index.php?
  plugin=attach&pcmd=upload&page=test"
  page = new WebClient().getPage(url)
  file = page.getElementById('_p_attach_file')
  file.valueAttribute = args[0]+".bz2"
  page.getByXPath("//input[@value='          ']")[0].click()




Slide #28   DevLOVE   Groovy 2011.1.24
@Grab('net.sourceforge.htmlunit:htmlunit:2.8')
  import com.gargoylesoftware.htmlunit.WebClient;

  // Ant Bzip2
  new AntBuilder().bzip2(src:args[0], zipfile:args[0]+".bz2")
  // HtmlUnit
  url = "http://pukiwiki.example.com/index.php?
  plugin=attach&pcmd=upload&page=test"
  page = new WebClient().getPage(url)
  file = page.getElementById('_p_attach_file')
  file.valueAttribute = args[0]+".bz2"
  page.getByXPath("//input[@value='          ']")[0].click()




Slide #28   DevLOVE   Groovy 2011.1.24
@Grab('net.sourceforge.htmlunit:htmlunit:2.8')
  import com.gargoylesoftware.htmlunit.WebClient;

  // Ant Bzip2
  new AntBuilder().bzip2(src:args[0], zipfile:args[0]+".bz2")
  // HtmlUnit
  url = "http://pukiwiki.example.com/index.php?
  plugin=attach&pcmd=upload&page=test"
  page = new WebClient().getPage(url)
  file = page.getElementById('_p_attach_file')
  file.valueAttribute = args[0]+".bz2"
  page.getByXPath("//input[@value='          ']")[0].click()




Slide #28   DevLOVE   Groovy 2011.1.24
@Grab('net.sourceforge.htmlunit:htmlunit:2.8')
  import com.gargoylesoftware.htmlunit.WebClient;




Slide #29   DevLOVE   Groovy 2011.1.24
// Ant Bzip2
  new AntBuilder().bzip2(src:args[0], zipfile:args[0]+".bz2")




Slide #30   DevLOVE   Groovy 2011.1.24
Slide #31   DevLOVE   Groovy 2011.1.24
cities.csv
                                         ,35676000,
                                                 ,19040000,
                                                      =                 ,1018000,
                                                          ,5492000,




Slide #31   DevLOVE   Groovy 2011.1.24
cities.csv
                                                 ,35676000,
                                                         ,19040000,
                      ,   ,                                   =                 ,1018000,
                                                                  ,5492000,




Slide #31   DevLOVE           Groovy 2011.1.24
@Grab('com.h2database:h2:1.2.143')
@GrabConfig(systemClassLoader=true)
import groovy.sql.Sql
sql = Sql.newInstance("jdbc:h2:cities")
sql.execute """ CREATE TABLE Cities (
                  id INT IDENTITY PRIMARY KEY, name VARCHAR,
                  population DECIMAL(10), country VARCHAR)"""
cities = sql.dataSet("Cities")
new File("cities.csv").splitEachLine(",") { f1, f2, f3 ->
  //
  cities.add(name:f1, population:f2, country:f3)
}
assert cities.findAll{ it.country=="    " &&
                          it.population>1000000 }.rows()*.name ==
    ['      ', '   =    (   )', '    ', '     ', '   ']




Slide #32     DevLOVE     Groovy 2011.1.24
@Grab('com.h2database:h2:1.2.143')
@GrabConfig(systemClassLoader=true)
import groovy.sql.Sql
sql = Sql.newInstance("jdbc:h2:cities")
sql.execute """ CREATE TABLE Cities (
                  id INT IDENTITY PRIMARY KEY, name VARCHAR,
                  population DECIMAL(10), country VARCHAR)"""
cities = sql.dataSet("Cities")
new File("cities.csv").splitEachLine(",") { f1, f2, f3 ->
  //
  cities.add(name:f1, population:f2, country:f3)
}
assert cities.findAll{ it.country=="    " &&
                          it.population>1000000 }.rows()*.name ==
    ['      ', '   =    (   )', '    ', '     ', '   ']




Slide #32     DevLOVE     Groovy 2011.1.24
@Grab('com.h2database:h2:1.2.143')
@GrabConfig(systemClassLoader=true)
import groovy.sql.Sql
sql = Sql.newInstance("jdbc:h2:cities")
sql.execute """ CREATE TABLE Cities (
                  id INT IDENTITY PRIMARY KEY, name VARCHAR,
                  population DECIMAL(10), country VARCHAR)"""
cities = sql.dataSet("Cities")
new File("cities.csv").splitEachLine(",") { f1, f2, f3 ->
  //
  cities.add(name:f1, population:f2, country:f3)
}
assert cities.findAll{ it.country=="    " &&
                          it.population>1000000 }.rows()*.name ==
    ['      ', '   =    (   )', '    ', '     ', '   ']




Slide #32     DevLOVE     Groovy 2011.1.24
@Grab('com.h2database:h2:1.2.143')
@GrabConfig(systemClassLoader=true)
import groovy.sql.Sql
sql = Sql.newInstance("jdbc:h2:cities")
sql.execute """ CREATE TABLE Cities (
                  id INT IDENTITY PRIMARY KEY, name VARCHAR,
                  population DECIMAL(10), country VARCHAR)"""
cities = sql.dataSet("Cities")
new File("cities.csv").splitEachLine(",") { f1, f2, f3 ->
  //
  cities.add(name:f1, population:f2, country:f3)
}
assert cities.findAll{ it.country=="    " &&
                          it.population>1000000 }.rows()*.name ==
    ['      ', '   =    (   )', '    ', '     ', '   ']




Slide #32     DevLOVE     Groovy 2011.1.24
@Grab('com.h2database:h2:1.2.143')
@GrabConfig(systemClassLoader=true)
import groovy.sql.Sql
sql = Sql.newInstance("jdbc:h2:cities")
sql.execute """ CREATE TABLE Cities (
                  id INT IDENTITY PRIMARY KEY, name VARCHAR,
                  population DECIMAL(10), country VARCHAR)"""
cities = sql.dataSet("Cities")
new File("cities.csv").splitEachLine(",") { f1, f2, f3 ->
  //
  cities.add(name:f1, population:f2, country:f3)
}
assert cities.findAll{ it.country=="    " &&
                          it.population>1000000 }.rows()*.name ==
    ['      ', '   =    (   )', '    ', '     ', '   ']




Slide #32     DevLOVE     Groovy 2011.1.24
@Grab('com.h2database:h2:1.2.143')
@GrabConfig(systemClassLoader=true)
import groovy.sql.Sql




Slide #33   DevLOVE    Groovy 2011.1.24
cities = sql.dataSet("Cities")
new File("cities.csv").splitEachLine(",") { f1, f2, f3 ->
  //
  cities.add(name:f1, population:f2, country:f3)
}




Slide #34   DevLOVE    Groovy 2011.1.24
cities = sql.dataSet("Cities")


assert cities.findAll{ it.country=="          " &&
                          it.population>1000000 }.rows()*.name ==
    ['      ', '   =    (   )', '    ', '     ', '   ']




cities = sql.dataSet("Cities")


assert cities.findAll{ it.country=="          " }
                 .findAll{ it.population>1000000 }.rows()*.name ==
    ['      ', '    =    (   )', '    ', '     ', '   ']




Slide #35     DevLOVE      Groovy 2011.1.24
Slide # 36   DevLOVE   Groovy 2011.1.24
update




                          http://d.hatena.ne.jp/ksky/20090618/p1
Slide #37   DevLOVE   Groovy 2011.1.24
update




                                                                   !




                          http://d.hatena.ne.jp/ksky/20090618/p1
Slide #37   DevLOVE   Groovy 2011.1.24
http://kokucheese.com/event/index/5267/

Slide #38   DevLOVE    Groovy 2011.1.24
http://bit.ly/g5iE0m


Slide #39    DevLOVE      Groovy 2011.1.24
Slide # 40   DevLOVE   Groovy 2011.1.24
Slide #41   DevLOVE   Groovy 2011.1.24
update




Slide #42   DevLOVE   Groovy 2011.1.24
http://kobo.github.com/groovyserv/




Slide # 43   DevLOVE   Groovy 2011.1.24
Slide #44   DevLOVE   Groovy 2011.1.24
Shell Environment                              User Groovy
                                                                   Srcipt
               C
                LA
                SS . lin
                  PA
               cm
                                                              System.in

                    TH
                     d
                                                             System.out

                       en
                         e


                          v
                                                             SYstem.err
                           ar
                              gs

               Ctrl-C
                                  groovyclient          TCP/IP
                                                                   groovyserver
                           n
                      di
                    st
                      de t
                    st dou
                        rr




                                                                          JavaVM
                       st




                               exit status
                                             File System

                                                 Authentication
                                                 Cookie File




Slide #   DevLOVE                  Groovy 2011.1.24
            45
User Groovy
                      Shell Environment
                                 Srcipt
                 C
                  LA
                                                System.in
                  SS . lin
                    PA
                 cm
                                               System.out

                      TH
                       d
                                               SYstem.err

                         en
                           e


                            v
                             ar
                                gs

                 Ctrl-C
                                     groovy


                             n
                        di
                      st
                        de t
                      st dou




                                      JavaVM
                          rr
                         st




                       exit status
                                               File System




Slide #46   DevLOVE               Groovy 2011.1.24
19.6




      normal groovy                                  3.041                         1.0
      Installer   groovy                             1.262                         2.4
      groovyclient(C       )                         0.155                         19.6
      groovyclient(Ruby        )                     0.193                         15.8
                  •Groovy 1.7.3, GroovyServ 0.4-SNAPSHOT, WinXP SP3,Core2Duo 2GHz,JDK1
Slide #           •time
                    DevLOVE real                   10
                                           Groovy 2011.1.24
35.8




         normal groovy                                 1.112                         1.0
         Mac Ports   groovy(1.7.2)                     0.321                         3.5
         groovyclient(C   )                            0.031                         35.8
         groovyclient(Ruby    )                        0.041                         27.1
        •Groovy 1.7.3, GroovyServ 0.4-SNAPSHOT, MacOSX 10.6.3, MacBook Core2duo 2.53GHz, JDK1.6.0u20
        •time            real            10
Slide #48       DevLOVE               Groovy 2011.1.24
for (i=0; i<1000000; i++) {};

       groovy(Client VM)                                            593.7
       groovy(Server VM)                                            243.8
       groovyclient(Client VM)                                      454.6
       groovyclient(Server VM)                                      197.0

                     •Groovy 1.7.3, GroovyServ 0.4, Windows XP SP3(cygwin 1.7.5),Core2duo 2.00GHz, JDK1.6.0u13
Slide #49        DevLOVE
                   •time               Groovy 2011.1.24
                                     real
Groovy

                for (i=0; i<1000000; i++) {};


       scalac                                         6.6      1.0
       fsc                                            1.2      5.5
       scalac/GroovyServ                              1.1      6.6
       fsc/GroovyServ                                 0.4      16.5


Slide #50         DevLOVE                   Groovy 2011.1.24
Slide #51   DevLOVE   Groovy 2011.1.24
Slide #52   DevLOVE   Groovy 2011.1.24
new!


thanks for the great work on groovyserv!
I use it everyday and enjoy its performance.
I also give it lots of credit in my workshops and talks.
(you may have recognized the additional
hackergarten screencast.)
                                                            I was thinking about maybe
                                                              making GroovyServ the
                                                           default way of how groovy
                                                                     executes a script.
 That sounds like a great release to me!
 Congratulations to the team!




    Great work, this thing really helps.


Slide #53    DevLOVE          Groovy 2011.1.24
new!


thanks for the great work on groovyserv!
I use it everyday and enjoy its performance.
I also give it lots of credit in my workshops and talks.
(you may have recognized the additional
hackergarten screencast.)
                                                            I was thinking about maybe
                                                              making GroovyServ the
                                                           default way of how groovy
                                                                     executes a script.
 That sounds like a great release to me!
 Congratulations to the team!




    Great work, this thing really helps.


Slide #53    DevLOVE          Groovy 2011.1.24
Slide #54   DevLOVE   Groovy 2011.1.24
Slide #55   DevLOVE   Groovy 2011.1.24
Slide # 56   DevLOVE   Groovy 2011.1.24
GEP ‥ Groovy Enhancement Proposal
Slide #57   DevLOVE    Groovy 2011.1.24
100
            1   2            3                                                        {         ->
    
  }
              1          100                                 .           (            )

            1         100                                .           (            )
  {         ->
                             + "     6               "
  }
                         "       "
                                                                         http://d.hatena.ne.jp/uehaj/20100919/1284906117


   10.0                                                          18      6
   2                                                             24      6
   6
   [6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72,               :
   78, 84, 90, 96]
   6 6                                                           96      6
   12   6
Slide #58         DevLOVE                Groovy 2011.1.24
(100). (     ).              (          )
            (1). (2). (3).                      (    ).                       (     ({     ->
                 (   ). (                      )
   }))
             (1).       (100).                 ((                 .       (         ))).   (        )

            (1).       (100).              (              .           (           )).           (
   ({         ->
                   (        + "   6                 ").       (               )
   }))
                       ("       ").    (             )




Slide #59      DevLOVE                Groovy 2011.1.24
new
 int fib (int n) {
                                               groovyc
     if (n<=1) return 1
     return fib(n-1) + fib(n-2)               jad
 }




Slide #60   DevLOVE        Groovy 2011.1.24
new
  int fib (int n) {
                                                  groovyc
      if (n<=1) return 1
      return fib(n-1) + fib(n-2)                 jad
  }



public int fib(int n)
{
    CallSite acallsite[] = $getCallSiteArray();
    if(ScriptBytecodeAdapter.compareLessThanEqual
(DefaultTypeTransformation.box(n), $const$0))
        return DefaultTypeTransformation.intUnbox((Integer)
ScriptBytecodeAdapter.castToType($const$0, $get$$class$java$lang$Integer()));
    else
        return DefaultTypeTransformation.intUnbox((Integer)
ScriptBytecodeAdapter.castToType(acallsite[0].call(acallsite[1].callCurrent
(this, acallsite[2].call(DefaultTypeTransformation.box(n), $const$0)),
acallsite[3].callCurrent(this, acallsite[4].call
(DefaultTypeTransformation.box(n), $const$1))), $get$$class$java$lang$Integer
()));
}


 Slide #60    DevLOVE         Groovy 2011.1.24
new
  int fib (int n) {
                                                     groovyc
      if (n<=1) return 1
      return fib(n-1) + fib(n-2)                    jad
  }



                                  public int fib(int n)
public int fib(int n)           {
{                                   CallSite acallsite[] = $getCallSiteArray();
    CallSite acallsite[] = $getCallSiteArray();
                                    if(!ScriptBytecodeAdapter.isOrigInt())
                                        if(ScriptBytecodeAdapter.compareLessThanEqual((Integer)
    if(ScriptBytecodeAdapter.compareLessThanEqual
                                DefaultTypeTransformation.box(n), (Integer)
(DefaultTypeTransformation.box(n), $const$0))
                                DefaultTypeTransformation.box(1)))
        return DefaultTypeTransformation.intUnbox((Integer)
                                            return 1;
ScriptBytecodeAdapter.castToType($const$0, $get$$class$java$lang$Integer()));
                                        else
    else                                    return DefaultTypeTransformation.intUnbox(acallsite
        return DefaultTypeTransformation.intUnbox((Integer)
                                [0].call(acallsite[1].callCurrent(this, acallsite[2].call
ScriptBytecodeAdapter.castToType(acallsite[0].call(acallsite[1].callCurrent
                                ((Integer)DefaultTypeTransformation.box(n), (Integer)
                                DefaultTypeTransformation.box(1))), acallsite[3].callCurrent
(this, acallsite[2].call(DefaultTypeTransformation.box(n), $const$0)),
                                (this, acallsite[4].call((Integer)DefaultTypeTransformation.box
acallsite[3].callCurrent(this, acallsite[4].call
                                (n), (Integer)DefaultTypeTransformation.box(2)))));
(DefaultTypeTransformation.box(n), $const$1))), $get$$class$java$lang$Integer
                                    if(n <= 1)
()));
                                        return 1;
}                                   else
                                          return fib(n - 1) + fib(n - 2);
                                  }
 Slide #60      DevLOVE          Groovy 2011.1.24
new
  int fib (int n) {
                                                     groovyc
      if (n<=1) return 1
      return fib(n-1) + fib(n-2)                    jad
  }



                                  public int fib(int n)
public int fib(int n)           {
{                                   CallSite acallsite[] = $getCallSiteArray();
    CallSite acallsite[] = $getCallSiteArray();
                                    if(!ScriptBytecodeAdapter.isOrigInt())
                                        if(ScriptBytecodeAdapter.compareLessThanEqual((Integer)
    if(ScriptBytecodeAdapter.compareLessThanEqual
                                DefaultTypeTransformation.box(n), (Integer)
(DefaultTypeTransformation.box(n), $const$0))
                                DefaultTypeTransformation.box(1)))
        return DefaultTypeTransformation.intUnbox((Integer)
                                            return 1;
ScriptBytecodeAdapter.castToType($const$0, $get$$class$java$lang$Integer()));
                                        else
    else                                    return DefaultTypeTransformation.intUnbox(acallsite
        return DefaultTypeTransformation.intUnbox((Integer)
                                [0].call(acallsite[1].callCurrent(this, acallsite[2].call
ScriptBytecodeAdapter.castToType(acallsite[0].call(acallsite[1].callCurrent
                                ((Integer)DefaultTypeTransformation.box(n), (Integer)
                                DefaultTypeTransformation.box(1))), acallsite[3].callCurrent
(this, acallsite[2].call(DefaultTypeTransformation.box(n), $const$0)),
                                (this, acallsite[4].call((Integer)DefaultTypeTransformation.box
acallsite[3].callCurrent(this, acallsite[4].call
                                (n), (Integer)DefaultTypeTransformation.box(2)))));
(DefaultTypeTransformation.box(n), $const$1))), $get$$class$java$lang$Integer
                                    if(n <= 1)
()));
                                        return 1;
}                                   else
                                          return fib(n - 1) + fib(n - 2);
                                  }
 Slide #60      DevLOVE          Groovy 2011.1.24
new
  int fib (int n) {
                                                     groovyc
      if (n<=1) return 1
      return fib(n-1) + fib(n-2)                    jad
  }



                                  public int fib(int n)
public int fib(int n)           {
{                                   CallSite acallsite[] = $getCallSiteArray();
                               if(n <= 1)
    CallSite acallsite[] = $getCallSiteArray();
                                    if(!ScriptBytecodeAdapter.isOrigInt())
                                       if(ScriptBytecodeAdapter.compareLessThanEqual((Integer)
                                   return 1;
    if(ScriptBytecodeAdapter.compareLessThanEqual
                                DefaultTypeTransformation.box(n), (Integer)
(DefaultTypeTransformation.box(n), $const$0))
                               else
                                DefaultTypeTransformation.box(1)))
        return DefaultTypeTransformation.intUnbox((Integer)
                                            return 1;
                                       else fib(n - 1) + fib(n - 2);
                                   return
ScriptBytecodeAdapter.castToType($const$0, $get$$class$java$lang$Integer()));
    else                                    return DefaultTypeTransformation.intUnbox(acallsite
        return DefaultTypeTransformation.intUnbox((Integer)
                                [0].call(acallsite[1].callCurrent(this, acallsite[2].call
ScriptBytecodeAdapter.castToType(acallsite[0].call(acallsite[1].callCurrent
                                ((Integer)DefaultTypeTransformation.box(n), (Integer)
                                DefaultTypeTransformation.box(1))), acallsite[3].callCurrent
(this, acallsite[2].call(DefaultTypeTransformation.box(n), $const$0)),
                                (this, acallsite[4].call((Integer)DefaultTypeTransformation.box
acallsite[3].callCurrent(this, acallsite[4].call
                                (n), (Integer)DefaultTypeTransformation.box(2)))));
(DefaultTypeTransformation.box(n), $const$1))), $get$$class$java$lang$Integer
                                    if(n <= 1)
()));
                                        return 1;
}                                   else
                                          return fib(n - 1) + fib(n - 2);
                                  }
 Slide #60      DevLOVE          Groovy 2011.1.24
new
     long begin = System.nanoTime();
     FibJava foo = new FibJava();
     int result = foo.fib(32); //
     long end = System.nanoTime();
     System.out.println("Elapsed time: " + (end - begin) + "ns");


                                                                     (ns)         Java   1


     Groovy 1.7.5                                  1,639,852,000                             66.46

     Groovy 1.8.0 beta 3                                 65,497,000                           2.65

     Java(OpenJDK 1.7)                                   24,672,000                            1.0

            • MacOSX 10.6.3, MacBook Core2duo 2.53GHz,openjdk version "1.7.0-internal"
Slide #61   DevLOVE                 Groovy 2011.1.24
@Invariant({ elements != null })                         
     class Stack {                                                 def boolean is_empty()  {
                                                                       elements.isEmpty()
         private List elements                                     }
                                                             
         @Ensures({ is_empty() })                                  @Requires({ !is_empty() })
         public Stack()  {                                         def last_item()  {
             elements = []                                             elements.last()
         }                                                         }
                                                             
         @Requires({ preElements?.size() >                         def count() {
    0 })                                                               elements.size()
         @Ensures({ !is_empty() })                                 }
         public Stack(List preElements)  {
             elements = preElements
         }
     http://github.com/andresteingress/gcontracts/wiki
Slide #62        DevLOVE                 Groovy 2011.1.24
update
        http://canoo.com/blog/2010/09/20/log-groovys-new-and-extensible-logging-conveniences/

Slide #63       DevLOVE              Groovy 2011.1.24
import groovy.util.logging.Log
     @Log
     class MyClass {
         def invoke() {
             log.info('... an info message')
             log.fine('... a fine message')
         }
     }

    http://canoo.com/blog/2010/09/20/log-groovys-new-and-extensible-logging-conveniences/
Slide #64       DevLOVE              Groovy 2011.1.24
New!




Slide #65   DevLOVE   Groovy 2011.1.24
http://kokucheese.com/event/index/5267/

                      Groovy&Grails exchange 2010@London                by
                 tyama, tamada (               )
                      Gradle       G*                      by   (LITERAL-ICE)

Slide #66   DevLOVE        Groovy 2011.1.24
http://kokucheese.com/event/index/5267/

                      Groovy&Grails exchange 2010@London                by
                 tyama, tamada (               )
                      Gradle       G*                      by   (LITERAL-ICE)

Slide #66   DevLOVE        Groovy 2011.1.24
Slide # 67   DevLOVE   Groovy 2011.1.24

More Related Content

What's hot

AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
HamletDRC
 
AST Transformations
AST TransformationsAST Transformations
AST Transformations
HamletDRC
 
Important java programs(collection+file)
Important java programs(collection+file)Important java programs(collection+file)
Important java programs(collection+file)
Alok Kumar
 
Java 7 at SoftShake 2011
Java 7 at SoftShake 2011Java 7 at SoftShake 2011
Java 7 at SoftShake 2011
julien.ponge
 
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloadingRiga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Anton Arhipov
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
julien.ponge
 
Advanced Java Practical File
Advanced Java Practical FileAdvanced Java Practical File
Advanced Java Practical File
Soumya Behera
 

What's hot (20)

Java VS Python
Java VS PythonJava VS Python
Java VS Python
 
java sockets
 java sockets java sockets
java sockets
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
 
Lambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive CodeLambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive Code
 
AST Transformations
AST TransformationsAST Transformations
AST Transformations
 
Java generics final
Java generics finalJava generics final
Java generics final
 
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
 
Important java programs(collection+file)
Important java programs(collection+file)Important java programs(collection+file)
Important java programs(collection+file)
 
Java 7 at SoftShake 2011
Java 7 at SoftShake 2011Java 7 at SoftShake 2011
Java 7 at SoftShake 2011
 
Java 7 JUG Summer Camp
Java 7 JUG Summer CampJava 7 JUG Summer Camp
Java 7 JUG Summer Camp
 
Java 8 Lambda Expressions
Java 8 Lambda ExpressionsJava 8 Lambda Expressions
Java 8 Lambda Expressions
 
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloadingRiga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloading
 
Riga Dev Day 2016 - Having fun with Javassist
Riga Dev Day 2016 - Having fun with JavassistRiga Dev Day 2016 - Having fun with Javassist
Riga Dev Day 2016 - Having fun with Javassist
 
Idiomatic Kotlin
Idiomatic KotlinIdiomatic Kotlin
Idiomatic Kotlin
 
Java 7 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUG
 
3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
 
Understanding Java byte code and the class file format
Understanding Java byte code and the class file formatUnderstanding Java byte code and the class file format
Understanding Java byte code and the class file format
 
Advanced Java Practical File
Advanced Java Practical FileAdvanced Java Practical File
Advanced Java Practical File
 
Java programs
Java programsJava programs
Java programs
 

Viewers also liked (6)

GroovyConsole
GroovyConsoleGroovyConsole
GroovyConsole
 
レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」
レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」
レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」
 
Letsgo sendai nobusue_20110528
Letsgo sendai nobusue_20110528Letsgo sendai nobusue_20110528
Letsgo sendai nobusue_20110528
 
「プログラミングGroovy」Groovyってなんだろ?編
「プログラミングGroovy」Groovyってなんだろ?編「プログラミングGroovy」Groovyってなんだろ?編
「プログラミングGroovy」Groovyってなんだろ?編
 
Grails 1.4.0.M1 メモLT
Grails 1.4.0.M1 メモLTGrails 1.4.0.M1 メモLT
Grails 1.4.0.M1 メモLT
 
スプリント計画ミーティング
スプリント計画ミーティングスプリント計画ミーティング
スプリント計画ミーティング
 

Similar to Easy Going Groovy 2nd season on DevLOVE

Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
Shahjahan Samoon
 
Laporan multiclient chatting client server
Laporan multiclient chatting client serverLaporan multiclient chatting client server
Laporan multiclient chatting client server
trilestari08
 
Java simple programs
Java simple programsJava simple programs
Java simple programs
VEERA RAGAVAN
 

Similar to Easy Going Groovy 2nd season on DevLOVE (20)

Code red SUM
Code red SUMCode red SUM
Code red SUM
 
Bhaloo
BhalooBhaloo
Bhaloo
 
Java Programming - 06 java file io
Java Programming - 06 java file ioJava Programming - 06 java file io
Java Programming - 06 java file io
 
Internet Technology (Practical Questions Paper) [CBSGS - 75:25 Pattern] {Mast...
Internet Technology (Practical Questions Paper) [CBSGS - 75:25 Pattern] {Mast...Internet Technology (Practical Questions Paper) [CBSGS - 75:25 Pattern] {Mast...
Internet Technology (Practical Questions Paper) [CBSGS - 75:25 Pattern] {Mast...
 
A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVM
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
 
Socket Programming
Socket ProgrammingSocket Programming
Socket Programming
 
Server1
Server1Server1
Server1
 
DCN Practical
DCN PracticalDCN Practical
DCN Practical
 
Non blocking io with netty
Non blocking io with nettyNon blocking io with netty
Non blocking io with netty
 
5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системе5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системе
 
Laporan multiclient chatting client server
Laporan multiclient chatting client serverLaporan multiclient chatting client server
Laporan multiclient chatting client server
 
Why Learn Python?
Why Learn Python?Why Learn Python?
Why Learn Python?
 
Java simple programs
Java simple programsJava simple programs
Java simple programs
 
모던자바의 역습
모던자바의 역습모던자바의 역습
모던자바의 역습
 
Core java
Core javaCore java
Core java
 
201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing
 
Java Socket Programming
Java Socket ProgrammingJava Socket Programming
Java Socket Programming
 
CORE JAVA-1
CORE JAVA-1CORE JAVA-1
CORE JAVA-1
 
Lab4
Lab4Lab4
Lab4
 

More from Uehara Junji

Groovy kisobenkyoukai20130309
Groovy kisobenkyoukai20130309Groovy kisobenkyoukai20130309
Groovy kisobenkyoukai20130309
Uehara Junji
 
Java One 2012 Tokyo JVM Lang. BOF(Groovy)
Java One 2012 Tokyo JVM Lang. BOF(Groovy)Java One 2012 Tokyo JVM Lang. BOF(Groovy)
Java One 2012 Tokyo JVM Lang. BOF(Groovy)
Uehara Junji
 
Jggug ws 15th LT 20110224
Jggug ws 15th LT 20110224Jggug ws 15th LT 20110224
Jggug ws 15th LT 20110224
Uehara Junji
 
Easy Going Groovy(Groovyを気軽に使いこなそう)
Easy Going Groovy(Groovyを気軽に使いこなそう)Easy Going Groovy(Groovyを気軽に使いこなそう)
Easy Going Groovy(Groovyを気軽に使いこなそう)
Uehara Junji
 

More from Uehara Junji (20)

Use JWT access-token on Grails REST API
Use JWT access-token on Grails REST APIUse JWT access-token on Grails REST API
Use JWT access-token on Grails REST API
 
Groovy Bootcamp 2015 by JGGUG
Groovy Bootcamp 2015 by JGGUGGroovy Bootcamp 2015 by JGGUG
Groovy Bootcamp 2015 by JGGUG
 
Groovy Shell Scripting 2015
Groovy Shell Scripting 2015Groovy Shell Scripting 2015
Groovy Shell Scripting 2015
 
Shibuya JVM Groovy 20150418
Shibuya JVM Groovy 20150418Shibuya JVM Groovy 20150418
Shibuya JVM Groovy 20150418
 
Markup Template Engine introduced Groovy 2.3
Markup Template Engine introduced Groovy 2.3Markup Template Engine introduced Groovy 2.3
Markup Template Engine introduced Groovy 2.3
 
Introduce Groovy 2.3 trait
Introduce Groovy 2.3 trait Introduce Groovy 2.3 trait
Introduce Groovy 2.3 trait
 
Indy(Invokedynamic) and Bytecode DSL and Brainf*ck
Indy(Invokedynamic) and Bytecode DSL and Brainf*ckIndy(Invokedynamic) and Bytecode DSL and Brainf*ck
Indy(Invokedynamic) and Bytecode DSL and Brainf*ck
 
enterprise grails challenge, 2013 Summer
enterprise grails challenge, 2013 Summerenterprise grails challenge, 2013 Summer
enterprise grails challenge, 2013 Summer
 
New features of Groovy 2.0 and 2.1
New features of Groovy 2.0 and 2.1New features of Groovy 2.0 and 2.1
New features of Groovy 2.0 and 2.1
 
Groovy kisobenkyoukai20130309
Groovy kisobenkyoukai20130309Groovy kisobenkyoukai20130309
Groovy kisobenkyoukai20130309
 
Read Groovy Compile process(Groovy Benkyoukai 2013)
Read Groovy Compile process(Groovy Benkyoukai 2013)Read Groovy Compile process(Groovy Benkyoukai 2013)
Read Groovy Compile process(Groovy Benkyoukai 2013)
 
groovy 2.1.0 20130118
groovy 2.1.0 20130118groovy 2.1.0 20130118
groovy 2.1.0 20130118
 
New feature of Groovy2.0 G*Workshop
New feature of Groovy2.0 G*WorkshopNew feature of Groovy2.0 G*Workshop
New feature of Groovy2.0 G*Workshop
 
G* Workshop in fukuoka 20120901
G* Workshop in fukuoka 20120901G* Workshop in fukuoka 20120901
G* Workshop in fukuoka 20120901
 
JJUG CCC 2012 Real World Groovy/Grails
JJUG CCC 2012 Real World Groovy/GrailsJJUG CCC 2012 Real World Groovy/Grails
JJUG CCC 2012 Real World Groovy/Grails
 
Java One 2012 Tokyo JVM Lang. BOF(Groovy)
Java One 2012 Tokyo JVM Lang. BOF(Groovy)Java One 2012 Tokyo JVM Lang. BOF(Groovy)
Java One 2012 Tokyo JVM Lang. BOF(Groovy)
 
Java x Groovy: improve your java development life
Java x Groovy: improve your java development lifeJava x Groovy: improve your java development life
Java x Groovy: improve your java development life
 
Jggug ws 15th LT 20110224
Jggug ws 15th LT 20110224Jggug ws 15th LT 20110224
Jggug ws 15th LT 20110224
 
Easy Going Groovy(Groovyを気軽に使いこなそう)
Easy Going Groovy(Groovyを気軽に使いこなそう)Easy Going Groovy(Groovyを気軽に使いこなそう)
Easy Going Groovy(Groovyを気軽に使いこなそう)
 
GroovyServ concept, how to use and outline.
GroovyServ concept, how to use and outline.GroovyServ concept, how to use and outline.
GroovyServ concept, how to use and outline.
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Easy Going Groovy 2nd season on DevLOVE

  • 2. Slide # 2 DevLOVE Groovy 2011.1.24
  • 3. http://d.hatena.ne.jp/uehaj/ Slide # 3 DevLOVE Groovy 2011.1.24
  • 4. new! JJUG CCC update Slide # 4 DevLOVE Groovy 2011.1.24
  • 5. Slide # 5 DevLOVE Groovy 2011.1.24
  • 6. Slide # 6 DevLOVE Groovy 2011.1.24
  • 7. import java.io.*; BufferedReader bis = new BufferedReader import java.net.*; (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide # 7 DevLOVE Groovy 2011.1.24
  • 8. import java.io.*; BufferedReader bis = new BufferedReader import java.net.*; (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide # 8 DevLOVE Groovy 2011.1.24
  • 9. import java.io.*; BufferedReader bis = new BufferedReader import java.net.*; (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide # 8 DevLOVE Groovy 2011.1.24
  • 10. import java.io.*; BufferedReader bis = new BufferedReader import java.net.*; (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide # 9 DevLOVE Groovy 2011.1.24
  • 11. import java.io.*; BufferedReader bis = new BufferedReader import java.net.*; (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide # 9 DevLOVE Groovy 2011.1.24
  • 12. BufferedReader bis = new BufferedReader (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide #10 DevLOVE Groovy 2011.1.24
  • 13. BufferedReader bis = new BufferedReader (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide #10 DevLOVE Groovy 2011.1.24
  • 14. BufferedReader bis = new BufferedReader (new InputStreamReader(ins)); String line; while ((line = bis.readLine()) != null) { System.out.println(line); } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); Slide #11 DevLOVE Groovy 2011.1.24
  • 15. BufferedReader bis = new BufferedReader (new InputStreamReader(ins)); String line; while ((line = bis.readLine()) != null) { System.out.println(line); } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); Slide #11 DevLOVE Groovy 2011.1.24
  • 16. BufferedReader bis = new BufferedReader (new InputStreamReader(ins)); String line; while ((line = bis.readLine()) != null) { System.out.println(line); } Socket soc = null; InputStream ins = null; OutputStream outs = null; soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); outs = soc.getOutputStream(); outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #12 DevLOVE Groovy 2011.1.24
  • 17. BufferedReader bis = new BufferedReader (new InputStreamReader(ins)); String line; while ((line = bis.readLine()) != null) { System.out.println(line); } Socket soc = null; InputStream ins = null; OutputStream outs = null; soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); outs = soc.getOutputStream(); outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #12 DevLOVE Groovy 2011.1.24
  • 18. bis = new BufferedReader(new InputStreamReader(ins)); def line = null; while ((line = bis.readLine()) != null) { System.out.println(line); } def soc = null; def ins = null; def outs = null; soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); outs = soc.getOutputStream(); outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #13 DevLOVE Groovy 2011.1.24
  • 19. bis = new BufferedReader(new InputStreamReader(ins)); def line = null; while ((line = bis.readLine()) != null) { System.out.println(line); } def soc = null; def ins = null; def outs = null; soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); outs = soc.getOutputStream(); outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #13 DevLOVE Groovy 2011.1.24
  • 20. bis = new BufferedReader(new InputStreamReader(ins)); def line = null; while ((line = bis.readLine()) != null) { System.out.println(line); } } new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #14 DevLOVE Groovy 2011.1.24
  • 21. bis = new BufferedReader(new InputStreamReader(ins)); def line = null; while ((line = bis.readLine()) != null) { System.out.println(line); } } new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #14 DevLOVE Groovy 2011.1.24
  • 22. ins.eachLine{ line -> System.out.println(line); } } new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #15 DevLOVE Groovy 2011.1.24
  • 23. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".getBytes()); ins.eachLine { line -> System.out.println(line); } } Slide #16 DevLOVE Groovy 2011.1.24
  • 24. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".getBytes()); ins.eachLine { line -> System.out.println(line); } } Slide #17 DevLOVE Groovy 2011.1.24
  • 25. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".getBytes()); ins.eachLine { line -> System.out.println(line); } } Slide #17 DevLOVE Groovy 2011.1.24
  • 26. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes); ins.eachLine { line -> System.out.println(line); } } Slide #18 DevLOVE Groovy 2011.1.24
  • 27. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes); ins.eachLine { line -> System.out.println(line); } } Slide #18 DevLOVE Groovy 2011.1.24
  • 28. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes); ins.eachLine { line -> println(line); } } Slide #19 DevLOVE Groovy 2011.1.24
  • 29. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes); ins.eachLine { line -> println(line); } } Slide #19 DevLOVE Groovy 2011.1.24
  • 30. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes); ins.eachLine { println(it); } } Slide #20 DevLOVE Groovy 2011.1.24
  • 31. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes); ins.eachLine { println(it); } } Slide #20 DevLOVE Groovy 2011.1.24
  • 32. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes) ins.eachLine { println(it) } } Slide #21 DevLOVE Groovy 2011.1.24
  • 33. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes) ins.eachLine { println(it) } } Slide #21 DevLOVE Groovy 2011.1.24
  • 34. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write "GET / HTTP/1.0nn".bytes ins.eachLine { println it } } Slide #22 DevLOVE Groovy 2011.1.24
  • 36. println new URL("http://www.java-users.jp").text Java Groovy Java 7 Slide #23 DevLOVE Groovy 2011.1.24
  • 37. Gaelyk Grails(Web) GSQL GSP,GORM SwingBuilder Griffon(GUI) MarkupBuilder GMaven,Maven3 /DSL Hudson JBoss Gant FreeMind Gradle Spock,EasyB Gpars Groovy++ Slide #24 DevLOVE Groovy 2011.1.24
  • 38. Slide # 25 DevLOVE Groovy 2011.1.24
  • 39. Slide #26 DevLOVE Groovy 2011.1.24
  • 40. Slide #27 DevLOVE Groovy 2011.1.24
  • 41. @Grab('net.sourceforge.htmlunit:htmlunit:2.8') import com.gargoylesoftware.htmlunit.WebClient; // Ant Bzip2 new AntBuilder().bzip2(src:args[0], zipfile:args[0]+".bz2") // HtmlUnit url = "http://pukiwiki.example.com/index.php? plugin=attach&pcmd=upload&page=test" page = new WebClient().getPage(url) file = page.getElementById('_p_attach_file') file.valueAttribute = args[0]+".bz2" page.getByXPath("//input[@value=' ']")[0].click() Slide #28 DevLOVE Groovy 2011.1.24
  • 42. @Grab('net.sourceforge.htmlunit:htmlunit:2.8') import com.gargoylesoftware.htmlunit.WebClient; // Ant Bzip2 new AntBuilder().bzip2(src:args[0], zipfile:args[0]+".bz2") // HtmlUnit url = "http://pukiwiki.example.com/index.php? plugin=attach&pcmd=upload&page=test" page = new WebClient().getPage(url) file = page.getElementById('_p_attach_file') file.valueAttribute = args[0]+".bz2" page.getByXPath("//input[@value=' ']")[0].click() Slide #28 DevLOVE Groovy 2011.1.24
  • 43. @Grab('net.sourceforge.htmlunit:htmlunit:2.8') import com.gargoylesoftware.htmlunit.WebClient; // Ant Bzip2 new AntBuilder().bzip2(src:args[0], zipfile:args[0]+".bz2") // HtmlUnit url = "http://pukiwiki.example.com/index.php? plugin=attach&pcmd=upload&page=test" page = new WebClient().getPage(url) file = page.getElementById('_p_attach_file') file.valueAttribute = args[0]+".bz2" page.getByXPath("//input[@value=' ']")[0].click() Slide #28 DevLOVE Groovy 2011.1.24
  • 44. @Grab('net.sourceforge.htmlunit:htmlunit:2.8') import com.gargoylesoftware.htmlunit.WebClient; // Ant Bzip2 new AntBuilder().bzip2(src:args[0], zipfile:args[0]+".bz2") // HtmlUnit url = "http://pukiwiki.example.com/index.php? plugin=attach&pcmd=upload&page=test" page = new WebClient().getPage(url) file = page.getElementById('_p_attach_file') file.valueAttribute = args[0]+".bz2" page.getByXPath("//input[@value=' ']")[0].click() Slide #28 DevLOVE Groovy 2011.1.24
  • 45. @Grab('net.sourceforge.htmlunit:htmlunit:2.8') import com.gargoylesoftware.htmlunit.WebClient; Slide #29 DevLOVE Groovy 2011.1.24
  • 46. // Ant Bzip2 new AntBuilder().bzip2(src:args[0], zipfile:args[0]+".bz2") Slide #30 DevLOVE Groovy 2011.1.24
  • 47. Slide #31 DevLOVE Groovy 2011.1.24
  • 48. cities.csv ,35676000, ,19040000, = ,1018000, ,5492000, Slide #31 DevLOVE Groovy 2011.1.24
  • 49. cities.csv ,35676000, ,19040000, , , = ,1018000, ,5492000, Slide #31 DevLOVE Groovy 2011.1.24
  • 50. @Grab('com.h2database:h2:1.2.143') @GrabConfig(systemClassLoader=true) import groovy.sql.Sql sql = Sql.newInstance("jdbc:h2:cities") sql.execute """ CREATE TABLE Cities (                   id INT IDENTITY PRIMARY KEY, name VARCHAR,                   population DECIMAL(10), country VARCHAR)""" cities = sql.dataSet("Cities") new File("cities.csv").splitEachLine(",") { f1, f2, f3 -> //   cities.add(name:f1, population:f2, country:f3) } assert cities.findAll{ it.country==" " && it.population>1000000 }.rows()*.name == [' ', ' = ( )', ' ', ' ', ' '] Slide #32 DevLOVE Groovy 2011.1.24
  • 51. @Grab('com.h2database:h2:1.2.143') @GrabConfig(systemClassLoader=true) import groovy.sql.Sql sql = Sql.newInstance("jdbc:h2:cities") sql.execute """ CREATE TABLE Cities (                   id INT IDENTITY PRIMARY KEY, name VARCHAR,                   population DECIMAL(10), country VARCHAR)""" cities = sql.dataSet("Cities") new File("cities.csv").splitEachLine(",") { f1, f2, f3 -> //   cities.add(name:f1, population:f2, country:f3) } assert cities.findAll{ it.country==" " && it.population>1000000 }.rows()*.name == [' ', ' = ( )', ' ', ' ', ' '] Slide #32 DevLOVE Groovy 2011.1.24
  • 52. @Grab('com.h2database:h2:1.2.143') @GrabConfig(systemClassLoader=true) import groovy.sql.Sql sql = Sql.newInstance("jdbc:h2:cities") sql.execute """ CREATE TABLE Cities (                   id INT IDENTITY PRIMARY KEY, name VARCHAR,                   population DECIMAL(10), country VARCHAR)""" cities = sql.dataSet("Cities") new File("cities.csv").splitEachLine(",") { f1, f2, f3 -> //   cities.add(name:f1, population:f2, country:f3) } assert cities.findAll{ it.country==" " && it.population>1000000 }.rows()*.name == [' ', ' = ( )', ' ', ' ', ' '] Slide #32 DevLOVE Groovy 2011.1.24
  • 53. @Grab('com.h2database:h2:1.2.143') @GrabConfig(systemClassLoader=true) import groovy.sql.Sql sql = Sql.newInstance("jdbc:h2:cities") sql.execute """ CREATE TABLE Cities (                   id INT IDENTITY PRIMARY KEY, name VARCHAR,                   population DECIMAL(10), country VARCHAR)""" cities = sql.dataSet("Cities") new File("cities.csv").splitEachLine(",") { f1, f2, f3 -> //   cities.add(name:f1, population:f2, country:f3) } assert cities.findAll{ it.country==" " && it.population>1000000 }.rows()*.name == [' ', ' = ( )', ' ', ' ', ' '] Slide #32 DevLOVE Groovy 2011.1.24
  • 54. @Grab('com.h2database:h2:1.2.143') @GrabConfig(systemClassLoader=true) import groovy.sql.Sql sql = Sql.newInstance("jdbc:h2:cities") sql.execute """ CREATE TABLE Cities (                   id INT IDENTITY PRIMARY KEY, name VARCHAR,                   population DECIMAL(10), country VARCHAR)""" cities = sql.dataSet("Cities") new File("cities.csv").splitEachLine(",") { f1, f2, f3 -> //   cities.add(name:f1, population:f2, country:f3) } assert cities.findAll{ it.country==" " && it.population>1000000 }.rows()*.name == [' ', ' = ( )', ' ', ' ', ' '] Slide #32 DevLOVE Groovy 2011.1.24
  • 56. cities = sql.dataSet("Cities") new File("cities.csv").splitEachLine(",") { f1, f2, f3 -> //   cities.add(name:f1, population:f2, country:f3) } Slide #34 DevLOVE Groovy 2011.1.24
  • 57. cities = sql.dataSet("Cities") assert cities.findAll{ it.country==" " && it.population>1000000 }.rows()*.name == [' ', ' = ( )', ' ', ' ', ' '] cities = sql.dataSet("Cities") assert cities.findAll{ it.country==" " } .findAll{ it.population>1000000 }.rows()*.name == [' ', ' = ( )', ' ', ' ', ' '] Slide #35 DevLOVE Groovy 2011.1.24
  • 58. Slide # 36 DevLOVE Groovy 2011.1.24
  • 59. update http://d.hatena.ne.jp/ksky/20090618/p1 Slide #37 DevLOVE Groovy 2011.1.24
  • 60. update ! http://d.hatena.ne.jp/ksky/20090618/p1 Slide #37 DevLOVE Groovy 2011.1.24
  • 62. http://bit.ly/g5iE0m Slide #39 DevLOVE Groovy 2011.1.24
  • 63. Slide # 40 DevLOVE Groovy 2011.1.24
  • 64. Slide #41 DevLOVE Groovy 2011.1.24
  • 65. update Slide #42 DevLOVE Groovy 2011.1.24
  • 67. Slide #44 DevLOVE Groovy 2011.1.24
  • 68. Shell Environment User Groovy Srcipt C LA SS . lin PA cm System.in TH d System.out en e v SYstem.err ar gs Ctrl-C groovyclient TCP/IP groovyserver n di st de t st dou rr JavaVM st exit status File System Authentication Cookie File Slide # DevLOVE Groovy 2011.1.24 45
  • 69. User Groovy Shell Environment Srcipt C LA System.in SS . lin PA cm System.out TH d SYstem.err en e v ar gs Ctrl-C groovy n di st de t st dou JavaVM rr st exit status File System Slide #46 DevLOVE Groovy 2011.1.24
  • 70. 19.6 normal groovy 3.041 1.0 Installer groovy 1.262 2.4 groovyclient(C ) 0.155 19.6 groovyclient(Ruby ) 0.193 15.8 •Groovy 1.7.3, GroovyServ 0.4-SNAPSHOT, WinXP SP3,Core2Duo 2GHz,JDK1 Slide # •time DevLOVE real 10 Groovy 2011.1.24
  • 71. 35.8 normal groovy 1.112 1.0 Mac Ports groovy(1.7.2) 0.321 3.5 groovyclient(C ) 0.031 35.8 groovyclient(Ruby ) 0.041 27.1 •Groovy 1.7.3, GroovyServ 0.4-SNAPSHOT, MacOSX 10.6.3, MacBook Core2duo 2.53GHz, JDK1.6.0u20 •time real 10 Slide #48 DevLOVE Groovy 2011.1.24
  • 72. for (i=0; i<1000000; i++) {}; groovy(Client VM) 593.7 groovy(Server VM) 243.8 groovyclient(Client VM) 454.6 groovyclient(Server VM) 197.0 •Groovy 1.7.3, GroovyServ 0.4, Windows XP SP3(cygwin 1.7.5),Core2duo 2.00GHz, JDK1.6.0u13 Slide #49 DevLOVE •time Groovy 2011.1.24 real
  • 73. Groovy for (i=0; i<1000000; i++) {}; scalac 6.6 1.0 fsc 1.2 5.5 scalac/GroovyServ 1.1 6.6 fsc/GroovyServ 0.4 16.5 Slide #50 DevLOVE Groovy 2011.1.24
  • 74. Slide #51 DevLOVE Groovy 2011.1.24
  • 75. Slide #52 DevLOVE Groovy 2011.1.24
  • 76. new! thanks for the great work on groovyserv! I use it everyday and enjoy its performance. I also give it lots of credit in my workshops and talks. (you may have recognized the additional hackergarten screencast.) I was thinking about maybe making GroovyServ the default way of how groovy executes a script. That sounds like a great release to me! Congratulations to the team! Great work, this thing really helps. Slide #53 DevLOVE Groovy 2011.1.24
  • 77. new! thanks for the great work on groovyserv! I use it everyday and enjoy its performance. I also give it lots of credit in my workshops and talks. (you may have recognized the additional hackergarten screencast.) I was thinking about maybe making GroovyServ the default way of how groovy executes a script. That sounds like a great release to me! Congratulations to the team! Great work, this thing really helps. Slide #53 DevLOVE Groovy 2011.1.24
  • 78. Slide #54 DevLOVE Groovy 2011.1.24
  • 79. Slide #55 DevLOVE Groovy 2011.1.24
  • 80. Slide # 56 DevLOVE Groovy 2011.1.24
  • 81. GEP ‥ Groovy Enhancement Proposal Slide #57 DevLOVE Groovy 2011.1.24
  • 82. 100 1 2 3 { ->    } 1 100 . ( ) 1 100 . ( ) { ->    + " 6 " } " " http://d.hatena.ne.jp/uehaj/20100919/1284906117 10.0 18 6 2 24 6 6 [6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, : 78, 84, 90, 96] 6 6 96 6 12 6 Slide #58 DevLOVE Groovy 2011.1.24
  • 83. (100). ( ). ( ) (1). (2). (3). ( ). ( ({ ->    ( ). ( ) })) (1). (100). (( . ( ))). ( ) (1). (100). ( . ( )). ( ({ ->    ( + " 6 "). ( ) })) (" "). ( ) Slide #59 DevLOVE Groovy 2011.1.24
  • 84. new int fib (int n) { groovyc     if (n<=1) return 1     return fib(n-1) + fib(n-2) jad } Slide #60 DevLOVE Groovy 2011.1.24
  • 85. new int fib (int n) { groovyc     if (n<=1) return 1     return fib(n-1) + fib(n-2) jad } public int fib(int n) {     CallSite acallsite[] = $getCallSiteArray();     if(ScriptBytecodeAdapter.compareLessThanEqual (DefaultTypeTransformation.box(n), $const$0))         return DefaultTypeTransformation.intUnbox((Integer) ScriptBytecodeAdapter.castToType($const$0, $get$$class$java$lang$Integer()));     else         return DefaultTypeTransformation.intUnbox((Integer) ScriptBytecodeAdapter.castToType(acallsite[0].call(acallsite[1].callCurrent (this, acallsite[2].call(DefaultTypeTransformation.box(n), $const$0)), acallsite[3].callCurrent(this, acallsite[4].call (DefaultTypeTransformation.box(n), $const$1))), $get$$class$java$lang$Integer ())); } Slide #60 DevLOVE Groovy 2011.1.24
  • 86. new int fib (int n) { groovyc     if (n<=1) return 1     return fib(n-1) + fib(n-2) jad } public int fib(int n) public int fib(int n) { {     CallSite acallsite[] = $getCallSiteArray();     CallSite acallsite[] = $getCallSiteArray();     if(!ScriptBytecodeAdapter.isOrigInt())         if(ScriptBytecodeAdapter.compareLessThanEqual((Integer)     if(ScriptBytecodeAdapter.compareLessThanEqual DefaultTypeTransformation.box(n), (Integer) (DefaultTypeTransformation.box(n), $const$0)) DefaultTypeTransformation.box(1)))         return DefaultTypeTransformation.intUnbox((Integer)             return 1; ScriptBytecodeAdapter.castToType($const$0, $get$$class$java$lang$Integer()));         else     else             return DefaultTypeTransformation.intUnbox(acallsite         return DefaultTypeTransformation.intUnbox((Integer) [0].call(acallsite[1].callCurrent(this, acallsite[2].call ScriptBytecodeAdapter.castToType(acallsite[0].call(acallsite[1].callCurrent ((Integer)DefaultTypeTransformation.box(n), (Integer) DefaultTypeTransformation.box(1))), acallsite[3].callCurrent (this, acallsite[2].call(DefaultTypeTransformation.box(n), $const$0)), (this, acallsite[4].call((Integer)DefaultTypeTransformation.box acallsite[3].callCurrent(this, acallsite[4].call (n), (Integer)DefaultTypeTransformation.box(2))))); (DefaultTypeTransformation.box(n), $const$1))), $get$$class$java$lang$Integer     if(n <= 1) ()));         return 1; }     else         return fib(n - 1) + fib(n - 2); } Slide #60 DevLOVE Groovy 2011.1.24
  • 87. new int fib (int n) { groovyc     if (n<=1) return 1     return fib(n-1) + fib(n-2) jad } public int fib(int n) public int fib(int n) { {     CallSite acallsite[] = $getCallSiteArray();     CallSite acallsite[] = $getCallSiteArray();     if(!ScriptBytecodeAdapter.isOrigInt())         if(ScriptBytecodeAdapter.compareLessThanEqual((Integer)     if(ScriptBytecodeAdapter.compareLessThanEqual DefaultTypeTransformation.box(n), (Integer) (DefaultTypeTransformation.box(n), $const$0)) DefaultTypeTransformation.box(1)))         return DefaultTypeTransformation.intUnbox((Integer)             return 1; ScriptBytecodeAdapter.castToType($const$0, $get$$class$java$lang$Integer()));         else     else             return DefaultTypeTransformation.intUnbox(acallsite         return DefaultTypeTransformation.intUnbox((Integer) [0].call(acallsite[1].callCurrent(this, acallsite[2].call ScriptBytecodeAdapter.castToType(acallsite[0].call(acallsite[1].callCurrent ((Integer)DefaultTypeTransformation.box(n), (Integer) DefaultTypeTransformation.box(1))), acallsite[3].callCurrent (this, acallsite[2].call(DefaultTypeTransformation.box(n), $const$0)), (this, acallsite[4].call((Integer)DefaultTypeTransformation.box acallsite[3].callCurrent(this, acallsite[4].call (n), (Integer)DefaultTypeTransformation.box(2))))); (DefaultTypeTransformation.box(n), $const$1))), $get$$class$java$lang$Integer     if(n <= 1) ()));         return 1; }     else         return fib(n - 1) + fib(n - 2); } Slide #60 DevLOVE Groovy 2011.1.24
  • 88. new int fib (int n) { groovyc     if (n<=1) return 1     return fib(n-1) + fib(n-2) jad } public int fib(int n) public int fib(int n) { {     CallSite acallsite[] = $getCallSiteArray(); if(n <= 1)     CallSite acallsite[] = $getCallSiteArray();     if(!ScriptBytecodeAdapter.isOrigInt())          if(ScriptBytecodeAdapter.compareLessThanEqual((Integer)    return 1;     if(ScriptBytecodeAdapter.compareLessThanEqual DefaultTypeTransformation.box(n), (Integer) (DefaultTypeTransformation.box(n), $const$0)) else DefaultTypeTransformation.box(1)))         return DefaultTypeTransformation.intUnbox((Integer)             return 1;          else fib(n - 1) + fib(n - 2);    return ScriptBytecodeAdapter.castToType($const$0, $get$$class$java$lang$Integer()));     else             return DefaultTypeTransformation.intUnbox(acallsite         return DefaultTypeTransformation.intUnbox((Integer) [0].call(acallsite[1].callCurrent(this, acallsite[2].call ScriptBytecodeAdapter.castToType(acallsite[0].call(acallsite[1].callCurrent ((Integer)DefaultTypeTransformation.box(n), (Integer) DefaultTypeTransformation.box(1))), acallsite[3].callCurrent (this, acallsite[2].call(DefaultTypeTransformation.box(n), $const$0)), (this, acallsite[4].call((Integer)DefaultTypeTransformation.box acallsite[3].callCurrent(this, acallsite[4].call (n), (Integer)DefaultTypeTransformation.box(2))))); (DefaultTypeTransformation.box(n), $const$1))), $get$$class$java$lang$Integer     if(n <= 1) ()));         return 1; }     else         return fib(n - 1) + fib(n - 2); } Slide #60 DevLOVE Groovy 2011.1.24
  • 89. new long begin = System.nanoTime(); FibJava foo = new FibJava(); int result = foo.fib(32); // long end = System.nanoTime(); System.out.println("Elapsed time: " + (end - begin) + "ns"); (ns) Java 1 Groovy 1.7.5 1,639,852,000 66.46 Groovy 1.8.0 beta 3 65,497,000 2.65 Java(OpenJDK 1.7) 24,672,000 1.0 • MacOSX 10.6.3, MacBook Core2duo 2.53GHz,openjdk version "1.7.0-internal" Slide #61 DevLOVE Groovy 2011.1.24
  • 90. @Invariant({ elements != null })    class Stack {      def boolean is_empty()  {            elements.isEmpty()      private List elements      }          @Ensures({ is_empty() })      @Requires({ !is_empty() })      public Stack()  {      def last_item()  {          elements = []          elements.last()      }      }          @Requires({ preElements?.size() >      def count() { 0 })          elements.size()      @Ensures({ !is_empty() })      }      public Stack(List preElements)  {          elements = preElements      } http://github.com/andresteingress/gcontracts/wiki Slide #62 DevLOVE Groovy 2011.1.24
  • 91. update http://canoo.com/blog/2010/09/20/log-groovys-new-and-extensible-logging-conveniences/ Slide #63 DevLOVE Groovy 2011.1.24
  • 92. import groovy.util.logging.Log  @Log  class MyClass {      def invoke() {          log.info('... an info message')          log.fine('... a fine message')      }  } http://canoo.com/blog/2010/09/20/log-groovys-new-and-extensible-logging-conveniences/ Slide #64 DevLOVE Groovy 2011.1.24
  • 93. New! Slide #65 DevLOVE Groovy 2011.1.24
  • 94. http://kokucheese.com/event/index/5267/ Groovy&Grails exchange 2010@London by tyama, tamada ( ) Gradle G* by (LITERAL-ICE) Slide #66 DevLOVE Groovy 2011.1.24
  • 95. http://kokucheese.com/event/index/5267/ Groovy&Grails exchange 2010@London by tyama, tamada ( ) Gradle G* by (LITERAL-ICE) Slide #66 DevLOVE Groovy 2011.1.24
  • 96. Slide # 67 DevLOVE Groovy 2011.1.24