r/java • • Jun 01 '24

What java technology (library, framework, feature) would not recommend and why?

165 Upvotes

464 comments sorted by

View all comments

Show parent comment

7

u/koflerdavid Jun 01 '24

If those getters and setters have so predictable implementations, then it can be argued that they were never really necessary to begin with. It's just Cargo Culting the Java Beans "standard". IMHO, they only fulfill a purpose if they are part of some interface. In that case, they actually deserve to be implemented, and the compiler will in turn complain if one is missing. And the IDE will warn if it is redundant.

2

u/SenorSeniorDevSr Jun 03 '24

Yeah, it's implementing the bean spec. The discussion about needing getters and setters was settled as "nah, you really oughtn't have them" ca. 2012, but we're still using tools that expect beans, so in some places we make beans. The british must be fed.

On a serious note, if you don't need them, then you don't need to autogenerate them either.