News for hackers. Stuff that matters.
Re:New Features in Java 14 by jfengel on Wednesday March 04, 2020 @12:01PM (#22485448)
I find Builders most useful when you've got a lot of optional arguments. For mandatory arguments (and most arguments should be mandatory), you should definitely use constructors instead, so that your tool kit can tell you when they change.

Optional arguments with reasonable defaults don't present a problem for refactoring. It does make it hard to spot the cases where the reasonable defaults don't work. One trick is to temporarily add it to the constructor, review all the errors, and then remove the constructor arg.

There are no comments on this comment yet.