Effective Java with Groovy - How Language Influences Adoption of Good Practices - ApacheCon@Home 2020 Slides Releated blog posts
Effective Java with Groovy Collection of blog posts on how Groovy improves the developer experience of implementing Effective Java practices. 1. GR8Conf EU Talk 2. When float and double put you in trouble! 3. Are you implementing equals and hashCode correctly? 4. Favour Internal Iterators 5. Enabling Order 6. The (in)famous null 7.
What's in Groovy for Functional Programming Collection of blog posts on functional programming with Groovy. * Closures * Higher order functions * Currying * Function composition * Pure functions * Immutability * Recursion * Tail call optimisation * Memoization * Collect - map operation * Filter * Reduce * Map filter reduce * Strategy pattern * Command pattern * Execute Around pattern
Groovy Scripts - Reusable Code Let's start with the following Groovy script which reads and prints all the properties from a file. import java.nio.file.Path Properties loadProperties() { Properties properties = new Properties() Path propertyFilePath = Path.of('my.properties') propertyFilePath.withInputStream { properties.load(it) } properties } Properties properties = loadProperties() properties.each { println
Effective Java with Groovy - Immutability It would seem like mutability is the default design approach when it comes to Java. However, reading "Effective Java" makes you change your mind. The book suggests - 'minimise mutability'. Also, what is highly useful is the reason for favouring immutability - "immutability is simple&
Effective Java with Groovy - The (in)famous null If you have seen some of the enterprise applications written in Java, you know the amount of code goes into performing null checks. The 'null reference' feature of Java for sure is the #1 contributor to employment generation. The creator of null reference has already admitted that it
Effective Java with Groovy - Enabling Order This post shows how does Groovy make it convenient for you to implement Comparable and Comparator interfaces.
Micronaut HTTP Client - Error Flow We have seen Micronaut BlockingHttpClient in action and how to use exchange and retrieve methods to interact with an HTTP endpoint. What happens if your endpoint returns HTTP status code greater than or equal to 400 (they indicate that it's an error)? To explore this, let's
Groovy Scripts - Exploring Binding In a previous post exploring scripting basics, we saw how binding was used to supply command-line arguments to scripts. In this post, let's explore the design of binding further. class BindingDemo { static void main(String[] args) { Binding sampleBinding = new Binding() println sampleBinding.variables sampleBinding.message = "Hello"