You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a very simple proposal for a small change to the builder pattern naming.
I had no idea that I could use a builder to customize the client until I started looking into the code.
Most implementations include a builder method that returns the builder, then a build function that generates an instance of the (built) class.
Because the builder function returns an instance of the builder and the build method returns an instance of the "buit" class, there is a distinction between the two.
To help new users understand that the client is not built directly but rather provides a builder that must subsequently be invoked with the build function in order to return an instance of the class, I suggest renaming this to builder.
The text was updated successfully, but these errors were encountered:
I don't disagree with anything you've said, but I am cautious of making a breaking change.
I've had 3 breaking releases in the past 3 or so months, and I'm not sure the benefits of this rename would outweigh the annoyance of another breakage.
Actually, what I'd probably prefer to do is add a Client::builder function as you suggest, and then mark Client::build as deprecated. Then in a few releases I can remove the deprecated function.
Though I am still a little cautious of doing that - I'd prefer to avoid making a release thats only purpose is to deprecate that function. But once some other releasable changes come along I think I'd be fine including the deprecation along with them.
I have a very simple proposal for a small change to the builder pattern naming.
I had no idea that I could use a builder to customize the client until I started looking into the code.
Most implementations include a
builder
method that returns the builder, then abuild
function that generates an instance of the (built) class.Because the
builder
function returns an instance of the builder and thebuild
method returns an instance of the "buit" class, there is a distinction between the two.To help new users understand that the client is not
built
directly but rather provides abuilder
that must subsequently be invoked with thebuild
function in order to return an instance of the class, I suggest renaming this tobuilder
.The text was updated successfully, but these errors were encountered: