All Questions
Tagged with builder-pattern object-oriented-design
5 questions
2
votes
1
answer
136
views
For N and NBuilder, should N be an instance variable of NBuilder, or all parameters of N be instance variables of NBuilder,finally new N() in build()?
As far as I know about builder pattern, for example, an object, Student:
public class Student{
private String name;
private int age;
//setter and getter
}
to apply builder pattern to ...
4
votes
2
answers
874
views
Is it a code smell to have two different implementations of the builder design pattern, for the same model?
Shoutout to David Arno for teaching me about the builder design pattern via this thread!
I have since used that pattern althroughout the code base to abstract out creating models from data stores, ...
5
votes
2
answers
431
views
GoF Builder Pattern Applicability
The book Design Patterns: Elements of Reusable Object-Oriented Software says to use the builder pattern when
The algorithm for creating a complex object should be independent of the
parts that make ...
1
vote
2
answers
1k
views
Is it wrong to extend an inner static class in java? (Builder pattern)
I'm working on a java project for the university. The project is a card game in which you travel around a 2D map and fight against some enemies. My part consists of creating the deck and the cards.
I ...
3
votes
3
answers
3k
views
Design pattern to force client of a class to call a method
I have a large class with complex properties. I'd like to introduce a default implementation, allow the user to override part of the default implementation and also make sure the user calls a sync ...