I would take those with some reservation though. For example, randomly looking, the advice to relate Builder with record syntax, smart constructor is very odd.
The benefit of Builder is that it protects from building incomplete/invalid instances. Using record syntax, with dummy default data, doesn't help that at all.
They get the OO Builder wrong too, with using default fields. The builder should explicitly warn on required but uninitialized fields (apart from other checks).
Thanks for the article, didn't know the GH link!
I would take those with some reservation though. For example, randomly looking, the advice to relate
Builder
withrecord syntax, smart constructor
is very odd.The benefit of
Builder
is that it protects from building incomplete/invalid instances. Using record syntax, with dummy default data, doesn't help that at all.They get the OO
Builder
wrong too, with using default fields. The builder should explicitly warn on required but uninitialized fields (apart from other checks).Btw, for Java I recommend
AutoValue
withBuilder
, see github.com/google/auto/blob/master....I guess you can open issue or PR in GH repository.
True. I pass on the opportunity though :)