DEV Community

Discussion on: Category vs Design pattern

Collapse
 
bootcode profile image
Robin Palotai

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 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).

Btw, for Java I recommend AutoValue with Builder, see github.com/google/auto/blob/master....

Collapse
 
stereobooster profile image
stereobooster

I guess you can open issue or PR in GH repository.

Collapse
 
bootcode profile image
Robin Palotai

True. I pass on the opportunity though :)