mercredi 1 juillet 2015

Builder or Factory for creating an instance with another builder

I have the classes A (client), B, C (Builder), and D (Obj).

If a builder (C) is used to create an instance of D, and I would like to simplify (easier reuse) that process should B be a builder or a factory (or even a director).

Take this example:

var driver = new webdriver.Builder()
    .usingServer('http://ift.tt/1xLqeX2')
    .withCapabilities(capabilities)
    .build();

C here is clearly the provided builder, and D is the driver.

The real question is what should the wrapping class be? A factory or a builder?

Aucun commentaire:

Enregistrer un commentaire