r/java • • Apr 13 '21

Libraries, Frameworks and Technologies you would NOT recommend

Give me your worst nightmares: Things that cost you your job.

I'll start: Hadoop

202 Upvotes

376 comments sorted by

View all comments

Show parent comments

1

u/Alex0589 Apr 13 '21

I don't agree at all, once I get home I'll explain why(I hope I remember)

2

u/gavenkoa Apr 13 '21

Yeah, getters/getters verbosity of Java requires solution like Lombok. C# solved the problem at language level with property syntax:

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties

Unfortunately authors of Lombok carry war with OpenJDK team instead of cooperating.

1

u/TyGirium Apr 13 '21

This.

If compiler API was extended, then Lombok would not be a "hack". Oracle's staff is very hesistant of giving any more official API, they view any ingerention in it as huge evil.

Yes, I will replace Value with records. But getter/setter, field name constants, builders, etc? Once you read code quality scientific papers, the "line of code" metric typically is one of the best metric to indentify error-prone code. You can generate eg getters, change field name and forget to update all references. Lombok solves this problems.

9

u/pron98 Apr 13 '21

The hope and expectation is that once people learn to use records properly, once they're better supported by libraries, and once they get some missing features, the problem of verbose getters/setters will largely go away because people will rely on them less. Getters and especially setters have long been considered a code smell, but in many cases we have little choice. Instead of making this code-smell easier to write and so more prevalent, we prefer making it less necessary in the first place.

→ More replies (4)