Better yet, in this particular case, don't use the builder pattern, and instead just provide a sensible set of constructors with appropriate defaults for unspecified arguments (e.g., 00:00 for unspecified time).
For a simple date/time class, the builder pattern reeks of pointless overengineering.
Comments
Better yet, in this particular case, don't use the builder pattern, and instead just provide a sensible set of constructors with appropriate defaults for unspecified arguments (e.g., 00:00 for unspecified time).
For a simple date/time class, the builder pattern reeks of pointless overengineering.
Oh certainly, didn't mean to imply it's great for a freaking date.
But I've seen the mutating pattern in other cases causing the weird state bug which could have avoided using a builder.