Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Timber Lee: Builder Answer  RSS feed

Sanjay Raghavan
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You had sent me a mail with a question on the builder pattern. Because of your privacy settings at the ranch, I am unable to respond to you privately. Further I also figured that this way, others will have an opportunity to participate as well.
The question was to do with an example for the Builder pattern. Builder is a creational GoF pattern. A while back I had posted a detailed description with fast-foods as an example. Please try to read through that. It will give you a clear example of the Builder pattern.
Here's another example. Let us assume that a diagram has to have two objects and some relationship between them.
Given this construct, you can create:
1. Class, Class, Association
2. Interface, Class, Implementation
3. Class, Class, Inheritance and so on.
The idea is that you can only have 2 objects and 1 relationship, but the objects and the relationship can be constructed dynamically Ala Carte.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!