Groovy
Groovy Developer Manifest
@musketyr has published a Groovy Developer Manifest.
I agree with one point heartily:
I will never use Map as an excuse not to create meaningful class
The abuse of Maps is one of the biggest problems that I see in Grails apps. The behaviour is reinforced by some internal Grails APIs. For example, GORM methods taking a Map to supply offset
, max
. Or the params
object, which is an instance of GrailsParameterMap
, but it is often manipulated as a Map and supplied to the service layer to methods expecting a Map parameter.
Please, let us all stop abusing Maps.
Creating Extra Method Supporting Named Arguments Using @NamedVariant Annotation
Another point mentioned in the Manifesto is:
I will use @NamedParam, @NamedDelegate and @NamedVariant instead of raw Map method parameters
Those transforms were introduced in 2.5.0 and are explained brilliantly by @mrhaki.
@ClosureParam Annotation
Another point mentioned in the Manifesto is:
I will use @ClosureParams for every Closure method parameter
This points to the Groovy docs which is the best explanation I found for @ClosureParams
.
@ClosureParams parameter annotation is aimed at helping IDEs or the static type checker to infer the parameter types of a closure.
@DelegatesTo For Type Checking DSL
Another point mentioned in the Manifesto is:
I will use @DelegatesTo for every Closure method parameter with altered delegate
It helps the IDE and static compilation capabilities.
With this annotation we can document a method and tell which class is responsible for executing the code we pass into the method. If we use @TypeChecked or @CompileStatic then the static type checker of the compiler will use this information to check at compile-time if the code is correct. And finally this annotation allows an IDE to give extra support like code completion.
Micronaut
OCI Webinar - Meet GalecinoCar: A Micronaut-Powered self-driving Car
I often joke @RyanVanderwerf is Groovy community's Tony stark. His latest project serves to confirm my suspicion. Learn how he used Micronaut to build a, 1:16-Scale, self-driving car.
💵 Price: Free
📅 Date: August 10, 2018
⏳ Time: 11:00 a.m. CT
📍Location: Online
Grails
GR8DI Summer Internships
Help make the GR8DI Summer Internships possible:
To make this 2-month program possible, we need funds to pay for an office for the students to work and a very small stipend (only about $30 per month) to pay for the room and board of the 4 interns.
Gradle
▶ Debug the Gradle DSL blocks
This would definitely help to work with Gradle DSL:
You can now debug a Gradle script in IntelliJ IDEA. Previously, you could debug a build.gradle file only as a Groovy script. With IntelliJ IDEA 2018.2, you can now set a breakpoint not only at the top level of the Gradle build script, but also in the Gradle DSL blocks.
Comment
A Groovy Developer Manifest is a great excuse to learn about several Groovy features. Let's dive right into it.
Sergio