• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Builder Pattern

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to Solve a particular Problem using Builder Pattern

1. Class A has 10 instance variables out of which 3 variables are compulsory for initialization rest can be also used if you want to crate an object
2. Instead of 8 different constructors having 3,4,5,6,7,8,910 arguments ,Provide a neat and clean solution to implement it using builder pattern.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankur Mehrotra wrote:How to Solve a particular Problem using Builder Pattern


Look it up (Here might be a good place to start for practical advice).

Otherwise, I don't see a question we can answer Ankur. And this site is NotACodeMill (←click).

On the other hand, we're more than happy to help if you ShowSomeEffort.

Winston
 
Ankur Mehrotra
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a solution to the problem is in Class A, has a single constructor having the three compulsory variables . the rest we create 7 setters for the variables so any object can be created first with compulsory three variables and then the other variables can be set through setter....but I think this is not a Builder Pattern...I have studied builder pattern, but I am unable to figure it out how to solve this particular problem through Builder Pattern
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankur Mehrotra wrote:...I have studied builder pattern, but I am unable to figure it out how to solve this particular problem through Builder Pattern


Have a look at my post again (I've edited it with a link).

Otherwise, you need to explain to us what you understand by the Builder pattern, and why you can't translate it into Java (because that's all you're doing - translation).

Winston
 
Ankur Mehrotra
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry Guys ...will keep in mind before posting any questions. & Thanks for helping me.
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankur Mehrotra wrote:Sorry Guys ...will keep in mind before posting any questions. & Thanks for helping me.


No probs. Just remember, we're all volunteers here, so the more you can help us to answer your question, the more help you're likely to get.

And if it hasn't already been said: Welcome to the Ranch.

Winston
 
Ankur Mehrotra
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Will Remember...Thanks for your advise & Guidance
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic