Follow

s/([^ ]+)Builder/\1Factory/g

Making Rust more familiar to Java programmers.

@ayo in Java there are also builders, but they're not the same as factories.

Foo foo = new FooBuilder().setBool(true).enalbeBar().setBuzzinator(myBuzzinator).setHost("localhost").setPort(1234).build();

vs

Foo foo1 = fooFactoryFromHeaven.makeFoo("localhost", 1234);
Foo foo2 = fooFactoryFromHeaven.makeFoo("example.com", 42)

Builder is a convenient wrapper around a constructor with 100 arguments, half of which are optional.

Factory is an indirection of a constructor.

Sign in to participate in the conversation
lonely.town

A lonely little town in the wider world of the fediverse.