Are these both considered Builder pattern? They're extremely different and having different totally different implementations and purposes The 2019 Stack Overflow Developer Survey Results Are InWhat is the difference between Builder Design pattern and Factory Design pattern?Best method to remove session handled by Session Proxy patternA Bridge Pattern exampleHow to implement the factory method pattern in C++ correctlyEffective Java By Joshua Bloch: Item1 - Static Factory MethodInheriting a class which is built using a static inner class BuilderHow to implement Builder pattern in Kotlin?Singleton Design Pattern - Explicitly stating a Constructor outside the classWhich Design Pattern I need to Use Java Applicationembedded c++ : dynamic typing without dynamic allocation?

Are there any other methods to apply to solving simultaneous equations?

How to answer pointed "are you quitting" questioning when I don't want them to suspect

What is the best strategy for white in this position?

How to manage monthly salary

How to change the limits of integration

Inversion Puzzle

Why isn't airport relocation done gradually?

Landlord wants to switch my lease to a "Land contract" to "get back at the city"

What is the steepest angle that a canal can be traversable without locks?

"To split hairs" vs "To be pedantic"

It's possible to achieve negative score?

Extreme, unacceptable situation and I can't attend work tomorrow morning

Is bread bad for ducks?

CiviEvent: Public link for events of a specific type

What tool would a Roman-age civilization have to grind silver and other metals into dust?

Why is my p-value correlated to difference between means in two sample tests?

What is the use of option -o in the useradd command?

If a poisoned arrow's piercing damage is reduced to 0, do you still get poisoned?

Understanding the implication of what "well-defined" means for the operation in quotient group

Why could you hear an Amstrad CPC working?

What does "rabbited" mean/imply in this sentence?

Does light intensity oscillate really fast since it is a wave?

Inline version of a function returns different value than non-inline version

How can I fix this gap between bookcases I made?



Are these both considered Builder pattern? They're extremely different and having different totally different implementations and purposes



The 2019 Stack Overflow Developer Survey Results Are InWhat is the difference between Builder Design pattern and Factory Design pattern?Best method to remove session handled by Session Proxy patternA Bridge Pattern exampleHow to implement the factory method pattern in C++ correctlyEffective Java By Joshua Bloch: Item1 - Static Factory MethodInheriting a class which is built using a static inner class BuilderHow to implement Builder pattern in Kotlin?Singleton Design Pattern - Explicitly stating a Constructor outside the classWhich Design Pattern I need to Use Java Applicationembedded c++ : dynamic typing without dynamic allocation?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I've taken two Design Pattern courses now. 1 had this pattern below (note the lack of an interface).



class Coffee

private String name;
private int acidity;
private int sweetness;
private String roastType;
private int aromatic;
private String quality;
private int priceInDollarsPer100g;



public Coffee(Builder builder)
this.name = builder.name;
this.acidity = builder.acidity;
this.sweetness = builder.sweetness;
this.roastType = builder.roastType;
this.aromatic = builder.aromatic;
this.quality = builder.quality;
this.priceInDollarsPer100g = builder.priceInDollarsPer100g;


public static class Builder

private Builder builder;

private String name;
private int acidity;
private int sweetness;
private String roastType;
private int aromatic;
private String quality;
private int priceInDollarsPer100g;


// Only 1 field is mandatory
public Builder(String name)
this.name = name;


public Builder setAcidity(int acidity)
this.acidity = acidity;

return this;


public Builder setSweetness(int sweetness)
this.sweetness = sweetness;

return this;


public Builder setRoastType(String roastType)
this.roastType = roastType;

return this;


public Builder setAromatic(int aromatic)
this.aromatic = aromatic;

return this;


public Builder setQuality(String quality)
this.quality = quality;

return this;


public Builder setPriceInDollarsPer100g(int priceInDollarsPer100g)
this.priceInDollarsPer100g = priceInDollarsPer100g;

return this;


public Coffee build()

return new Coffee(this);





But in the next course there is no mention of this pattern at all. If I adapt it to the "interface/prescriptive/Static-product way", I get this:



package Builder.BuilderPattern2;


interface CoffeeAttributes

void setName(String name);
void setAcidity(int acidity);
void setSweetness(int sweetness);
void setRoastType(String roastType);
void setAromatic(int aromatic);
void setQuality(String quality);
void setPriceInDollarsPer100g(int priceInDollarsPer100g);


class Coffee implements CoffeeAttributes

private String name;
private int acidity;
private int sweetness;
private String roastType;
private int aromatic;
private String quality;
private int priceInDollarsPer100g;

public void setName(String name)
this.name = name;


public void setAcidity(int acidity)
this.acidity = acidity;


public void setSweetness(int sweetness)
this.sweetness = sweetness;


public void setRoastType(String roastType)
this.roastType = roastType;


public void setAromatic(int aromatic)
this.aromatic = aromatic;


public void setQuality(String quality)
this.quality = quality;


public void setPriceInDollarsPer100g(int priceInDollarsPer100g)
this.priceInDollarsPer100g = priceInDollarsPer100g;




interface CoffeeBuilder

public void buildName();
public void buildAcidity();
public void buildSweetness();
public void buildRoastType();
public void buildAromatic();
public void buildQuality();
public void buildPriceInDollarsPer100g();

public Coffee getCoffee();



class ZestyFrenchRoast implements CoffeeBuilder

private Coffee coffee;


public ZestyFrenchRoast()
this.coffee = new Coffee();



public void buildName()
this.coffee.setName("Zesty French Flave");



public void buildAcidity()
this.coffee.setAcidity(3);



public void buildSweetness()
this.coffee.setSweetness(10);



public void buildRoastType()
this.coffee.setRoastType("French");



public void buildAromatic()
this.coffee.setAromatic(7);



public void buildQuality()
this.coffee.setQuality("Medium");



public void buildPriceInDollarsPer100g()
this.coffee.setPriceInDollarsPer100g(3);



public Coffee getCoffee()
return this.coffee;




class CoffeeMaker

private CoffeeBuilder coffeeBuilder;

public CoffeeMaker(CoffeeBuilder coffeeBuilder)

this.coffeeBuilder = coffeeBuilder;


public Coffee getCoffee()
return this.coffeeBuilder.getCoffee();


public void makeCoffee()

this.coffeeBuilder.buildName();
this.coffeeBuilder.buildAcidity();
this.coffeeBuilder.buildAromatic();
this.coffeeBuilder.buildPriceInDollarsPer100g();
this.coffeeBuilder.buildQuality();
this.coffeeBuilder.buildRoastType();
this.coffeeBuilder.buildSweetness();





public class BuilderPattern2


public static void main(String[] args)

CoffeeBuilder coffeeToBuild = new ZestyFrenchRoast();

CoffeeMaker coffeeMaker = new CoffeeMaker(coffeeToBuild);

coffeeMaker.makeCoffee();

Coffee coffee = coffeeMaker.getCoffee();

System.out.println("The barista hands you a delicious cup of some kind of " +
"coffee but because there are no getters in this pattern we have no idea " +
"what it is. " + "Please pick it up at " + coffee);




RE: https://www.geeksforgeeks.org/builder-design-pattern/



There are no getters in the second version so obviously you wouldn't put text in the object, it would be a more abstract thing. I'm just at a loss to see these two patterns having the same name!










share|improve this question



















  • 1





    It depends what you are building I guess. Also the second half of your question seems missing

    – Matthew Evans
    Mar 8 at 7:49











  • @MatthewEvans Yeah I'm sorry about that. I'm working on that now, accidentally clicked Ask. 5 minutes

    – Chrips
    Mar 8 at 7:51

















0















I've taken two Design Pattern courses now. 1 had this pattern below (note the lack of an interface).



class Coffee

private String name;
private int acidity;
private int sweetness;
private String roastType;
private int aromatic;
private String quality;
private int priceInDollarsPer100g;



public Coffee(Builder builder)
this.name = builder.name;
this.acidity = builder.acidity;
this.sweetness = builder.sweetness;
this.roastType = builder.roastType;
this.aromatic = builder.aromatic;
this.quality = builder.quality;
this.priceInDollarsPer100g = builder.priceInDollarsPer100g;


public static class Builder

private Builder builder;

private String name;
private int acidity;
private int sweetness;
private String roastType;
private int aromatic;
private String quality;
private int priceInDollarsPer100g;


// Only 1 field is mandatory
public Builder(String name)
this.name = name;


public Builder setAcidity(int acidity)
this.acidity = acidity;

return this;


public Builder setSweetness(int sweetness)
this.sweetness = sweetness;

return this;


public Builder setRoastType(String roastType)
this.roastType = roastType;

return this;


public Builder setAromatic(int aromatic)
this.aromatic = aromatic;

return this;


