This entry was posted
on Friday, October 9th, 2009 at 7:02 am and is filed under software development.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
So, I took your challenge. I tried writing this Eastwards and Westwards.
The eastward version was slightly more lines of code. I found it harder to read. And I noticed no difference when I changed the representation of the gender. I sense that I missed something. Can you upload the full code you used for this? I did it in Visual Studio 2008 in C# and my project code is located at http://cid-1694a89505687617.skydrive.live.com/self.aspx/Public/EastwardTest.zip
Perhaps my “westward code” is already too eastward to provide any contrast.
Oh, and I find nested parens to be harder to read than intermediate variables. But I can easily extract variables from them, so I don’t get hung up on that.
Thank you for taking the time to write the code and post it.
I noticed in the Westward code that you are already Eastward, in that you don’t return a date of birth nor the gender. This is great. The benefit of the Eastward approach would already be known to you. However, if you want to see more contrast, then expose the date and gender and see the resulting code.
I also noticed the the GiftSender was also East, a nice touch.
I should have also mentioned that you could have mocked the GiftSender rather than making a proper class for it, then testing the interaction only, which depending on mocking framework would be less code.
October 11th, 2009 at 2:44 pm
So, I took your challenge. I tried writing this Eastwards and Westwards.
The eastward version was slightly more lines of code. I found it harder to read. And I noticed no difference when I changed the representation of the gender. I sense that I missed something. Can you upload the full code you used for this? I did it in Visual Studio 2008 in C# and my project code is located at http://cid-1694a89505687617.skydrive.live.com/self.aspx/Public/EastwardTest.zip
Perhaps my “westward code” is already too eastward to provide any contrast.
Oh, and I find nested parens to be harder to read than intermediate variables. But I can easily extract variables from them, so I don’t get hung up on that.
October 12th, 2009 at 7:11 am
dkallen,
Thank you for taking the time to write the code and post it.
I noticed in the Westward code that you are already Eastward, in that you don’t return a date of birth nor the gender. This is great. The benefit of the Eastward approach would already be known to you. However, if you want to see more contrast, then expose the date and gender and see the resulting code.
I also noticed the the GiftSender was also East, a nice touch.
October 12th, 2009 at 6:41 pm
I should have also mentioned that you could have mocked the GiftSender rather than making a proper class for it, then testing the interaction only, which depending on mocking framework would be less code.