Create builders for all recipes (especially lombok ones) #4886
Replies: 1 comment 1 reply
-
Thanks for the suggestion @crankydillo . I do understand the frustration when a new nullable argument is added that you might need to update constructors. Internally we tend to use The suggestion of using a builder is interesting, but I'm somewhat hesitant as it doubles the effective exposed API, which would then also have to be supported going forward. Additionally there is some serialization involved with recipes, and loading them from declarative yaml files, which means there's potential for this to trip up in unexpected ways. We've relatively recently added the option to build a recipe list, which also hints at potentially using builders in the future: For now we'll aim to have few such breaking changes, until we figure out the best path forward. The buildRecipeList above would be another reason to do so. |
Beta Was this translation helpful? Give feedback.
-
#4480 ultimately roots in using constructors. I think since lombok is used so heavily it might not be glaringly obvious when a breaking change is created. While we try to use declarative recipes as much as possible, we still need to instantiate some in the code. However, we are concerned about doing that and having breaking changes come in (just by adding a new
@Nullable
field).WDYT about adding builders for all the recipes? At least when easy. Can't you just add
@Builder
on the recipe when lombok is involved?So instead of doing
new SomeRecipe("a", 1234, null)
, I can doSomeRecipe.Builder.newBuilder().string("a").num(123).build()
? That would make our code nicer and hopefully shield us from field changes that could be backward compatible.Beta Was this translation helpful? Give feedback.
All reactions