public Builder setQuality(String quality)
this.quality = quality;

return this;


public Builder setPriceInDollarsPer100g(int priceInDollarsPer100g)
this.priceInDollarsPer100g = priceInDollarsPer100g;

return this;


public Coffee build()

return new Coffee(this);





But in the next course there is no mention of this pattern at all. If I adapt it to the "interface/prescriptive/Static-product way", I get this:



package Builder.BuilderPattern2;


interface CoffeeAttributes

void setName(String name);
void setAcidity(int acidity);
void setSweetness(int sweetness);
void setRoastType(String roastType);
void setAromatic(int aromatic);
void setQuality(String quality);
void setPriceInDollarsPer100g(int priceInDollarsPer100g);


class Coffee implements CoffeeAttributes

private String name;
private int acidity;
private int sweetness;
private String roastType;
private int aromatic;
private String quality;
private int priceInDollarsPer100g;

public void setName(String name)
this.name = name;


public void setAcidity(int acidity)
this.acidity = acidity;


public void setSweetness(int sweetness)
this.sweetness = sweetness;


public void setRoastType(String roastType)
this.roastType = roastType;


public void setAromatic(int aromatic)
this.aromatic = aromatic;


public void setQuality(String quality)
this.quality = quality;


public void setPriceInDollarsPer100g(int priceInDollarsPer100g)
this.priceInDollarsPer100g = priceInDollarsPer100g;




interface CoffeeBuilder

public void buildName();
public void buildAcidity();
public void buildSweetness();
public void buildRoastType();
public void buildAromatic();
public void buildQuality();
public void buildPriceInDollarsPer100g();

public Coffee getCoffee();



class ZestyFrenchRoast implements CoffeeBuilder

private Coffee coffee;


public ZestyFrenchRoast()
this.coffee = new Coffee();



public void buildName()
this.coffee.setName("Zesty French Flave");



public void buildAcidity()
this.coffee.setAcidity(3);



public void buildSweetness()
this.coffee.setSweetness(10);



public void buildRoastType()
this.coffee.setRoastType("French");



public void buildAromatic()
this.coffee.setAromatic(7);



public void buildQuality()
this.coffee.setQuality("Medium");



public void buildPriceInDollarsPer100g()
this.coffee.setPriceInDollarsPer100g(3);



public Coffee getCoffee()
return this.coffee;




class CoffeeMaker

private CoffeeBuilder coffeeBuilder;

public CoffeeMaker(CoffeeBuilder coffeeBuilder)

this.coffeeBuilder = coffeeBuilder;


public Coffee getCoffee()
return this.coffeeBuilder.getCoffee();


public void makeCoffee()

this.coffeeBuilder.buildName();
this.coffeeBuilder.buildAcidity();
this.coffeeBuilder.buildAromatic();
this.coffeeBuilder.buildPriceInDollarsPer100g();
this.coffeeBuilder.buildQuality();
this.coffeeBuilder.buildRoastType();
this.coffeeBuilder.buildSweetness();





public class BuilderPattern2


public static void main(String[] args)

CoffeeBuilder coffeeToBuild = new ZestyFrenchRoast();

CoffeeMaker coffeeMaker = new CoffeeMaker(coffeeToBuild);

coffeeMaker.makeCoffee();

Coffee coffee = coffeeMaker.getCoffee();

System.out.println("The barista hands you a delicious cup of some kind of " +
"coffee but because there are no getters in this pattern we have no idea " +
"what it is. " + "Please pick it up at " + coffee);




RE: https://www.geeksforgeeks.org/builder-design-pattern/



There are no getters in the second version so obviously you wouldn't put text in the object, it would be a more abstract thing. I'm just at a loss to see these two patterns having the same name!










share|improve this question



















  • 1





    It depends what you are building I guess. Also the second half of your question seems missing

    – Matthew Evans
    Mar 8 at 7:49











  • @MatthewEvans Yeah I'm sorry about that. I'm working on that now, accidentally clicked Ask. 5 minutes

    – Chrips
    Mar 8 at 7:51













0












0








0








I've taken two Design Pattern courses now. 1 had this pattern below (note the lack of an interface).



class Coffee

private String name;
private int acidity;
private int sweetness;
private String roastType;
private int aromatic;
private String quality;
private int priceInDollarsPer100g;



