Effective Java

Effective Java #2: Class Builders

I’ve added a new page in the Joshua Block Tribute section of my blog:

Class Builders

Bob-the-Builder-tv-01

“Can we build it. Yes we can!” (image source: starpulse.com)

Class builders help you replace complex and unreadable constructor parameter lists with something more intuitive.  While it may add slightly to the runtime of your application due to more function calls, the tradeoff in readability and maintainability is often worth it.

You could even make the argument that replacing a gazillion constructor parameters for some optionally-used builder function calls improves performance.

Or … perhaps builders just help you not pull your hair out when reading code. I’ll let you decide.

Advertisements

And now it's your turn ... comment here or on Twitter (@Androider)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s