Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Benefit from Groovy now, why when how — JFokus 2014

Benefit from Groovy now, why when how — JFokus 2014

Presentation given at the JFokus 2014 conference on the various usage patterns for Groovy and how can developers can take advantage of Groovy

Guillaume Laforge

February 05, 2014
Tweet

More Decks by Guillaume Laforge

Other Decks in Technology

Transcript

  1. Guillaume Laforge 

    @glaforge
    Benefit from Groovy now,
    when, why and how

    View full-size slide

  2. Guillaume Laforge 

    @glaforge
    Benefit from Groovy now,
    when, why and how
    By the way, you know
    there’s a Groovy User Group
    here in Stockholm?
    http://www.meetup.com/
    Stockholm-Groovy-User-
    Group/

    View full-size slide

  3. Guillaume
    Laforge
    Groovy project lead
    at .
    !
    @glaforge
    http://glaforge.appspot.com

    View full-size slide

  4. Groovy in 5 minutes
    Introduction

    View full-size slide

  5. Groovy…
    Open Source 

    alternative language 

    for the JVM

    View full-size slide

  6. Groovy…
    Object-oriented, dynamic,
    with a functional flavor

    View full-size slide

  7. Groovy…
    …also supports 

    static type checking & 

    static compilation

    View full-size slide

  8. million 

    downloads

    in 2013

    View full-size slide

  9. million 

    downloads

    in 2013
    3

    View full-size slide

  10. million 

    downloads

    in 2013
    3
    Twice as much
    as in 2012!

    View full-size slide

  11. Yup, we’re all
    using Groovy!

    View full-size slide

  12. BIG
    USE
    CASES
    DSLs
    Apps
    Scripting
    Testing
    Customize

    View full-size slide

  13. BIG
    USE
    CASES
    DSLs
    Apps
    Scripting
    Testing
    Customize

    View full-size slide

  14. BIG
    USE
    CASES
    DSLs
    Apps
    Scripting
    Testing
    Customize

    View full-size slide

  15. BIG
    USE
    CASES
    DSLs
    Apps
    Scripting
    Testing
    Customize

    View full-size slide

  16. BIG
    USE
    CASES
    DSLs
    Apps
    Scripting
    Testing
    Customize

    View full-size slide

  17. BIG
    USE
    CASES
    DSLs
    Apps
    Scripting
    Testing
    Customize

    View full-size slide

  18. What for?
    for what kind of tasks

    View full-size slide

  19. What for?
    Who?
    for what kind of tasks

    View full-size slide

  20. What for?
    Who?
    for what kind of tasks
    projects, companies
    using that pattern

    View full-size slide

  21. Who?
    How?
    projects, companies
    using that pattern
    What for?
    for what kind of tasks

    View full-size slide

  22. Who?
    How?
    projects, companies
    using that pattern
    do it yourself
    What for?
    for what kind of tasks

    View full-size slide

  23. Task automation
    Build automation
    DevOps
    Scripting
    Case 1

    View full-size slide

  24. @glaforge / #groovylang
    What for? Scripting: task automation
    !
    • Groovy is also a scripting language, you can easily…

    !
    – run a Groovy script with the groovy command

    !
    – @Grab & import third-party libraries

    •no need for a dedicated project or a build file

    •leverage the wealth of Ant tasks with the Groovy Ant builder

    !
    – invoke other command-line tools
    !20

    View full-size slide

  25. @glaforge / #groovylang
    Who? Scripting: task automation
    !21

    View full-size slide

  26. @glaforge / #groovylang
    Who? Scripting: task automation
    !21
    You or
    anybody :-)

    View full-size slide

  27. @glaforge / #groovylang
    Who? Scripting: task automation
    !21
    You or
    anybody :-)
    Or me for grepping
    through the logs to
    compute download
    stats

    View full-size slide

  28. @glaforge / #groovylang
    Who? Scripting: task automation
    !21
    You or
    anybody :-)
    Or me for grepping
    through the logs to
    compute download
    stats
    Anyone who’s
    not a Bash guru!

    View full-size slide

  29. @glaforge / #groovylang
    Who? Scripting: task automation
    !21
    You or
    anybody :-)
    Or me for grepping
    through the logs to
    compute download
    stats
    Anyone who’s
    not a Bash guru!
    Groovy team exports
    Confluence wiki to html,
    then transforms to
    AsciiDoc format

    View full-size slide

  30. @glaforge / #groovylang
    How? Scripting: task automation
    !22

    View full-size slide

  31. @glaforge / #groovylang
    How? Scripting: task automation
    !22
    Use HtmlCleaner to clean the
    Confluence wiki HTML export

    View full-size slide

  32. @glaforge / #groovylang
    How? Scripting: task automation
    !22
    Use HtmlCleaner to clean the
    Confluence wiki HTML export
    Transform the cleaned HTML
    into AsciiDoctor format

    View full-size slide

  33. @glaforge / #groovylang
    How? Scripting: task automation
    !22

    View full-size slide

  34. @glaforge / #groovylang
    How? Scripting: task automation
    !23

    View full-size slide

  35. @glaforge / #groovylang
    How? Scripting: task automation
    !23
    This is how you can grab
    a dependency…

    View full-size slide

  36. @glaforge / #groovylang
    How? Scripting: task automation
    !23
    This is how you can grab
    a dependency…
    …and use the library
    right away, without a
    build file or IDE

    View full-size slide

  37. @glaforge / #groovylang
    How? Scripting: task automation
    !23

    View full-size slide

  38. @glaforge / #groovylang
    How? Scripting: task automation
    !24

    View full-size slide

  39. @glaforge / #groovylang
    How? Scripting: task automation
    !24
    Traverse the file
    system easily

    View full-size slide

  40. @glaforge / #groovylang
    How? Scripting: task automation
    !24

    View full-size slide

  41. @glaforge / #groovylang
    How? Scripting: task automation
    !25

    View full-size slide

  42. @glaforge / #groovylang
    How? Scripting: task automation
    !25
    Execute external
    commands

    View full-size slide

  43. @glaforge / #groovylang
    How? Scripting: task automation
    !25
    Execute external
    commands
    Wait for the end of
    the process

    View full-size slide

  44. @glaforge / #groovylang
    How? Scripting: task automation
    • Groovy’s APIs feature

    – an Ant task scripting API to reuse all existing Ant tasks

    •ftp, ssh, file copying/moving…

    – a template engine

    •for generating files, source code

    – easy creation & parsing of XML or JSON payloads

    – Sql facility to simplifying accessing a JDBC compliant relational DB

    – exposing and accessing JMX beans
    !26

    View full-size slide

  45. @glaforge / #groovylang
    How? Scripting: task automation
    !27

    View full-size slide

  46. @glaforge / #groovylang
    How? Scripting: task automation
    !28

    View full-size slide

  47. @glaforge / #groovylang
    How? Scripting: task automation
    !28
    Use the Groovy Markup
    Builder class to generate
    HTML or XML payloads

    View full-size slide

  48. @glaforge / #groovylang
    How? Scripting: task automation
    !28

    View full-size slide

  49. @glaforge / #groovylang
    How? Scripting: task automation
    !29

    View full-size slide

  50. @glaforge / #groovylang
    How? Scripting: task automation
    !29
    Use the Ant Builder, reusing
    the Mail Ant task to send a
    build notification

    View full-size slide

  51. @glaforge / #groovylang
    How? Scripting: task automation
    !29

    View full-size slide

  52. @glaforge / #groovylang
    What for? Scripting: build automation
    !
    • Gradle is a powerful build automation solution

    – uses Groovy for its automation language

    !
    • You can

    – build / package / deploy Java, Groovy, Scala, C/C++ projects

    – handle dependency management cleanly

    – define and enforce your own enterprise build conventions

    – extend Gradle declaratively and programmatically
    !30

    View full-size slide

  53. @glaforge / #groovylang
    Who? Scripting: build automation
    !31

    View full-size slide

  54. @glaforge / #groovylang
    How? Scripting: build automation
    !32

    View full-size slide

  55. @glaforge / #groovylang
    How? Scripting: build automation
    !32
    Use the ‘Java’ plugin

    View full-size slide

  56. @glaforge / #groovylang
    How? Scripting: build automation
    !32
    Use the ‘Java’ plugin
    Fetch your dependencies
    from Maven Central

    View full-size slide

  57. @glaforge / #groovylang
    How? Scripting: build automation
    !32
    Use the ‘Java’ plugin
    Fetch your dependencies
    from Maven Central
    Declare your dependencies and their scope

    View full-size slide

  58. @glaforge / #groovylang
    How? Scripting: build automation
    !33

    View full-size slide

  59. @glaforge / #groovylang
    How? Scripting: build automation
    !34

    View full-size slide

  60. @glaforge / #groovylang
    How? Scripting: build automation
    !34
    Declare and use the
    ‘android’ plugin

    View full-size slide

  61. @glaforge / #groovylang
    How? Scripting: build automation
    !35

    View full-size slide

  62. @glaforge / #groovylang
    How? Scripting: build automation
    !35
    Gradle plugins can
    create their own
    declarative mini-
    language

    View full-size slide

  63. @glaforge / #groovylang
    What for? Scripting: DevOps
    !
    • More Groovy-based initiatives around the DevOps theme

    !
    • Goals

    – handle Amazon AWS configuration, provisioning and deployments

    – talking with remote servers through SSH, and automating server
    configuration, working with scp and more
    !36

    View full-size slide

  64. @glaforge / #groovylang
    What for? Scripting: DevOps
    • Learn more:

    !
    – http://slideshare.net/aestasit/groovy-dev-ops-in-the-cloud

    – sshoogr: a Groovy-based DSL for working with remote SSH servers

    – grammazon: a Groovy library and Gradle plugin for working with
    Amazon EC2 instances

    !
    – https://github.com/danveloper/provisioning-gradle-plugin

    – a Gradle plugin for driving server provisioning through configuration
    !37

    View full-size slide

  65. @glaforge / #groovylang
    Who? Scripting: DevOps
    !38

    View full-size slide

  66. @glaforge / #groovylang
    Who? Scripting: DevOps
    !38
    Anyone who needs to
    automate cloud
    deployments

    View full-size slide

  67. @glaforge / #groovylang
    Who? Scripting: DevOps
    !38
    Anyone who needs to
    automate cloud
    deployments
    sshoogr & gramazon
    are from

    View full-size slide

  68. @glaforge / #groovylang
    How? Scripting: DevOps with sshoogr
    !39

    View full-size slide

  69. @glaforge / #groovylang
    How? Scripting: DevOps with sshoogr
    !39
    Remote execution

    View full-size slide

  70. @glaforge / #groovylang
    How? Scripting: DevOps with sshoogr
    !39
    Remote execution
    SSH Secure copy

    View full-size slide

  71. @glaforge / #groovylang
    How? Scripting: DevOps with gramazon Gradle plugin
    !40

    View full-size slide

  72. @glaforge / #groovylang
    How? Scripting: DevOps with gramazon Gradle plugin
    !40
    Start EC2 instances from your
    Gradle automation build

    View full-size slide

  73. @glaforge / #groovylang
    How? Scripting: DevOps
    !41
    https://github.com/aestasit

    View full-size slide

  74. @glaforge / #groovylang
    How? Scripting: DevOps with Provisioning Gradle plugin
    !42

    View full-size slide

  75. @glaforge / #groovylang
    How? Scripting: DevOps with Provisioning Gradle plugin
    !42
    Import and apply the
    Provisioning plugin for Gradle

    View full-size slide

  76. @glaforge / #groovylang
    How? Scripting: DevOps with Provisioning Gradle plugin
    !43

    View full-size slide

  77. @glaforge / #groovylang
    How? Scripting: DevOps with Provisioning Gradle plugin
    !43
    Virtual box configuration

    View full-size slide

  78. @glaforge / #groovylang
    How? Scripting: DevOps with Provisioning Gradle plugin
    !43
    Virtual box configuration
    Network configuration

    View full-size slide

  79. @glaforge / #groovylang
    How? Scripting: DevOps with Provisioning Gradle plugin
    !44

    View full-size slide

  80. @glaforge / #groovylang
    How? Scripting: DevOps with Provisioning Gradle plugin
    !44
    Disk partitioning definition

    View full-size slide

  81. @glaforge / #groovylang
    How? Scripting: DevOps with Provisioning Gradle plugin
    !45

    View full-size slide

  82. @glaforge / #groovylang
    How? Scripting: DevOps with Provisioning Gradle plugin
    !45
    Packages to be installed

    View full-size slide

  83. @glaforge / #groovylang
    How? Scripting: DevOps with Provisioning Gradle plugin
    !46

    View full-size slide

  84. @glaforge / #groovylang
    How? Scripting: DevOps with Provisioning Gradle plugin
    !46
    Post installation commands

    View full-size slide

  85. @glaforge / #groovylang
    How? Scripting: DevOps with Provisioning Gradle plugin
    !
    !
    • Checkout the Provisioning Gradle plugin from Dan Woods:

    !
    – https://github.com/danveloper/provisioning-gradle-plugin
    !47

    View full-size slide

  86. More readable &
    expressive tests
    Testing
    Case 2

    View full-size slide

  87. @glaforge / #groovylang
    What for? Testing: More readable & expressive tests
    !
    • Groovy has a malleable and streamlined syntax
    !
    • Makes it nice for creating libraries and frameworks 

    with readable and expressive APIs
    !49

    View full-size slide

  88. @glaforge / #groovylang
    Who? Testing: More readable & expressive tests
    !
    • Many companies started integrating Groovy 

    in their projects through testing, 

    before any line of Groovy code in production

    !
    • Benefit

    – easier to add, evolve and maintain test cases
    !50

    View full-size slide

  89. @glaforge / #groovylang
    How? Testing: More readable & expressive tests
    !
    • We’ll have a look at:

    !
    – the Spock testing framework

    – the Geb web integration testing framework
    !51

    View full-size slide

  90. I’m Spock...

    View full-size slide

  91. I’m Spock...
    ...the Spock testing
    framework

    View full-size slide

  92. I’m Spock...
    ...the Spock testing
    framework

    View full-size slide

  93. @glaforge / #groovylang
    How? Testing: Spock test framework
    !53

    View full-size slide

  94. @glaforge / #groovylang
    How? Testing: Spock test framework
    !53
    Wiki-like notation for
    defining data driven tests

    View full-size slide

  95. @glaforge / #groovylang
    How? Testing: Spock test framework
    !54

    View full-size slide

  96. Define the mock
    interactions

    View full-size slide

  97. Define the mock
    interactions
    Possible to define
    cardinality, matching any
    number of parameter, or
    arbitrary method name

    View full-size slide

  98. @glaforge / #groovylang
    How? Testing: Geb web integration tests
    !57

    View full-size slide

  99. @glaforge / #groovylang
    How? Testing: Geb web integration tests
    !57
    An HtmlUnit, FireFox or
    Chrome browser

    View full-size slide

  100. @glaforge / #groovylang
    How? Testing: Geb web integration tests
    !57
    An HtmlUnit, FireFox or
    Chrome browser
    Drive the browser
    to a certain URL

    View full-size slide

  101. @glaforge / #groovylang
    How? Testing: Geb web integration tests
    !57
    An HtmlUnit, FireFox or
    Chrome browser
    Drive the browser
    to a certain URL
    Assert the
    title contains
    the text

    View full-size slide

  102. @glaforge / #groovylang
    How? Testing: Geb web integration tests
    !57
    An HtmlUnit, FireFox or
    Chrome browser
    Drive the browser
    to a certain URL
    Assert the
    title contains
    the text Fill in a form, click the
    button to send it

    View full-size slide

  103. @glaforge / #groovylang
    How? Testing: Geb web integration tests with Spock
    !58

    View full-size slide

  104. @glaforge / #groovylang
    How? Testing: Geb web integration tests with Spock
    !58
    With page objects

    View full-size slide

  105. @glaforge / #groovylang
    How? Testing: Geb web integration tests with Spock
    !58
    With page objects
    BDD style: given/when/then

    View full-size slide

  106. @glaforge / #groovylang
    How? Testing: Geb web integration tests with Spock
    !58
    With page objects
    BDD style: given/when/then
    Wait for slow loading pages

    View full-size slide

  107. Extension points
    Configuration
    Customizing
    Case 3

    View full-size slide

  108. @glaforge / #groovylang
    What for? Customizing: extension, configuration, plugins
    !
    • You need to…

    !
    – customize an application for a particular customer

    – configure an application for a particular environment

    – create / update / externalize business rules

    – create plugins for extending a platform
    !60

    View full-size slide

  109. @glaforge / #groovylang
    Who? Customizing: extension, configuration, plugins
    !61

    View full-size slide

  110. @glaforge / #groovylang
    Who? Customizing: extension, configuration, plugins
    !61
    Continuous Integration server

    View full-size slide

  111. @glaforge / #groovylang
    Who? Customizing: extension, configuration, plugins
    !61
    Continuous Integration server
    Internet of Things

    View full-size slide

  112. @glaforge / #groovylang
    Who? Customizing: extension, configuration, plugins
    !61
    Continuous Integration server
    Internet of Things
    Second-generation wiki

    View full-size slide

  113. @glaforge / #groovylang
    How? Customizing: extension, configuration, plugins
    !
    • Jenkins provides two Groovy plugins:

    !
    – the Groovy plugin

    https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin

    •execute arbitrary Groovy scripts as Jenkins jobs

    !
    – the Groovy postbuild plugin

    https://wiki.jenkins-ci.org/display/JENKINS/Groovy+Postbuild+Plugin

    •set build outcome, display badges, info or error messages, once a build completed
    !62

    View full-size slide

  114. @glaforge / #groovylang
    How? Customizing: extension, configuration, plugins
    !63

    View full-size slide

  115. @glaforge / #groovylang
    How? Customizing: extension, configuration, plugins
    !
    • Home automation in the era 

    of the Internet of Things

    !
    • Built-in IDE and simulator allow you to automate 

    all your devices of your home with Groovy scripts

    https://support.smartthings.com/entries/21603015-Introduction-to-Writing-SmartApps

    !
    • Groovy supports allows to

    • set preferences, subscribe to events, set timers, handle events, send
    notifications, access people’s presence, consume external services…
    !64

    View full-size slide

  116. @glaforge / #groovylang
    How? Customizing: extension, configuration, plugins
    !
    • Home automation in the era 

    of the Internet of Things

    !
    • Built-in IDE and simulator allow you to automate 

    all your devices of your home with Groovy scripts

    https://support.smartthings.com/entries/21603015-Introduction-to-Writing-SmartApps

    !
    • Groovy supports allows to

    • set preferences, subscribe to events, set timers, handle events, send
    notifications, access people’s presence, consume external services…
    !64

    View full-size slide

  117. @glaforge / #groovylang
    How? Customizing: extension, configuration, plugins
    !65

    View full-size slide

  118. @glaforge / #groovylang
    How? Customizing: extension, configuration, plugins
    !
    • XWiki is a second-generation wiki

    http://www.xwiki.org/

    (XWiki case study: http://bit.ly/xwiki-cs)

    • not just content, but programmable

    • a platform for building your own apps

    • extensible with plugins and macros

    !
    • You can create your own plugins and macros in Groovy to extend the
    wiki, and add dynamic content
    !66

    View full-size slide

  119. @glaforge / #groovylang
    How? Customizing: extension, configuration, plugins
    !67

    View full-size slide

  120. @glaforge / #groovylang
    How? Customizing: extension, configuration, plugins
    !67
    A wiki user with programming rights
    can add this Groovy script in a page

    View full-size slide

  121. @glaforge / #groovylang
    How? Customizing: extension, configuration, plugins
    !67
    A wiki user with programming rights
    can add this Groovy script in a page
    Uses Groovy’s handy
    JSON support

    View full-size slide

  122. @glaforge / #groovylang
    How? Customizing: extension, configuration, plugins
    !67
    A wiki user with programming rights
    can add this Groovy script in a page
    Uses Groovy’s handy
    JSON support

    View full-size slide

  123. @glaforge / #groovylang
    How? Customizing: extension, configuration, plugins
    • What Groovy also brings to the table:

    !
    • a rich API for integrating and embedding Groovy in your app

    • GroovyShell, Binding, customizers…

    !
    • dedicated configuration API (ConfigSlurper) with a special
    « builder » syntax with a hierarchical data structure

    !
    • a JMX bean & JMX builder for interacting with 

    and exposing JMX services
    !68

    View full-size slide

  124. Expressive
    business rules
    Domain-Specific Language
    Case 4

    View full-size slide

  125. @glaforge / #groovylang
    What for? Domain-Specific Languages: business rules
    • The goal of Groovy Domain-Specific Languages:

    • beyond just integrating Groovy scripts and classes: create a
    dedicated mini-language modeling your business
    • less technical boilerplate code, focus on the business semantics

    • write almost plain English-like sentences
    !
    • Groovy has…

    • a succint, flexible & malleable syntax

    • both dynamic and compile-time metaprogramming capabilities

    • operator overloading
    !70

    View full-size slide

  126. @glaforge / #groovylang
    Who? Domain-Specific Languages: business rules
    !71

    View full-size slide

  127. @glaforge / #groovylang
    Who? Domain-Specific Languages: business rules
    !71
    US Fortune 500 insurance actuaries
    write risk calculation rules in Groovy

    View full-size slide

  128. @glaforge / #groovylang
    Who? Domain-Specific Languages: business rules
    !71
    US Fortune 500 insurance actuaries
    write risk calculation rules in Groovy
    EPO built a data flow language atop Groovy to extract /
    transform / route patents across patent offices

    View full-size slide

  129. @glaforge / #groovylang
    Who? Domain-Specific Languages: business rules
    !71
    US Fortune 500 insurance actuaries
    write risk calculation rules in Groovy
    EPO built a data flow language atop Groovy to extract /
    transform / route patents across patent offices
    1 billion € worth of loan granted through Hypoport’s
    financial platform Groovy decision rules

    View full-size slide

  130. @glaforge / #groovylang
    Who? Domain-Specific Languages: business rules
    !71
    US Fortune 500 insurance actuaries
    write risk calculation rules in Groovy
    EPO built a data flow language atop Groovy to extract /
    transform / route patents across patent offices
    1 billion € worth of loan granted through Hypoport’s
    financial platform Groovy decision rules
    Customize experience of travel and hotel
    reservation with Groovy scripts and templates

    View full-size slide

  131. @glaforge / #groovylang
    Who? Domain-Specific Languages: business rules
    !71
    US Fortune 500 insurance actuaries
    write risk calculation rules in Groovy
    EPO built a data flow language atop Groovy to extract /
    transform / route patents across patent offices
    1 billion € worth of loan granted through Hypoport’s
    financial platform Groovy decision rules
    Customize experience of travel and hotel
    reservation with Groovy scripts and templates
    Case study:
    http://bit.ly/epo-cs

    View full-size slide

  132. @glaforge / #groovylang
    How? Domain-Specific Languages: business rules
    • Groovy uses BigDecimal by default for floating point

    • you can, of course, specify floats or doubles if needed

    • important for financial calculations w/ exact arithmetics
    !72

    View full-size slide

  133. @glaforge / #groovylang
    How? Domain-Specific Languages: business rules
    • Groovy uses BigDecimal by default for floating point

    • you can, of course, specify floats or doubles if needed

    • important for financial calculations w/ exact arithmetics
    !72

    View full-size slide

  134. @glaforge / #groovylang
    How? Domain-Specific Languages: business rules
    • Groovy uses BigDecimal by default for floating point

    • you can, of course, specify floats or doubles if needed

    • important for financial calculations w/ exact arithmetics
    !72

    View full-size slide

  135. @glaforge / #groovylang
    How? Domain-Specific Languages: business rules
    • Groovy uses BigDecimal by default for floating point

    • you can, of course, specify floats or doubles if needed

    • important for financial calculations w/ exact arithmetics
    !72
    Which formula would
    you rather maintain?

    View full-size slide

  136. @glaforge / #groovylang
    How? Domain-Specific Languages: business rules
    • Groovy uses BigDecimal by default for floating point

    • you can, of course, specify floats or doubles if needed

    • important for financial calculations w/ exact arithmetics
    !72
    Which formula would
    you rather maintain?
    Operator overloading

    View full-size slide

  137. @glaforge / #groovylang
    How? Domain-Specific Languages: business rules
    • Groovy lets you create your own control 

    structures with closures
    !73

    View full-size slide

  138. @glaforge / #groovylang
    How? Domain-Specific Languages: business rules
    • Groovy lets you create your own control 

    structures with closures
    !73

    View full-size slide

  139. @glaforge / #groovylang
    How? Domain-Specific Languages: business rules
    • Groovy lets you create your own control 

    structures with closures
    !73

    View full-size slide

  140. @glaforge / #groovylang
    How? Domain-Specific Languages: business rules
    • Groovy lets you create your own control 

    structures with closures
    !73

    View full-size slide

  141. @glaforge / #groovylang
    How? Domain-Specific Languages: business rules
    • A Groovy-based DSL developed at the

    Liverpool School of Tropical Medicine

    to study antimalarial drug resistance
    !74

    View full-size slide

  142. @glaforge / #groovylang
    How? Domain-Specific Languages: business rules
    • A Groovy-based DSL developed at the

    Liverpool School of Tropical Medicine

    to study antimalarial drug resistance
    !74
    Paper:
    http://bit.ly/ronald-dsl

    View full-size slide

  143. Adding properties to
    numbers through runtime
    meta-programming

    View full-size slide

  144. Adding properties to
    numbers through runtime
    meta-programming
    Groovy « command chains »: syntax
    convention for dropping parens & dots for
    natural-language-like sentences

    View full-size slide

  145. Web & reactive apps
    Desktop apps
    Full blown apps
    Case 5

    View full-size slide

  146. @glaforge / #groovylang
    Groovy ecosystem
    • The Groovy ecosystem is rich of tools, frameworks, and libraries

    !
    • For web development, you can use

    – the mainstream Grails web stack, powered by Spring and Groovy

    – the newcomer Ratpack, a lightweight toolkit on top of Netty

    – or Spring Boot, an opinionated & Groovy-friendly take on Spring

    !
    • For desktop applications, you can use Griffon

    – which supports different view toolkits such as GroovyFX, Swing, Pivot…
    !77

    View full-size slide

  147. @glaforge / #groovylang
    What for? Full blown apps: the Grails web framework
    !
    • Grails is a full web stack for the JVM

    – based on Groovy and Spring

    – can interact with relational databases through Hibernate or through
    any NoSQL datastore with Spring Data, with the GORM mapping layer

    – follows the Convention over Configuration paradigm

    – lets you see changes live with hot reloading

    – advanced REST and Async support
    – built-in view technology (GSPs) with taglibs
    !78

    View full-size slide

  148. @glaforge / #groovylang
    Who? Full blown apps: the Grails web framework
    !79

    View full-size slide

  149. @glaforge / #groovylang
    Who? Full blown apps: the Grails web framework
    !79
    Created the Open Source Asgard web interface for application
    deployments and cloud management in Amazon Web Services

    View full-size slide

  150. @glaforge / #groovylang
    Who? Full blown apps: the Grails web framework
    !79
    Created the Open Source Asgard web interface for application
    deployments and cloud management in Amazon Web Services
    LinkedIn uses Grails for their commercial portals, for
    recruiters, companies searching for profiles…

    View full-size slide

  151. @glaforge / #groovylang
    Who? Full blown apps: the Grails web framework
    !79
    Created the Open Source Asgard web interface for application
    deployments and cloud management in Amazon Web Services
    LinkedIn uses Grails for their commercial portals, for
    recruiters, companies searching for profiles…
    Many web frontends from the Sky network serving a
    few hundred millions page views a month

    View full-size slide

  152. @glaforge / #groovylang
    Who? Full blown apps: the Grails web framework
    !79
    Created the Open Source Asgard web interface for application
    deployments and cloud management in Amazon Web Services
    LinkedIn uses Grails for their commercial portals, for
    recruiters, companies searching for profiles…
    Many web frontends from the Sky network serving a
    few hundred millions page views a month
    Wired’s product review section is
    powered by Grails

    View full-size slide

  153. @glaforge / #groovylang
    How? Full blown apps: the Grails web framework
    !80

    View full-size slide

  154. @glaforge / #groovylang
    How? Full blown apps: the Grails web framework
    !80
    Too hard to cover Grails in a couple
    slides, just go download it now! :-)

    View full-size slide

  155. Groovy’s cool :-)
    Summary

    View full-size slide

  156. @glaforge / #groovylang
    Java’s best friend
    • Java derived syntax
    –Flat learning curve
    –Easy to learn
    • But goes beyond Java
    –Concise, expressive, readable
    –Fit for Domain-Specific Languages
    • Seamless & transparent Java integration
    –Mix & match Groovy & Java classes (joint compil.)
    –No language barrier to cross
    !82

    View full-size slide

  157. @glaforge / #groovylang
    Groovy’s nature
    !
    • Object oriented dynamic language...

    !
    • But...

    – as type safe as you want it — static type checking

    – as fast as you need it — static compilation

    – as functional as you make it — closures...
    !83

    View full-size slide

  158. @glaforge / #groovylang
    Groovy use cases
    • Scripting tasks, build automation, DevOps

    • Extension points for customizing / configuring apps

    • More readable and expressive tests

    • Business languages & Domain-Specific Languages

    • Full blown apps

    – for the web with Grails, Ratpack, Gaelyk

    – for web reactive programming with Reactor

    – for desktop with Griffon
    !84

    View full-size slide

  159. …for your
    attention!
    Thanks

    View full-size slide

  160. Slides will be available at:
    speackerdeck.com/
    glaforge
    Q & A

    View full-size slide