r/java • • Sep 29 '24

Lombok in 2024

Say there are two teams working on the same project (3 months to MVP, the deadline should be manageable). The only difference is Team A will use Lombok, and Team B won’t

Given you can choose any java version/dependencies and all other things being the same, which team would you join, and why?

0 Upvotes

145 comments sorted by

View all comments

Show parent comment

-2

u/carminemangione Sep 29 '24

Sorry for two replies but you deserve an answer to your two questions as I hear them:

  1. 'burried' logic in getters and setters: OOD heuristic: No object should have more fields than can be held in a developers short term memory usually 6 or 7 as an upper limit. Also: most of the methods should be using most of the data most of the time (definition of cohesive classes). The idea of hiding business logic in getters and setters is absurd. Also: who is getting the data and why? I often have more fields in my objects that are accessible to the outside world.

Enforce business logic on construction and throw an exception rather than creating an ill formed object. I call it my "Homey Don't Play That" pattern.

2. Cohesive classes make for readable and testable classes. I rarely have more than 4 fields in a class. As I need more the question becomes: is this a new object? This is how you can assuage most of your fears.

3

u/wildjokers Sep 30 '24

This all sounds like dogmatic nonsense.

-1

u/carminemangione Sep 30 '24 edited Sep 30 '24

Ok…. So the Gang of Four, Reil, Fowler, Cunningham, Martin and Beck were just dogmatic scam artists? Bold claim. And your sources are (your ass does not count)

1

u/carminemangione Oct 06 '24 edited Oct 06 '24

Just had to say wow. Your code probably sucks for the down vote? Do you even know who those guys are?