<?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: Strengthening your domain: Avoiding setters</title>
	<atom:link href="http://lostechies.com/jimmybogard/2010/03/31/strengthening-your-domain-avoiding-setters/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/jimmybogard/2010/03/31/strengthening-your-domain-avoiding-setters/</link>
	<description>Strong opinions, weakly held</description>
	<lastBuildDate>Wed, 19 Jun 2013 17:39: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: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/03/31/strengthening-your-domain-avoiding-setters/#comment-2301</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Wed, 07 Apr 2010 15:26:06 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/31/strengthening-your-domain-avoiding-setters.aspx#comment-2301</guid>
		<description>@Jan

Yeah, it&#039;s definitely a trade-off.  Walking through commands in the test does tend to reinforce the Ub. Language tho.  One approach to take is a fluent fixture:

http://blog.eleutian.com/2007/09/29/FluentFixtures.aspx</description>
		<content:encoded><![CDATA[<p>@Jan</p>
<p>Yeah, it&#8217;s definitely a trade-off.  Walking through commands in the test does tend to reinforce the Ub. Language tho.  One approach to take is a fluent fixture:</p>
<p><a href="http://blog.eleutian.com/2007/09/29/FluentFixtures.aspx" rel="nofollow">http://blog.eleutian.com/2007/09/29/FluentFixtures.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Ove Olsen</title>
		<link>http://lostechies.com/jimmybogard/2010/03/31/strengthening-your-domain-avoiding-setters/#comment-2300</link>
		<dc:creator>Jan Ove Olsen</dc:creator>
		<pubDate>Wed, 07 Apr 2010 15:06:03 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/31/strengthening-your-domain-avoiding-setters.aspx#comment-2300</guid>
		<description>About the testing part of this.. You&#039;re basically saying that you shouldn&#039;t need public property setters to setup for unit testing because any unit tests for the entity should only have to test scenarios that you can build with the commands of the entity? 

That makes sense, but also leads to more complex setup for scenarios where the required state of the entity you want to test is the result of several commands performed on the entity.

I still expose setters for this very reason, but I feel dirty everytime I do it.. :)
</description>
		<content:encoded><![CDATA[<p>About the testing part of this.. You&#8217;re basically saying that you shouldn&#8217;t need public property setters to setup for unit testing because any unit tests for the entity should only have to test scenarios that you can build with the commands of the entity? </p>
<p>That makes sense, but also leads to more complex setup for scenarios where the required state of the entity you want to test is the result of several commands performed on the entity.</p>
<p>I still expose setters for this very reason, but I feel dirty everytime I do it.. <img src='http://lostechies.com/jimmybogard/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/03/31/strengthening-your-domain-avoiding-setters/#comment-2299</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Wed, 07 Apr 2010 12:32:10 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/31/strengthening-your-domain-avoiding-setters.aspx#comment-2299</guid>
		<description>@Clement

1) NHibernate deals with encapsulated collections and private setters very, very easily.  Private setters don&#039;t need any extra configuration. Encapsulated collections can be taken care of with Fluent NHibernate conventions.  There really aren&#039;t any hurdles there.

I haven&#039;t done any event sourcing, but it definitely looks intriguing.  I have a very difficult time projecting what that architecture would look like on the systems I develop.

2) How do I break encapsulation with persistence?  No one outside my bounded context will have access to my persistence storage mechanism (DB or otherwise).

3) Probably not, LoD doesn&#039;t really play a large part in my own domain modeling style.

And yeah, I can tag the posts :)</description>
		<content:encoded><![CDATA[<p>@Clement</p>
<p>1) NHibernate deals with encapsulated collections and private setters very, very easily.  Private setters don&#8217;t need any extra configuration. Encapsulated collections can be taken care of with Fluent NHibernate conventions.  There really aren&#8217;t any hurdles there.</p>
<p>I haven&#8217;t done any event sourcing, but it definitely looks intriguing.  I have a very difficult time projecting what that architecture would look like on the systems I develop.</p>
<p>2) How do I break encapsulation with persistence?  No one outside my bounded context will have access to my persistence storage mechanism (DB or otherwise).</p>
<p>3) Probably not, LoD doesn&#8217;t really play a large part in my own domain modeling style.</p>
<p>And yeah, I can tag the posts <img src='http://lostechies.com/jimmybogard/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cl&#233;ment Bouillier</title>
		<link>http://lostechies.com/jimmybogard/2010/03/31/strengthening-your-domain-avoiding-setters/#comment-2298</link>
		<dc:creator>Cl&#233;ment Bouillier</dc:creator>
		<pubDate>Wed, 07 Apr 2010 10:28:55 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/31/strengthening-your-domain-avoiding-setters.aspx#comment-2298</guid>
		<description>Thanks a lot for this series, I try to apply most of your suggestions. In fact, i would like to write on same subjects, you were faster ;)...

Nevertheless, I have some questions. 
1) the first is about persistence. I see two options for now :
    - classic ORM : setters are very useful for rehydration, even setters on collections...or you have to rely on introspection (like NHibernate do with private access).
    - event sourcing that prone Greg Young with CQRS...but I haven&#039;t dig enough to detail...
What is your position ?
2) The second is about an argument I often heard from pro anemic DM people : you say you encapsulate but you broke encapsulation with your persistence...I haven&#039;t found a better answer than &quot;I prefer business encapsulation than no encapsulation...and persistence is pure technical consideration, that&#039;s why I allow breaking encapsulation...&quot;
3) do you plan to talk about law of demeter ?

As an aside remark, could you tag all your series items with a special series tag, it would allow to make a link to the whole series (from delicious or blog for example...) ?

Thanks again.</description>
		<content:encoded><![CDATA[<p>Thanks a lot for this series, I try to apply most of your suggestions. In fact, i would like to write on same subjects, you were faster <img src='http://lostechies.com/jimmybogard/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> &#8230;</p>
<p>Nevertheless, I have some questions.<br />
1) the first is about persistence. I see two options for now :<br />
    &#8211; classic ORM : setters are very useful for rehydration, even setters on collections&#8230;or you have to rely on introspection (like NHibernate do with private access).<br />
    &#8211; event sourcing that prone Greg Young with CQRS&#8230;but I haven&#8217;t dig enough to detail&#8230;<br />
What is your position ?<br />
2) The second is about an argument I often heard from pro anemic DM people : you say you encapsulate but you broke encapsulation with your persistence&#8230;I haven&#8217;t found a better answer than &#8220;I prefer business encapsulation than no encapsulation&#8230;and persistence is pure technical consideration, that&#8217;s why I allow breaking encapsulation&#8230;&#8221;<br />
3) do you plan to talk about law of demeter ?</p>
<p>As an aside remark, could you tag all your series items with a special series tag, it would allow to make a link to the whole series (from delicious or blog for example&#8230;) ?</p>
<p>Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/03/31/strengthening-your-domain-avoiding-setters/#comment-2297</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Fri, 02 Apr 2010 12:32:39 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/31/strengthening-your-domain-avoiding-setters.aspx#comment-2297</guid>
		<description>@Frank

It depends.  If it&#039;s a data-specific command, I tend to just leave the setters there.  If it&#039;s a behavioral command, I go the method route (although I still don&#039;t have the object accept a command message, but go with explicit args).

I haven&#039;t tried going command-only, so I&#039;m not sure how that would work out in the long run.</description>
		<content:encoded><![CDATA[<p>@Frank</p>
<p>It depends.  If it&#8217;s a data-specific command, I tend to just leave the setters there.  If it&#8217;s a behavioral command, I go the method route (although I still don&#8217;t have the object accept a command message, but go with explicit args).</p>
<p>I haven&#8217;t tried going command-only, so I&#8217;m not sure how that would work out in the long run.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank Quednau</title>
		<link>http://lostechies.com/jimmybogard/2010/03/31/strengthening-your-domain-avoiding-setters/#comment-2296</link>
		<dc:creator>Frank Quednau</dc:creator>
		<pubDate>Fri, 02 Apr 2010 12:22:25 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/31/strengthening-your-domain-avoiding-setters.aspx#comment-2296</guid>
		<description>@bogardj
Yes, I can see making commands from the stuff entered in the UI, but will you allow commands to change stuff on a domain object (via e.g. setters), or will you make domain objects accept commands and extract vital information form them to change values (thereby avoiding setters)?</description>
		<content:encoded><![CDATA[<p>@bogardj<br />
Yes, I can see making commands from the stuff entered in the UI, but will you allow commands to change stuff on a domain object (via e.g. setters), or will you make domain objects accept commands and extract vital information form them to change values (thereby avoiding setters)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AJZ</title>
		<link>http://lostechies.com/jimmybogard/2010/03/31/strengthening-your-domain-avoiding-setters/#comment-2295</link>
		<dc:creator>AJZ</dc:creator>
		<pubDate>Thu, 01 Apr 2010 17:43:30 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/31/strengthening-your-domain-avoiding-setters.aspx#comment-2295</guid>
		<description>Thanks for your response.  That definitely makes sense to me.

In the type of CQRS which Greg Young is promoting the transactional database only stores a running compilation of the actual commands.  I wonder for the &quot;InvoiceRequest&quot; objects how this would be handled.  Maybe they would be stored in a CRUD manner in a &quot;domain object staging&quot; data store and then transition to the transactional data store once complete.  I guess it depends upon whether or not it is important to preserve the history of the &quot;XxxRequest&quot; objects.</description>
		<content:encoded><![CDATA[<p>Thanks for your response.  That definitely makes sense to me.</p>
<p>In the type of CQRS which Greg Young is promoting the transactional database only stores a running compilation of the actual commands.  I wonder for the &#8220;InvoiceRequest&#8221; objects how this would be handled.  Maybe they would be stored in a CRUD manner in a &#8220;domain object staging&#8221; data store and then transition to the transactional data store once complete.  I guess it depends upon whether or not it is important to preserve the history of the &#8220;XxxRequest&#8221; objects.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/03/31/strengthening-your-domain-avoiding-setters/#comment-2294</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Thu, 01 Apr 2010 16:32:17 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/31/strengthening-your-domain-avoiding-setters.aspx#comment-2294</guid>
		<description>@AJZ

I&#039;ve had situations like these, where in your example the user actually creates an &quot;InvoiceRequest&quot;.  Eventually they can create a regular invoice from the invoice request, and it goes on from there.  This helps especially if partial invoices aren&#039;t invoices at all, and shouldn&#039;t be treated as such.</description>
		<content:encoded><![CDATA[<p>@AJZ</p>
<p>I&#8217;ve had situations like these, where in your example the user actually creates an &#8220;InvoiceRequest&#8221;.  Eventually they can create a regular invoice from the invoice request, and it goes on from there.  This helps especially if partial invoices aren&#8217;t invoices at all, and shouldn&#8217;t be treated as such.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AJZ</title>
		<link>http://lostechies.com/jimmybogard/2010/03/31/strengthening-your-domain-avoiding-setters/#comment-2293</link>
		<dc:creator>AJZ</dc:creator>
		<pubDate>Thu, 01 Apr 2010 16:14:07 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/31/strengthening-your-domain-avoiding-setters.aspx#comment-2293</guid>
		<description>I have been reading about this type of approach and CQRS and I see that these are definitely good ideas.  The question that I&#039;ve been having is with initial object creation.

For example, in an Accounts Payable application a user will need to enter an invoice.  This involves filling out a whole bunch of fields, saving the invoice, and possibly editing some of these fields and saving again before some state change occurs which says that the invoice is now &quot;processed&quot; or &quot;verified&quot; or something like that.

Once the invoice has made it to this new state it becomes more behavioral.  The user can void it and perform a handful of other operations on it.  At this point the approach you&#039;re recommending becomes applicable.

What am I missing?  In my example would there be two domain objects: &quot;invoice under construction&quot; which is basically a CRUD getter/setter object and then it would become a &quot;completed invoice&quot; which would primarily have behavioral methods?

I&#039;m sure that there is a solution for this, but in all the CQRS and other documents I&#039;ve read it hasn&#039;t been mentioned.  What am I missing?</description>
		<content:encoded><![CDATA[<p>I have been reading about this type of approach and CQRS and I see that these are definitely good ideas.  The question that I&#8217;ve been having is with initial object creation.</p>
<p>For example, in an Accounts Payable application a user will need to enter an invoice.  This involves filling out a whole bunch of fields, saving the invoice, and possibly editing some of these fields and saving again before some state change occurs which says that the invoice is now &#8220;processed&#8221; or &#8220;verified&#8221; or something like that.</p>
<p>Once the invoice has made it to this new state it becomes more behavioral.  The user can void it and perform a handful of other operations on it.  At this point the approach you&#8217;re recommending becomes applicable.</p>
<p>What am I missing?  In my example would there be two domain objects: &#8220;invoice under construction&#8221; which is basically a CRUD getter/setter object and then it would become a &#8220;completed invoice&#8221; which would primarily have behavioral methods?</p>
<p>I&#8217;m sure that there is a solution for this, but in all the CQRS and other documents I&#8217;ve read it hasn&#8217;t been mentioned.  What am I missing?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/03/31/strengthening-your-domain-avoiding-setters/#comment-2292</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Thu, 01 Apr 2010 12:38:23 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/31/strengthening-your-domain-avoiding-setters.aspx#comment-2292</guid>
		<description>@Frank

Typically, these pieces form commands that are then executed against the domain.  It might take several to get to the finish line.

@k2

Yeah, np</description>
		<content:encoded><![CDATA[<p>@Frank</p>
<p>Typically, these pieces form commands that are then executed against the domain.  It might take several to get to the finish line.</p>
<p>@k2</p>
<p>Yeah, np</p>
]]></content:encoded>
	</item>
</channel>
</rss>
