Best Practices for New Language Feature Usage

Brian Goetz brian.goetz at oracle.com
Tue Jun 4 17:51:25 UTC 2024


I would like for such discussions to be in scope, but I am also mindful 
that it is easy for such a discussion to generate a 300-message-long 
thread that is 99% opinion-based (in which case it would overwhelm the 
primary traffic on the list.)

Regardless, I would recommend against calling *anything* "Best 
Practices"; this is a term that was mostly marketing when it was first 
invented, and has deprived of whatever meaning it had left since.  
(Originally it was coined by a consulting company in the 80s, but at 
least had the benefit of having derived said practices from observing 
what their clients actually did in practice, and how it worked out.  
Most claims of "Best Practice" made by developers today amount to "I 
like this better and want to justify it.")

So I recommend a slightly less lofty-goal, which is discussing whether 
specific patterns should or should not be encouraged by tooling, and let 
these percolate into style guides as appropriate (but let that happen 
somewhere else.)

On 5/27/2024 5:03 PM, David Alayachew wrote:
>
> I maintain a static analysis tool for Java, called Checkstyle 
> <https://github.com/checkstyle/checkstyle>. We do our best to stay up 
> to date with support for parsing the latest Java syntax, sometimes it 
> is hard to know what best practices are for a given feature, 
> especially when it is still in preview (we try to support high-demand 
> preview features if they have 2-3 preview releases). Would this 
> mailing list be an appropriate place to inquire about and discuss how 
> to correctly (and incorrectly) use new language features?
>
> For example, I was thinking of creating a post called "Java 21 Record 
> Pattern Best Practices". My hope would be that perhaps some of the 
> folks that worked on delivering, testing, or just using this feature 
> could comment on good usages, things they have seen that are a bad 
> idea, and so on. This would help Checkstyle immensely by inspiring the 
> creation of new ways to analyze code and help developers to use these 
> new features in the best possible way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20240604/bd7d1909/attachment.htm>


More information about the amber-dev mailing list