public Coffee(Builder builder)
this.name = builder.name;
this.acidity = builder.acidity;
this.sweetness = builder.sweetness;
this.roastType = builder.roastType;
this.aromatic = builder.aromatic;
this.quality = builder.quality;
this.priceInDollarsPer100g = builder.priceInDollarsPer100g;


public static class Builder

private Builder builder;

private String name;
private int acidity;
private int sweetness;
private String roastType;
private int aromatic;
private String quality;
private int priceInDollarsPer100g;


// Only 1 field is mandatory
public Builder(String name)
this.name = name;


public Builder setAcidity(int acidity)
this.acidity = acidity;

return this;


public Builder setSweetness(int sweetness)
this.sweetness = sweetness;

return this;


public Builder setRoastType(String roastType)
this.roastType = roastType;

return this;


public Builder setAromatic(int aromatic)
this.aromatic = aromatic;

return this;


public Builder setQuality(String quality)
this.quality = quality;

return this;


public Builder setPriceInDollarsPer100g(int priceInDollarsPer100g)
this.priceInDollarsPer100g = priceInDollarsPer100g;

return this;


public Coffee build()

return new Coffee(this);





But in the next course there is no mention of this pattern at all. If I adapt it to the "interface/prescriptive/Static-product way", I get this:



package Builder.BuilderPattern2;


interface CoffeeAttributes

void setName(String name);
void setAcidity(int acidity);
void setSweetness(int sweetness);
void setRoastType(String roastType);
void setAromatic(int aromatic);
void setQuality(String quality);
void setPriceInDollarsPer100g(int priceInDollarsPer100g);


class Coffee implements CoffeeAttributes

private String name;
private int acidity;
private int sweetness;
private String roastType;
private int aromatic;
private String quality;
private int priceInDollarsPer100g;

public void setName(String name)
this.name = name;


public void setAcidity(int acidity)
this.acidity = acidity;


public void setSweetness(int sweetness)
this.sweetness = sweetness;


public void setRoastType(String roastType)
this.roastType = roastType;


public void setAromatic(int aromatic)
this.aromatic = aromatic;


public void setQuality(String quality)
this.quality = quality;


public void setPriceInDollarsPer100g(int priceInDollarsPer100g)
this.priceInDollarsPer100g = priceInDollarsPer100g;




interface CoffeeBuilder

public void buildName();
public void buildAcidity();
public void buildSweetness();
public void buildRoastType();
public void buildAromatic();
public void buildQuality();
public void buildPriceInDollarsPer100g();

public Coffee getCoffee();



class ZestyFrenchRoast implements CoffeeBuilder

private Coffee coffee;


public ZestyFrenchRoast()
this.coffee = new Coffee();



public void buildName()
this.coffee.setName("Zesty French Flave");



public void buildAcidity()
this.coffee.setAcidity(3);



public void buildSweetness()
this.coffee.setSweetness(10);



public void buildRoastType()
this.coffee.setRoastType("French");



public void buildAromatic()
this.coffee.setAromatic(7);



public void buildQuality()
this.coffee.setQuality("Medium");



public void buildPriceInDollarsPer100g()
this.coffee.setPriceInDollarsPer100g(3);



public Coffee getCoffee()
return this.coffee;




class CoffeeMaker

private CoffeeBuilder coffeeBuilder;

public CoffeeMaker(CoffeeBuilder coffeeBuilder)

this.coffeeBuilder = coffeeBuilder;


public Coffee getCoffee()
return this.coffeeBuilder.getCoffee();


public void makeCoffee()

this.coffeeBuilder.buildName();
this.coffeeBuilder.buildAcidity();
this.coffeeBuilder.buildAromatic();
this.coffeeBuilder.buildPriceInDollarsPer100g();
this.coffeeBuilder.buildQuality();
this.coffeeBuilder.buildRoastType();
this.coffeeBuilder.buildSweetness();





public class BuilderPattern2


public static void main(String[] args)

CoffeeBuilder coffeeToBuild = new ZestyFrenchRoast();

CoffeeMaker coffeeMaker = new CoffeeMaker(coffeeToBuild);

coffeeMaker.makeCoffee();

Coffee coffee = coffeeMaker.getCoffee();

System.out.println("The barista hands you a delicious cup of some kind of " +
"coffee but because there are no getters in this pattern we have no idea " +
"what it is. " + "Please pick it up at " + coffee);




RE: https://www.geeksforgeeks.org/builder-design-pattern/



There are no getters in the second version so obviously you wouldn't put text in the object, it would be a more abstract thing. I'm just at a loss to see these two patterns having the same name!










