Tuesday, July 16, 2019

Effective Java Study Note - Consider a builder when faced with many constructor parameters

Builder helps increasing the readability of constructing a new object. Use a builder when the number of parameters of a constructor is more than 4, if it's less than 4, it may not worthy to use builder because it takes extra memory space and time to construct an object.

No comments:

Post a Comment