Tim Driven Development | Test until the fear goes away
Tim Driven Development | Test until the fear goes away
Campbell Ritchie wrote:Not sure how you would take defensive copies of constructor parameters
Tim Driven Development | Test until the fear goes away
Tim Driven Development | Test until the fear goes away
Tim Cooke wrote:
I started out with a couple of String values being passed around that represented the name and type of a communication transport, it looked a bit like this:
Can you smell something? That's right, I smell a Data Clump, which is where two or more data items are passed around together because they belong together. The resolution to this smell is to turn those data items into an object. Which is what I did:
I've now grouped the transport name and type together in an object which is an improvement.
Mike Simmons wrote:The Duple appears to be a parameterized class, so for a Duple<A,B> ......
Chan Ag wrote:I would have have also extended the idea to also use a builder to achieve immutability.
Tim Driven Development | Test until the fear goes away
Tim Cooke wrote:
I'm a big fan of the builder pattern for object construction but I think it only starts looking attractive when you have a large number of constructor parameters. Here I only have 2 params so the static factory method wins for me.
Honk if you love justice! And honk twice for tiny ads!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
|