share|improve this question
















I've taken two Design Pattern courses now. 1 had this pattern below (note the lack of an interface).



class Coffee

private String name;
private int acidity;
private int sweetness;
private String roastType;
private int aromatic;
private String quality;
private int priceInDollarsPer100g;



public Coffee(Builder builder)
this.name = builder.name;
this.acidity = builder.acidity;
this.sweetness = builder.sweetness;
this.roastType = builder.roastType;
this.aromatic = builder.aromatic;
this.quality = builder.quality;
this.priceInDollarsPer100g = builder.priceInDollarsPer100g;


public static class Builder

private Builder builder;

private String name;
private int acidity;
private int sweetness;
private String roastType;
private int aromatic;
private String quality;
private int priceInDollarsPer100g;


// Only 1 field is mandatory
public Builder(String name)
this.name = name;


public Builder setAcidity(int acidity)
this.acidity = acidity;

return this;


public Builder setSweetness(int sweetness)
this.sweetness = sweetness;

return this;


public Builder setRoastType(String roastType)
this.roastType = roastType;

return this;


public Builder setAromatic(int aromatic)
this.aromatic = aromatic;

return this;


public Builder setQuality(String quality)
this.quality = quality;

return this;


public Builder setPriceInDollarsPer100g(int priceInDollarsPer100g)
this.priceInDollarsPer100g = priceInDollarsPer100g;

return this;


public Coffee build()

return new Coffee(this);





But in the next course there is no mention of this pattern at all. If I adapt it to the "interface/prescriptive/Static-product way", I get this:



package Builder.BuilderPattern2;


interface CoffeeAttributes

void setName(String name);
void setAcidity(int acidity);
void setSweetness(int sweetness);
void setRoastType(String roastType);
void setAromatic(int aromatic);
void setQuality(String quality);
void setPriceInDollarsPer100g(int priceInDollarsPer100g);


class Coffee implements CoffeeAttributes

private String name;
private int acidity;
private int sweetness;
private String roastType;
private int aromatic;
private String quality;
private int priceInDollarsPer100g;

public void setName(String name)
this.name = name;


public void setAcidity(int acidity)
this.acidity = acidity;


public void setSweetness(int sweetness)
this.sweetness = sweetness;


public void setRoastType(String roastType)
this.roastType = roastType;


public void setAromatic(int aromatic)
this.aromatic = aromatic;


public void setQuality(String quality)
this.quality = quality;


public void setPriceInDollarsPer100g(int priceInDollarsPer100g)
this.priceInDollarsPer100g = priceInDollarsPer100g;




interface CoffeeBuilder

public void buildName();
public void buildAcidity();
public void buildSweetness();
public void buildRoastType();
public void buildAromatic();
public void buildQuality();
public void buildPriceInDollarsPer100g();

public Coffee getCoffee();



class ZestyFrenchRoast implements CoffeeBuilder

private Coffee coffee;


public ZestyFrenchRoast()
this.coffee = new Coffee();



public void buildName()
this.coffee.setName("Zesty French Flave");



public void buildAcidity()
this.coffee.setAcidity(3);



public void buildSweetness()
this.coffee.setSweetness(10);



public void buildRoastType()
this.coffee.setRoastType("French");



public void buildAromatic()
this.coffee.setAromatic(7);



public void buildQuality()
this.coffee.setQuality("Medium");



public void buildPriceInDollarsPer100g()
this.coffee.setPriceInDollarsPer100g(3);



public Coffee getCoffee()
return this.coffee;




class CoffeeMaker

private CoffeeBuilder coffeeBuilder;

public CoffeeMaker(CoffeeBuilder coffeeBuilder)

this.coffeeBuilder = coffeeBuilder;


public Coffee getCoffee()
return this.coffeeBuilder.getCoffee();


public void makeCoffee()

this.coffeeBuilder.buildName();
this.coffeeBuilder.buildAcidity();
this.coffeeBuilder.buildAromatic();
this.coffeeBuilder.buildPriceInDollarsPer100g();
this.coffeeBuilder.buildQuality();
this.coffeeBuilder.buildRoastType();
this.coffeeBuilder.buildSweetness();





public class BuilderPattern2


public static void main(String[] args)

CoffeeBuilder coffeeToBuild = new ZestyFrenchRoast();

CoffeeMaker coffeeMaker = new CoffeeMaker(coffeeToBuild);

