This document summarizes key points from a presentation about how the Groovy programming language helps developers adopt good practices outlined in Effective Java. It discusses how some Effective Java items like avoiding nulls and enforcing immutability are built into Groovy. AST transformations further reduce work by implementing patterns like the singleton pattern. While Effective Java provides good guidelines, direct implementations may not always apply to Groovy - the language aims to reduce friction to writing good code. Overall, programming languages can help developers implement best practices through built-in functionality and transformations.
Watermarking in Source Code: Applications and Security Challenges
Effective Java with Groovy - How Language Influences Adoption of Good Practices
1. Effective Java
With Groovy -
How Language
Influences Adoption of
Good Practices
Naresha K
@naresha_k
https://blog.nareshak.com/
APACHECON @HOME
Spt, 29th – Oct. 1st 2020
5. 5
Most people talk about Java the language,
and this may sound odd coming from me,
but I could hardly care less. At the core of
the Java ecosystem is the JVM.
- James Gosling,
Creator of the Java Programming Language(2011, TheServerSide)
8. initial idea was to make a little
dynamic language which compiles
directly to Java classes and provides
all the nice (alleged) productivity
benefits
- James Strachan
http://radio-weblogs.com/0112098/2003/08/29.html
9. Know your guides
Context/ the Problem
What does “Effective Java” say?
The traps
Groovier Solution
Lessons Learned
Tool Wisdom
9
48. Rules to make a class immutable
1. Don’t provide any mutators
2. Ensure that the class can’t be extended
3. Make all fields final
4. Make all fields private
5. Ensure exclusive access to any mutable
components
49. class ImmutableClass{
private final def field1
private final def field2
//...
private final def field10
public ImmutableClass(f1, f2,… f10){
//initialization
}
}
71. Take Away
Some of the ‘Effective Java’ already built into
the language
AST Transformations reduce the effort to
implement few more
Effective Java implementations may not always
be effective Groovy implementations (Traps)