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

Why Groovy Gr8Conf 2018

Why Groovy Gr8Conf 2018

Groovy has been around for a long time, but over the last several years, Groovy has changed a lot. Some of the articles, blog posts, and talks published about early versions of Groovy are just no longer true. By the end of this session, you’ll be able to tell some of the best Groovy truth from fiction and leave with some solid arguments for your boss and others as to why Groovy is such an awesome, productive, and readable alternative language for the JVM.

We'll start with some of the community’s favorite features like special operators, optional typing, metaprogramming, and dynamic vs. static compilation. We’ll also explore popular libraries and frameworks where knowing Groovy would be helpful such as Gradle build files, Elasticsearch, Jenkins, and Apache Spark. The session concludes with ways to learn more and how to contribute to making Groovy even more groovy.

------
Jennifer “Jenn” Strater is a Senior Engineer at Zenjob Gmbh in Berlin, Germany where we revolutionize the way students work. She was formerly a co-founder of GR8Ladies and is now part of the board of GR8DI, the Apache Groovy Diversity Initiative. She has also organized GR8Workshops for developers interested in an overview and crash course in Groovy technologies and presented on several Groovy topics at events such as the Grace Hopper Celebration of Women in Computing, Greach, GR8Conf EU, GR8Conf US, Devoxx Belgium, JFokus, and Spring One Platform.

jlstrater

May 31, 2018
Tweet

More Decks by jlstrater

Other Decks in Technology

Transcript

  1. Why use #groovylang? How to convince your boss and others

    Jenn Strater @codeJENNerator @zenjobcom
  2. @codeJENNerator Note For Those Viewing Slides Online • Bulleted text

    like this indicates the key points mentioned on a previous slide. They may not have been included in the official presentation. • Not every slide was in the presentation. There is more content then time so some are skipped at some conferences. • If this view does not support links, the links will work in the pdf. Click the ‘download pdf’ button on the right.
  3. @codeJENNerator About Me - Working at Zenjob. - Groovy (mostly

    Grails) user since 2013. - Before moving to Berlin, I spent a year in Copenhagen. - Before that, I was senior consultant at Object Partners, Inc. in Minneapolis, MN, USA. - Co-founder of Gr8Ladies (deprecated) - Passionate about bring new people into the Groovy community through free introductory workshops called Gr8Workshops and supporting underrepresented minorities and their careers in tech.
  4. @codeJENNerator Audience Background • Groovy • Everyday user • Side

    project user • New to Groovy • Frameworks / Tools • Grails • Spock • Gradle • Griffon • Jenkins
  5. @codeJENNerator • After spending some time at Java User Groups,

    Conferences, and reading lots of stuff online, I realized that there are a lot of things people get wrong about Groovy or that just aren’t true in the most recent versions. • All of these assumptions are things are related to conversations I’ve had with real people at some point in my career.
  6. @codeJENNerator • Groovy is a language and can be used

    independently or in many different frameworks including: • Grails • Griffon • Gaelyk • Spock • Ratpack • Vertx • And many more!
  7. @codeJENNerator • Groovy CAN BE used for scripting, but it’s

    NOT ONLY a scripting language. It can also be used in OOP and functional projects too.
  8. @codeJENNerator • We protect against runtime errors with good practices

    like static analysis tools (think Codenarc), code reviews, writing comprehensive tests, and learning about common pitfalls and mistakes made in Groovy (like reading blogs and going to conferences) • Moving execution of code to runtime isn’t always bad, sometimes adding null-safes can protect against NPEs.
  9. @codeJENNerator • Groovy is OPTIONALLY typed. Def can be used

    when a type is flexible, but unlike some other languages, declaring def x = 3 followed by x = ‘hello’ is totally valid Groovy. • Also, using static compilation (vs the default dynamic compilation) makes a difference in what behaviors are allowed. • Groovy is called dynamic language not because of typing but because of the dynamic features including runtime metaprogramming. • For a really good explanation of the Groovy type system, read Groovy in Action 2nd Edition!
  10. @codeJENNerator • It’s true that Groovy is slower than optimal

    Java, but not by as much as most people think.
  11. @codeJENNerator • It mainly depends on what you write. For

    example, some improperly used looping methods may be slower than the Java counterpart. • Compilation also matters. Statically compiled Groovy code can run almost as fast as well-written Java code. However, dynamic Groovy isn’t that much slower (if written with performance in mind). • Consider reading https://www.linkedin.com/pulse/ how-make-groovy-fast-java-david-e-jones/ for more info.
  12. @codeJENNerator • Gradle needed some major reworking. Not because of

    Groovy itself but because of how they implemented the DSL (hindsight is always 20/20!) • Kotlin solves issues that many end users (especially Android devs) have with Gradle including poor IntelliJ support and the fact that many people don’t know Groovy. I’ve seen so many people use it without really knowing the best practices resulting in horrible builds. That’s not really the fault of Groovy or Gradle, but . • Gradle could have been reworked to support Groovy better, but for now, Kotlin makes more sense. • Also, Groovy support is not going away! Kotlin is just being added (with maybe some extra enhancements). • Mostly from my own experience and http://melix.github.io/blog/2016/05/ gradle-kotlin.html
  13. @codeJENNerator • If you find yourself forgetting to add @CompileStatic

    at the top of every file in your groovy code, you can set compiler options using Gradle and it will apply static compilation to every file in your source directory. • https://stackoverflow.com/a/30307025/2250125
  14. @codeJENNerator • Although Grails originally started as a Rails like

    MVC framework for the JVM, it has since very much diverged from Ruby on Rails. Grails is not just for monoliths but the profile system can be used for many different types of applications. Grails 3.0 is also heavy reliant on Spring Boot and goes even further in that direction.
  15. @codeJENNerator Groovy Downloads in Thousands 0 1500 3000 4500 6000

    January 2012 July 2012 January 2013 July 2013 January 2014 July 2014 January 2015 July 2015 January 2016 July 2016 January 2017 July 2017 Codehaus Bintray Maven Central
  16. @codeJENNerator Groovy Downloads in Thousands 0 1500 3000 4500 6000

    January 2012 July 2012 January 2013 July 2013 January 2014 July 2014 January 2015 July 2015 January 2016 July 2016 January 2017 July 2017 Codehaus Bintray Maven Central End of Pivotal Support
  17. @codeJENNerator Groovy Downloads in Thousands 0 1500 3000 4500 6000

    January 2012 July 2012 January 2013 July 2013 January 2014 July 2014 January 2015 July 2015 January 2016 July 2016 January 2017 July 2017 Codehaus Bintray Maven Central End of Pivotal Support Gradle Kotlin Announcement
  18. @codeJENNerator Groovy Downloads in Thousands 0 1500 3000 4500 6000

    January 2012 July 2012 January 2013 July 2013 January 2014 July 2014 January 2015 July 2015 January 2016 July 2016 January 2017 July 2017 Codehaus Bintray Maven Central End of Pivotal Support Gradle Kotlin Announcement ???
  19. @codeJENNerator • Groovy downloads are up and higher than any

    time under Pivotal • In the last few years under Apache, Groovy has added many new contributors from various companies and individuals all over the world. • Although there is no single company is sponsoring the language, companies like OCI sponsor developers at least part-time.
  20. @codeJENNerator • Groovy releases are more frequent than in a

    long time. • Improvements coming in 2.5 including macros and 2.6/3.0 with the parrot parser will majorly change Groovy for the better. Most of the work on the parrot parser comes from a new committer, Daniel Sun! • OCI’s support of the Grails framework means several people are dedicated to it and releases are frankly coming out faster than I can keep up.
  21. @codeJENNerator See if you are already using Groovy • Jenkins

    (Pipeline, Jobs Plugin, and many more!) • Spring Boot (optional Groovy support) • Apache Spark • SoapUI • JMeter • Tinkerpop (Gremlin) • Oracle NoSQL Database • Elasticsearch (deprecated)
  22. @codeJENNerator Spock • Groovy can be used in tests, but

    not in the end product if you don’t need it. • Once you start using Spock, you can add other awesome tools like Get and Test Containers
  23. @codeJENNerator Try a small POC • Frameworks like Grails are

    great for trying something out. If the team gets used to using Groovy for small projects, it might be easier to use it in more places later.
  24. @codeJENNerator Get Connected • Subscribe to the groovy users mailing

    list • Join the Groovy Community on Slack groovycommunity.com or sign-in again at groovy- community.slack.com • Contribute by writing documentation or fixing bugs. • Attend conferences like GR8Conf EU 2018. • Join Zenjob!
  25. @codeJENNerator • Groovy is a fun language with a great

    community! • You can use Groovy in many different ways!
  26. @codeJENNerator • Groovy is a fun language with a great

    community! • You can use Groovy in many different ways! • It isn’t an all-or-nothing solution. You can start small.
  27. @codeJENNerator • Groovy is a fun language with a great

    community! • You can use Groovy in many different ways! • It isn’t an all-or-nothing solution. You can start small. • Start talking about Groovy with your boss and coworkers and make sure they don’t keep spreading the Groovy myths. Keep them on the Groovy truth.
  28. @codeJENNerator • Groovy is a fun language with a great

    community! • You can use Groovy in many different ways! • It isn’t an all-or-nothing solution. You can start small. • Start talking about Groovy with your boss and coworkers and make sure they don’t keep spreading the Groovy myths. Keep them on the Groovy truth. • Rather than talking bad about problems with Apache Groovy, contribute! Anyone can shape the future.