coffeeMaker.makeCoffee();

Coffee coffee = coffeeMaker.getCoffee();

System.out.println("The barista hands you a delicious cup of some kind of " +
"coffee but because there are no getters in this pattern we have no idea " +
"what it is. " + "Please pick it up at " + coffee);




RE: https://www.geeksforgeeks.org/builder-design-pattern/



There are no getters in the second version so obviously you wouldn't put text in the object, it would be a more abstract thing. I'm just at a loss to see these two patterns having the same name!







design-patterns






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 8:36







Chrips

















asked Mar 8 at 7:46









ChripsChrips

1,39541525




1,39541525







  • 1





    It depends what you are building I guess. Also the second half of your question seems missing

    – Matthew Evans
    Mar 8 at 7:49











  • @MatthewEvans Yeah I'm sorry about that. I'm working on that now, accidentally clicked Ask. 5 minutes

    – Chrips
    Mar 8 at 7:51












  • 1





    It depends what you are building I guess. Also the second half of your question seems missing

    – Matthew Evans
    Mar 8 at 7:49











  • @MatthewEvans Yeah I'm sorry about that. I'm working on that now, accidentally clicked Ask. 5 minutes

    – Chrips
    Mar 8 at 7:51







1




1





It depends what you are building I guess. Also the second half of your question seems missing

– Matthew Evans
Mar 8 at 7:49





It depends what you are building I guess. Also the second half of your question seems missing

– Matthew Evans
Mar 8 at 7:49













@MatthewEvans Yeah I'm sorry about that. I'm working on that now, accidentally clicked Ask. 5 minutes

– Chrips
Mar 8 at 7:51





@MatthewEvans Yeah I'm sorry about that. I'm working on that now, accidentally clicked Ask. 5 minutes

– Chrips
Mar 8 at 7:51












1 Answer
1






active

oldest

votes


















0














The first example shows the essential Builder Pattern. It can be used to avoid creating multiple constructors. If you sometimes need to add Name and Student ID, or other times you need to add Name, Address and Phone number, a single object Builder is very useful for that.



The second example is a Factory Builder!
It can be used to define priveleges for different kinds of users. These priveleges don't often change but vary among the types of users you have. That's where factory comes in.
Basically it's used to create a PRODUCT and that product does not often change.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058809%2fare-these-both-considered-builder-pattern-theyre-extremely-different-and-havin%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The first example shows the essential Builder Pattern. It can be used to avoid creating multiple constructors. If you sometimes need to add Name and Student ID, or other times you need to add Name, Address and Phone number, a single object Builder is very useful for that.



    The second example is a Factory Builder!
    It can be used to define priveleges for different kinds of users. These priveleges don't often change but vary among the types of users you have. That's where factory comes in.
    Basically it's used to create a PRODUCT and that product does not often change.






    share|improve this answer





























      0














      The first example shows the essential Builder Pattern. It can be used to avoid creating multiple constructors. If you sometimes need to add Name and Student ID, or other times you need to add Name, Address and Phone number, a single object Builder is very useful for that.



      The second example is a Factory Builder!
      It can be used to define priveleges for different kinds of users. These priveleges don't often change but vary among the types of users you have. That's where factory comes in.
      Basically it's used to create a PRODUCT and that product does not often change.






      share|improve this answer



























        0












        0








        0







        The first example shows the essential Builder Pattern. It can be used to avoid creating multiple constructors. If you sometimes need to add Name and Student ID, or other times you need to add Name, Address and Phone number, a single object Builder is very useful for that.



        The second example is a Factory Builder!
        It can be used to define priveleges for different kinds of users. These priveleges don't often change but vary among the types of users you have. That's where factory comes in.
        Basically it's used to create a PRODUCT and that product does not often change.






        share|improve this answer















        The first example shows the essential Builder Pattern. It can be used to avoid creating multiple constructors. If you sometimes need to add Name and Student ID, or other times you need to add Name, Address and Phone number, a single object Builder is very useful for that.



        The second example is a Factory Builder!
        It can be used to define priveleges for different kinds of users. These priveleges don't often change but vary among the types of users you have. That's where factory comes in.
        Basically it's used to create a PRODUCT and that product does not often change.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 8 at 8:53

























        answered Mar 8 at 8:46









        ChripsChrips

        1,39541525




        1,39541525





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058809%2fare-these-both-considered-builder-pattern-theyre-extremely-different-and-havin%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved