Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

10 Years of Groovy

1,509 views

Published on

10 Year retrospective of Groovy: the language and the ecosystem

Published in: Technology, Education
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

10 Years of Groovy

  1. 1. <ul>A Very Groovy Birthday <li>Hamlet D'Arcy
  2. 2. Canoo Engineering AG
  3. 3. @HamletDRC </li></ul>
  4. 4. A Very Groovy Birthday <ul><li>Geneva JUG – 2 Years
  5. 5. Hamlet D'Arcy
  6. 6. Canoo Engineering AG
  7. 7. @HamletDRC </li></ul>
  8. 8. A Very Groovy Birthday <ul><li>Geneva JUG – 2 Years Groovy – 10 th Year
  9. 9. Hamlet D'Arcy
  10. 10. Canoo Engineering AG
  11. 11. @HamletDRC </li></ul>
  12. 12. 2003 <ul></ul>
  13. 13. 2003 <ul></ul>
  14. 14. 2003 Closure <ul></ul>
  15. 15. “Refactored CompositeString to be called ______ :)”
  16. 16. 2003 Closure GString <ul></ul>
  17. 17. 2003 Range Closure GString <ul></ul>
  18. 18. 2003 Range MarkupBuilder Closure GString <ul></ul>
  19. 19. new groovy.xml.MarkupBuilder().root() { ( 1 .. 3 ).each { child(id: &quot;child $it &quot; ) } }
  20. 20. new groovy.xml.MarkupBuilder().root() { ( 1 .. 3 ).each { child(id: &quot;child $it &quot; ) } } <root> <child id='child1' /> <child id='child2' /> <child id='child3' /> </root>
  21. 21. 2004 2003 Range MarkupBuilder Closure GString <ul></ul>
  22. 22. 2004 2003 JSR-241 Range MarkupBuilder Closure GString <ul></ul>
  23. 23. 2004 2003 JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
  24. 24. def text = '''Dear $person, So nice to meet you in <% print city %>. Sincerely, $signed''' def vars = [person: 'JUG' , city: 'Geneva' , signed: 'Hamlet' ] def engine = new groovy.text.SimpleTemplateEngine() engine.createTemplate(text).make(vars)
  25. 25. def text = '''Dear $person, So nice to meet you in <% print city %>. Sincerely, $signed''' def vars = [person: 'JUG' , city: 'Geneva' , signed: 'Hamlet' ] def engine = new groovy.text.SimpleTemplateEngine() engine.createTemplate(text).make(vars) Dear JUG, So nice to meet you in Geneva. Sincerely, Hamlet
  26. 26. 2005 2004 2003 JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
  27. 27. 2005 2004 2003 XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
  28. 28. 2005 2004 2003 XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
  29. 29. 2005 2004 2003 XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
  30. 30. 2006 2005 2004 2003 XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
  31. 31. 2006 2005 2004 2003 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>0.1-0.3
  32. 32. 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>0.1-0.3
  33. 33. 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>0.1-0.3
  34. 34. 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.1-0.3
  35. 35. String. class .metaClass.default = { self -> self ?: '<unknown>' } '' .default()
  36. 36. 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.4-0.7 0.1-0.3
  37. 37. 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.4-0.7 0.1-0.3
  38. 38. 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.4-0.7 0.1-0.3
  39. 39. 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.4-0.7 0.1-0.3
  40. 40. 2008 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.4-0.7 0.1-0.3
  41. 41. 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.4-0.7 0.1-0.3
  42. 42. @Grab( group= 'org.ccil.cowan.tagsoup' , module= 'tagsoup' , version= '1.2' ) import org.ccil.cowan.tagsoup.Parser def parser = new XmlParser(new Parser()) def url = 'http://twitter.com/hamletdrc' def html = parser.parse(url)
  43. 43. 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  44. 44. 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  45. 45. 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  46. 46. 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  47. 47. 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  48. 48. 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  49. 49. 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.6, 1.7 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  50. 50. def (x, y) = [ 1 , 2 ] @Singleton, @Lazy, @Immutable, @Delegate, ... and more
  51. 51. def (x, y) = [ 1 , 2 ] assert x == 1 assert y == 2
  52. 52. 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  53. 53. 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  54. 54. 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  55. 55. 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  56. 56. 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  57. 57. 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.3 0.9 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  58. 58. 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  59. 59. 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  60. 60. 2011 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  61. 61. 2011 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.8 2.0 1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  62. 62. Command Chains stand 7.minutes at busstop ride 10.stops on bus towards Basel
  63. 63. JSON Builder import groovy.json.* def json = new JsonBuilder() json.person { name 'William Tell' status 'mythological' }
  64. 64. AST Transformations @ToString, @EqualsAndHashCode @TupleConstructor, @Canonical @Log, @Field, @Package, ... and many more
  65. 65. 2011 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.8 2.0 1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  66. 66. 2011 2010 2009 2008 2007 2006 2005 2004 2003 2012 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.8 2.0 1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  67. 67. 2011 2010 2009 2008 2007 2006 2005 2004 2003 2012 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0 0.17 1.0 1.8 2.0 1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  68. 68. 2011 2010 2009 2008 2007 2006 2005 2004 2003 2012 2.0 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0 0.17 1.0 1.8 2.0 1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  69. 69. void method(String message) { if (message != null ) { log.info( &quot;Received input: ${ message.toUppercase() }&quot; ) } }
  70. 70. @groovy.transform.TypeChecked void method(String message) { if (message != null ) { log.info( &quot;Received input: ${ message.toUppercase() }&quot; ) } }
  71. 71. @groovy.transform.TypeChecked void method(String message) { if (message != null ) { log.info( &quot;Received input: ${ message.toUppercase() }&quot; ) } } 1 compilation error: [Static type checking] - Cannot find matching method java.lang.String#toUppercase() at line: 4, column: 43
  72. 72. void method(Object message) { if (message instanceof String) { log.info( &quot;Received input: &quot; + message.toUpperCase() ); } }
  73. 73. @groovy.transform.TypeChecked void method(Object message) { if (message instanceof String) { log.info( &quot;Received input: ${ message.toUpperCase() }&quot; ) } }
  74. 74. def keys = [x: 1 ,y: 2 ,z: 3 ] *.key def values = [x: '1' ,y: '2' ,z: '3' ] *.value keys*.toUpperCase() values*.toUpperCase()
  75. 75. Dimension d1 = [ 100 ] Dimension d2 = [ '100' , '200' ] Dimension d3 = new Dimension( width: 100 , height: 100 , depth: 100 )
  76. 76. @groovy.transform.TypeChecked – Not a static compiler – No new syntax – No new semantics – Bytecode not changed – Targeted at Java developers
  77. 77. def v = 1 v = v.toString() println v.toUpperCase()
  78. 78. Flow Sensitive Typing def v = 1 v = v.toString() println v.toUpperCase()
  79. 79. Flow Sensitive Typing def v = 1 v = v.toString() println v.toUpperCase() – Under discussion
  80. 80. int fib(int i) { i < 2 ? 1 : fib(i - 2 ) + fib(i - 1 ) }
  81. 81. @groovy.transform.CompileStatic int fib(int i) { i < 2 ? 1 : fib(i - 2 ) + fib(i - 1 ) }
  82. 82. @groovy.transform.CompileStatic – Is a static compiler – No new syntax – Requires new semantics – Bytecode is changed
  83. 83. @groovy.transform.CompileStatic – Is a static compiler – No new syntax – Requires new semantics – Bytecode is changed – InvokeDynamic?
  84. 84. 2011 2010 2009 2008 2007 2006 2005 2004 2003 2012 2.0 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0 0.17 1.0 1.8 2.0 1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3

×