Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
The Builder pattern is actively negative here. It introduces at least one runtime failure mode (not setting the underlying file) that is a compile time error with a constructor. The constructors are simpler, more obvious, and less error prone.
The builder pattern is *not* preferred to constructors in all cases. It is a non-standard idiom outside the Java language that is appropriate when:
1. There are a large number of arguments.
2. At least two of the arguments have the same type so there is a real risk of swapping them.
3. Any combination of arguments is allowed.
All three of those conditions are false in this case.