Effective Java with Groovy - How Language Influences Adoption of Good Practices - ApacheCon@Home 2020
Slides Releated blog posts…
Slides Releated blog posts…
Slides Related blog posts…
Collection of blog posts on how Groovy improves the developer experience of implementing Effective Java practices. GR8Conf EU TalkWhen float and double put you in trouble!Are you implementing equals and hashCode correctly?Favour Internal IteratorsEnabling OrderThe (in)famous nullImmutability…
Collection of blog posts on functional programming with Groovy. ClosuresHigher order functionsCurryingFunction compositionPure functionsImmutabilityRecursionTail call optimisationMemoizationCollect - map operationFilterReduceMap filter reduceStrategy patternCommand patternExecute Around pattern…
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 it } The script needs…
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". Did you get surprised? Now,…
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 was a…
This post shows how does Groovy make it convenient for you to implement Comparable and Comparator interfaces.…
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 create an endpoint that…
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" println sampleBinding.variables println…