back

by dcminter·13y ago·view on hn ↗
(1) The "Java Bean spec" is not closely followed for precisely this reason. Technically it requires setters for all attributes but in practice many libraries (certainly Spring) permit initialization via the constructor and treat getters as sufficient.

(2) Because of (1) constructors are indeed still used. In fact they're very actively preferred because IF you use the constructor then all immutable attributes can be declared final making the compiler warn you of unintentionally altered state.

(3) I violently disagree. Vast interfaces are a code smell and would fail code review in every team I've ever worked in. If you can't do this then odds are in a deficiency not in the principle but in your understanding of the domain.

(4) Sounds like a problem with your process not the principle.