<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Refactoring Day 23 : Introduce Parameter Object</title>
	<atom:link href="http://lostechies.com/seanchambers/2009/08/23/refactoring-day-23-introduce-parameter-object/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/seanchambers/2009/08/23/refactoring-day-23-introduce-parameter-object/</link>
	<description>Just another LosTechies site</description>
	<lastBuildDate>Thu, 13 Sep 2012 07:11:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: ryzam</title>
		<link>http://lostechies.com/seanchambers/2009/08/23/refactoring-day-23-introduce-parameter-object/#comment-421</link>
		<dc:creator>ryzam</dc:creator>
		<pubDate>Mon, 24 Aug 2009 04:17:33 +0000</pubDate>
		<guid isPermaLink="false">/blogs/sean_chambers/archive/2009/08/23/refactoring-day-23-introduce-parameter-object.aspx#comment-421</guid>
		<description>I think its time to thing parameter object as a message.Using message it would give you Ubiquitous Language which minimize the gap between domain expert and developer</description>
		<content:encoded><![CDATA[<p>I think its time to thing parameter object as a message.Using message it would give you Ubiquitous Language which minimize the gap between domain expert and developer</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: schambers</title>
		<link>http://lostechies.com/seanchambers/2009/08/23/refactoring-day-23-introduce-parameter-object/#comment-420</link>
		<dc:creator>schambers</dc:creator>
		<pubDate>Sun, 23 Aug 2009 12:10:38 +0000</pubDate>
		<guid isPermaLink="false">/blogs/sean_chambers/archive/2009/08/23/refactoring-day-23-introduce-parameter-object.aspx#comment-420</guid>
		<description>Excellent point Michel. This leads into Day 25 where I talk about Design By Contract checks that would be an excellent example of input validation in a scenario like this.</description>
		<content:encoded><![CDATA[<p>Excellent point Michel. This leads into Day 25 where I talk about Design By Contract checks that would be an excellent example of input validation in a scenario like this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Kj&#246;rling</title>
		<link>http://lostechies.com/seanchambers/2009/08/23/refactoring-day-23-introduce-parameter-object/#comment-419</link>
		<dc:creator>Michael Kj&#246;rling</dc:creator>
		<pubDate>Sun, 23 Aug 2009 11:58:16 +0000</pubDate>
		<guid isPermaLink="false">/blogs/sean_chambers/archive/2009/08/23/refactoring-day-23-introduce-parameter-object.aspx#comment-419</guid>
		<description>You also need to be very careful with input validation since (especially when adding fields to the parameter object class that is already used in multiple places throughout your codebase) it is very easy to forget one field/parameter out of the bunch. Much more so than if you need to go through the parameter list when calling the method; in that case, if you miss a spot, the compiler will alert you. In some cases it might even be worth creating a method on the RegistrationContext class such as Create() that takes a Registration object and calls Create() on that after verifying that all fields are properly filled in. This is a slight deviation from the separation of responsibility principle but since the RegistrationContext class cannot exist on its own anyway, it seems like it could be an acceptable trade-off. Something like this:

public class RegistrationContext
{
    // ... parameter fields go here ...

    public void Create(Registration registration)
    {
        // ... validate all context class fields and fail if appropriate ...

        registration.Create(this);
    }
}</description>
		<content:encoded><![CDATA[<p>You also need to be very careful with input validation since (especially when adding fields to the parameter object class that is already used in multiple places throughout your codebase) it is very easy to forget one field/parameter out of the bunch. Much more so than if you need to go through the parameter list when calling the method; in that case, if you miss a spot, the compiler will alert you. In some cases it might even be worth creating a method on the RegistrationContext class such as Create() that takes a Registration object and calls Create() on that after verifying that all fields are properly filled in. This is a slight deviation from the separation of responsibility principle but since the RegistrationContext class cannot exist on its own anyway, it seems like it could be an acceptable trade-off. Something like this:</p>
<p>public class RegistrationContext<br />
{<br />
    // &#8230; parameter fields go here &#8230;</p>
<p>    public void Create(Registration registration)<br />
    {<br />
        // &#8230; validate all context class fields and fail if appropriate &#8230;</p>
<p>        registration.Create(this);<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
