Reputation: 647
I was just curious if there was any time you would not use a 'Builder Design Pattern' to create objects.
Upvotes: 0
Views: 1752
Reputation: 5950
I suggest you do not use builders when all your object's fields are required upon construction. In that case using a simple constructor might be enough, unless you see some other applicable creational patterns, such as factory or singleton.
Builders can also affect the size of your distribution. You may opt to not use the pattern when you don't want a bulk of classes, especially if you are distributing a library.
Object creation using builder patterns may also be replaced by using other languages or lambda (a feature in Java 8). In case, you prefer using those, then it would be alright for you to not use builders.
Upvotes: 1
Reputation: 634
The builder design pattern is used to create a complex object from simple ones step by step. If this is not your case, you should not use builder design pattern
Upvotes: 2