<?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: Should Your Objects Validate Themselves?</title>
	<atom:link href="http://blog.stannard.net.au/2009/06/12/should-your-objects-validate-themselves/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.stannard.net.au/2009/06/12/should-your-objects-validate-themselves/</link>
	<description></description>
	<lastBuildDate>Sun, 08 Jan 2012 15:53:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2009/06/12/should-your-objects-validate-themselves/comment-page-1/#comment-41</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Sat, 13 Jun 2009 18:45:08 +0000</pubDate>
		<guid isPermaLink="false">#comment-41</guid>
		<description>Hi Henry

Yes, use of getters, and setters to a lesser extent, needs some extra consideration.

If I am following correctly, your object can be initialised via init() but also can have any setters you need. For example, your User object may have functions:

init(firstName,lastName,dob)
setName(firstName,lastName)
setDateOfBirth(dob)

Your init() function would probably call setName() and setDateOfBirth(). The actual validation would occur in these two functions, not in the init() function.

So, your objects are not immutable, even though they are are passed initial values via init()

Your populate() function could still self document by listing out all of the possible arguments in the function, and then call populate(argumentcollection=data).

I don&#039;t really think of populate() as being better or worse than setters. Each object should be modelled according to it&#039;s needs. Sometimes setting values in one bunch is useful, sometimes providing setters is useful. And you can provide both if that helps.

In the makeDefaultUser() function, it may be implemented something like:

&lt;cffunction name=&quot;makeDefaultUser&quot; output=&quot;false&quot;&gt;
	&lt;cfset variables.firstName = &quot;First Name&quot;&gt;
	&lt;cfset variables.lastName = &quot;Last Name&quot;&gt;
	&lt;cfset variables.dob = &quot;&quot;&gt;
&lt;/cffunction&gt;</description>
		<content:encoded><![CDATA[<p>Hi Henry</p>
<p>Yes, use of getters, and setters to a lesser extent, needs some extra consideration.</p>
<p>If I am following correctly, your object can be initialised via init() but also can have any setters you need. For example, your User object may have functions:</p>
<p>init(firstName,lastName,dob)<br />
setName(firstName,lastName)<br />
setDateOfBirth(dob)</p>
<p>Your init() function would probably call setName() and setDateOfBirth(). The actual validation would occur in these two functions, not in the init() function.</p>
<p>So, your objects are not immutable, even though they are are passed initial values via init()</p>
<p>Your populate() function could still self document by listing out all of the possible arguments in the function, and then call populate(argumentcollection=data).</p>
<p>I don&#8217;t really think of populate() as being better or worse than setters. Each object should be modelled according to it&#8217;s needs. Sometimes setting values in one bunch is useful, sometimes providing setters is useful. And you can provide both if that helps.</p>
<p>In the makeDefaultUser() function, it may be implemented something like:</p>
<p>&lt;cffunction name=&quot;makeDefaultUser&quot; output=&quot;false&quot;&gt;<br />
	&lt;cfset variables.firstName = &quot;First Name&quot;&gt;<br />
	&lt;cfset variables.lastName = &quot;Last Name&quot;&gt;<br />
	&lt;cfset variables.dob = &quot;&quot;&gt;<br />
&lt;/cffunction&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henry Ho</title>
		<link>http://blog.stannard.net.au/2009/06/12/should-your-objects-validate-themselves/comment-page-1/#comment-40</link>
		<dc:creator>Henry Ho</dc:creator>
		<pubDate>Sat, 13 Jun 2009 14:35:52 +0000</pubDate>
		<guid isPermaLink="false">#comment-40</guid>
		<description>Thanks.. here&#039;re my thoughts.

1.  I understand, getters and setters should be avoided if possible, but practically there are many objects that requires setters, especially the beans. 

2.  validation on init() is limited for web app since validation is only done on instantiation... so how can I validate when I needed to update certain fields in the future after the object is loaded back from the DB?

a.) that&#039;s for immutable object.  How about object that represents a row in DB, and the user changed a field in a form?  (e.g. shipping address?) I still need the setter(s)..

b.) populate() seems worse than setXXX(), &#039;cause u need to document what keys in struct are needed somewhere, and made the code less self-documenting.

c.) I don&#039;t see how that&#039;s better than having setFirstName() and setLastName()

d.) how can u use makeDefaultUser() to set first &amp; lastname?</description>
		<content:encoded><![CDATA[<p>Thanks.. here&#8217;re my thoughts.</p>
<p>1.  I understand, getters and setters should be avoided if possible, but practically there are many objects that requires setters, especially the beans. </p>
<p>2.  validation on init() is limited for web app since validation is only done on instantiation&#8230; so how can I validate when I needed to update certain fields in the future after the object is loaded back from the DB?</p>
<p>a.) that&#8217;s for immutable object.  How about object that represents a row in DB, and the user changed a field in a form?  (e.g. shipping address?) I still need the setter(s)..</p>
<p>b.) populate() seems worse than setXXX(), &#8217;cause u need to document what keys in struct are needed somewhere, and made the code less self-documenting.</p>
<p>c.) I don&#8217;t see how that&#8217;s better than having setFirstName() and setLastName()</p>
<p>d.) how can u use makeDefaultUser() to set first &amp; lastname?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2009/06/12/should-your-objects-validate-themselves/comment-page-1/#comment-39</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Sat, 13 Jun 2009 14:27:09 +0000</pubDate>
		<guid isPermaLink="false">#comment-39</guid>
		<description>Hi Henry

There are a couple of ideas to consider:

1) When you are designing your object you would not necessarily have setters for every field.

2) The validation probably doesn&#039;t sit in the init() function. It&#039;s likely that the init() would call the setters/other functions (some possibly private) which would in turn perform the required validation.

Couple of scenarios:

a) You may have an object with no setters - the only way to get data into the object is via init().

b) You may have an object with no setters - all data is set via a populate() function which takes a struct of values.

c) You have setters that set more than single values. Rather than setFirstName(name) and setLastName(name) you might have setName(first,last).

d) You only have setters for a limited set of fields. The other fields are modified by other functions. For example, firstName and lastName are set on init() but are modified by a function called makeDefaultUser().</description>
		<content:encoded><![CDATA[<p>Hi Henry</p>
<p>There are a couple of ideas to consider:</p>
<p>1) When you are designing your object you would not necessarily have setters for every field.</p>
<p>2) The validation probably doesn&#8217;t sit in the init() function. It&#8217;s likely that the init() would call the setters/other functions (some possibly private) which would in turn perform the required validation.</p>
<p>Couple of scenarios:</p>
<p>a) You may have an object with no setters &#8211; the only way to get data into the object is via init().</p>
<p>b) You may have an object with no setters &#8211; all data is set via a populate() function which takes a struct of values.</p>
<p>c) You have setters that set more than single values. Rather than setFirstName(name) and setLastName(name) you might have setName(first,last).</p>
<p>d) You only have setters for a limited set of fields. The other fields are modified by other functions. For example, firstName and lastName are set on init() but are modified by a function called makeDefaultUser().</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henry Ho</title>
		<link>http://blog.stannard.net.au/2009/06/12/should-your-objects-validate-themselves/comment-page-1/#comment-38</link>
		<dc:creator>Henry Ho</dc:creator>
		<pubDate>Sat, 13 Jun 2009 10:39:21 +0000</pubDate>
		<guid isPermaLink="false">#comment-38</guid>
		<description>validation at init() doesn&#039;t work when the preference(s) can be set by the user after the object has been created.</description>
		<content:encoded><![CDATA[<p>validation at init() doesn&#8217;t work when the preference(s) can be set by the user after the object has been created.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2009/06/12/should-your-objects-validate-themselves/comment-page-1/#comment-37</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Sat, 13 Jun 2009 06:21:53 +0000</pubDate>
		<guid isPermaLink="false">#comment-37</guid>
		<description>Hi Oscar

This reminded me that if you don&#039;t pass values via the init() function then your object needs to internally set itself to a valid initial state.

In our example above where a first and last name were required, the object might set default values of the first name and last name fields to be &quot;First Name&quot; and &quot;Last Name&quot; if that was appropriate. If having these default &quot;place holder&quot; values was not appropriate then these would need to be mandatory in the init().

Thanks for expanding on that part, great points.</description>
		<content:encoded><![CDATA[<p>Hi Oscar</p>
<p>This reminded me that if you don&#8217;t pass values via the init() function then your object needs to internally set itself to a valid initial state.</p>
<p>In our example above where a first and last name were required, the object might set default values of the first name and last name fields to be &quot;First Name&quot; and &quot;Last Name&quot; if that was appropriate. If having these default &quot;place holder&quot; values was not appropriate then these would need to be mandatory in the init().</p>
<p>Thanks for expanding on that part, great points.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oscar Arevalo</title>
		<link>http://blog.stannard.net.au/2009/06/12/should-your-objects-validate-themselves/comment-page-1/#comment-36</link>
		<dc:creator>Oscar Arevalo</dc:creator>
		<pubDate>Fri, 12 Jun 2009 23:34:54 +0000</pubDate>
		<guid isPermaLink="false">#comment-36</guid>
		<description>I might like to add an alternative point of view, one which Kevan touched lightly in the example in which the arguments were passed within the init function.

What is needed is to really look at the essence of the validation problem. There are two ways in which the object can get to an invalid state: 

1) when an individual property has an invalid value independently from the values of all other properties. i.e. &quot;password has to be at least 6 characters long&quot;
 
2) when the invalid state is caused by the relation between two or more properties, i.e. if property A is given, then property B must be non-empty.

Checking for case 1 is simple enough by putting the appropriate checks in &quot;setter&quot; methods; however case 2 is more complex since the logic, as Kevan points out, cannot just reside on the setters since the object will be invalid in the time between the setters for the two related properties are called.

In my opinion, this problem needs to be dealt at the time when the object is modeled. There is nothing in OO-land that says that you &quot;have to&quot; have a setter method for every single property in your object. If you know that the business rules for the object indicate that it should not be allowed to be in an invalid state, but at the same time the validity of the state involves cross-checking multiple properties, then your object should provide a way in which all these properties are entered at the same time. This is pretty much what Kevan did when he passed all the values on the Init() method. Now, using the init() is not the only way to do this. You can very well have a setter method that takes some sort of transfer object or value object that is just a container for multiple properties (without validation). You can even use a plain old &quot;struct&quot; type for this and keep things simple. This method ( init(), setMemento(), setState(), or whatever) would take this container of data, apply whatever validation rules are needed and then react accordingly either by accepting the values or throwing errors. This way the business logic that determines when the object is valid or not remains encapsulated within the object, but you ensure that your object will ALWAYS be in a valid and consistent state.

Cheers,

Oscar</description>
		<content:encoded><![CDATA[<p>I might like to add an alternative point of view, one which Kevan touched lightly in the example in which the arguments were passed within the init function.</p>
<p>What is needed is to really look at the essence of the validation problem. There are two ways in which the object can get to an invalid state: </p>
<p>1) when an individual property has an invalid value independently from the values of all other properties. i.e. &quot;password has to be at least 6 characters long&quot;</p>
<p>2) when the invalid state is caused by the relation between two or more properties, i.e. if property A is given, then property B must be non-empty.</p>
<p>Checking for case 1 is simple enough by putting the appropriate checks in &quot;setter&quot; methods; however case 2 is more complex since the logic, as Kevan points out, cannot just reside on the setters since the object will be invalid in the time between the setters for the two related properties are called.</p>
<p>In my opinion, this problem needs to be dealt at the time when the object is modeled. There is nothing in OO-land that says that you &quot;have to&quot; have a setter method for every single property in your object. If you know that the business rules for the object indicate that it should not be allowed to be in an invalid state, but at the same time the validity of the state involves cross-checking multiple properties, then your object should provide a way in which all these properties are entered at the same time. This is pretty much what Kevan did when he passed all the values on the Init() method. Now, using the init() is not the only way to do this. You can very well have a setter method that takes some sort of transfer object or value object that is just a container for multiple properties (without validation). You can even use a plain old &quot;struct&quot; type for this and keep things simple. This method ( init(), setMemento(), setState(), or whatever) would take this container of data, apply whatever validation rules are needed and then react accordingly either by accepting the values or throwing errors. This way the business logic that determines when the object is valid or not remains encapsulated within the object, but you ensure that your object will ALWAYS be in a valid and consistent state.</p>
<p>Cheers,</p>
<p>Oscar</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2009/06/12/should-your-objects-validate-themselves/comment-page-1/#comment-35</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Fri, 12 Jun 2009 15:18:47 +0000</pubDate>
		<guid isPermaLink="false">#comment-35</guid>
		<description>Hi Bob, Yes that makes sense; if your objects are persisted and retrieved through a standard mechanism then there would never be a problem, and realisitically if you had separate process changing then this data incorrectly then it would just be a bug that needed to be fixed, not a design problem. 

Thanks</description>
		<content:encoded><![CDATA[<p>Hi Bob, Yes that makes sense; if your objects are persisted and retrieved through a standard mechanism then there would never be a problem, and realisitically if you had separate process changing then this data incorrectly then it would just be a bug that needed to be fixed, not a design problem. </p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Silverberg</title>
		<link>http://blog.stannard.net.au/2009/06/12/should-your-objects-validate-themselves/comment-page-1/#comment-34</link>
		<dc:creator>Bob Silverberg</dc:creator>
		<pubDate>Fri, 12 Jun 2009 07:58:09 +0000</pubDate>
		<guid isPermaLink="false">#comment-34</guid>
		<description>Hi Kevan,

Thanks for your thoughtful responses to my comments.  Regarding the issue of objects being in an invalid state, I&#039;m not concerned because I have total control over the system and the data.  It isn&#039;t possible for an object to be persisted to the database in an invalid state, so it&#039;s also not possible for one to be retrieved in an invalid state.  I can see how if this scenario doesn&#039;t apply (e.g., data can be populated from outside your system) that you&#039;d have to have a way of dealing with that.  It&#039;s just that I don&#039;t have that concern so I don&#039;t need to solve a problem that doesn&#039;t exist for me.</description>
		<content:encoded><![CDATA[<p>Hi Kevan,</p>
<p>Thanks for your thoughtful responses to my comments.  Regarding the issue of objects being in an invalid state, I&#8217;m not concerned because I have total control over the system and the data.  It isn&#8217;t possible for an object to be persisted to the database in an invalid state, so it&#8217;s also not possible for one to be retrieved in an invalid state.  I can see how if this scenario doesn&#8217;t apply (e.g., data can be populated from outside your system) that you&#8217;d have to have a way of dealing with that.  It&#8217;s just that I don&#8217;t have that concern so I don&#8217;t need to solve a problem that doesn&#8217;t exist for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2009/06/12/should-your-objects-validate-themselves/comment-page-1/#comment-33</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Fri, 12 Jun 2009 07:32:07 +0000</pubDate>
		<guid isPermaLink="false">#comment-33</guid>
		<description>Hi Brian

Yes, I am thinking this through more after Bob&#039;s comments.

I suppose the main role of the extra object is to act as a data transformer. As Bob mentioned, the forms and objects may not have a one to one relationship - one form could result in many objects, or one form could represent only part of an object.

Perhaps this extra object has similarities to a Gateway that transforms database data into objects. In this case transforming form data into objects, but also provides validation.

Found this link which appears related:
http://www.scribd.com/doc/10894361/Transformation-Interface-Design-Pattern-Andy-Bulka

Thanks</description>
		<content:encoded><![CDATA[<p>Hi Brian</p>
<p>Yes, I am thinking this through more after Bob&#8217;s comments.</p>
<p>I suppose the main role of the extra object is to act as a data transformer. As Bob mentioned, the forms and objects may not have a one to one relationship &#8211; one form could result in many objects, or one form could represent only part of an object.</p>
<p>Perhaps this extra object has similarities to a Gateway that transforms database data into objects. In this case transforming form data into objects, but also provides validation.</p>
<p>Found this link which appears related:<br />
<a href="http://www.scribd.com/doc/10894361/Transformation-Interface-Design-Pattern-Andy-Bulka" rel="nofollow">http://www.scribd.com/doc/10894361/Transformation-Interface-Design-Pattern-Andy-Bulka</a></p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2009/06/12/should-your-objects-validate-themselves/comment-page-1/#comment-32</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Fri, 12 Jun 2009 07:23:11 +0000</pubDate>
		<guid isPermaLink="false">#comment-32</guid>
		<description>Hi Bob

Thanks for your comments - you mentioned quite a few things I hadn&#039;t considered and gave me some great things to think through. 

&gt; The problem I have with the UserForm object is that I might have many
&gt; forms which interact with the User object ...

In the case where the user data is used in a multiple form contexts then I would consider the UserForm would then represent a part of the form rather than a whole form. It would be used to validate those couple of fields within the larger context.

&gt; Another point is that the logic dictating whether data for a user is
&gt; valid can change based on the context ...

That&#039;s a good point, hadn&#039;t thought about it. I would still consider that there would only be one UserForm object which is responsible to being aware of all of the possible fields, but you could perhaps supply a NewRegUserFormValidator or UpdateRegUserFormValidator to the init() which knows how to validate it in specifc contexts?

&gt; Maybe I&#039;m not even using a form to update the User.
&gt; Maybe the user can update their name via email.
&gt; Should I still call the object used in that situation a &quot;form&quot; object ...

The data could come from a variety of sources – forms, email, imported data, etc. But perhaps the idea is still the same because it is still just a collection of fields, but maybe I need a more abstracted name if it is used in various ways. This object is essentially taking external data and transforming it into an object, perhaps UserTransformer? Not sure. I agree the name needs some thought but perhaps the idea is still ok.

&gt; I feel that the logic that represents the business rules that
&gt; determine whether data is valid for a User should be linked
&gt; to the User object in some way, not to &quot;form&quot; objects. 

Yes, I agree. If we consider than an object can only exist in a valid state, then there must be validation logic within the object that ensures this, e.g. thowing errors when attempting to change the object into an invalid state. In this scenario, the validation would be handled by attempting to set the data and catching errors – now *this* I am a stuck on. Seems a bit clumsy, but it does prevent duplicating the logic in the separate object.

&gt; I store all of those business rules in metadata ...
&gt; I have actually developed a complete system to do that,
&gt; which is available as open source software. 

That is an awesome mighty effort Bob! Yes, your validation library would fit perfectly wherever needed. I will have to take a closer look!

For anyone reading, it is here
http://validatethis.riaforge.org/

&gt; Perhaps OO purists will call me names for this, but I think this
&gt; &quot;an object cannot be in an invalid state&quot; thing is a red herring. 
&gt; I prefer not to worry about &quot;rules that must be followed&quot;, 
&gt; but rather concentrate on allowing fundamental OO design principles 
&gt; to guide me, and take a practical approach ...
&gt; I know that I&#039;m never going to get a User object that isn&#039;t invalid.
&gt; If a User object is populated with data from an external source,
&gt; then it gets validated and if it isn&#039;t valid it gets discarded.
&gt; There is no danger of an invalid User somehow ending up
&gt; floating around my system.

Through your comments I realised that an objects data can potentially come from anywhere; form, email, imported file, database, etc. With objects that are populated from a database though, there is a possibility that the objects could come in invalid, perhaps because to another process had changed the data. If objects were required to validate themselves then this would mean that validate() would need to be called for each object read from the db?

If the object could only exist in a valid state then it would bomb out as soon as the object was being read. If the object can exist in an invalid state then any errors would show up later, perhaps as side effects elsewhere in the system?

Thanks

Kevan</description>
		<content:encoded><![CDATA[<p>Hi Bob</p>
<p>Thanks for your comments &#8211; you mentioned quite a few things I hadn&#8217;t considered and gave me some great things to think through. </p>
<p>&gt; The problem I have with the UserForm object is that I might have many<br />
&gt; forms which interact with the User object &#8230;</p>
<p>In the case where the user data is used in a multiple form contexts then I would consider the UserForm would then represent a part of the form rather than a whole form. It would be used to validate those couple of fields within the larger context.</p>
<p>&gt; Another point is that the logic dictating whether data for a user is<br />
&gt; valid can change based on the context &#8230;</p>
<p>That&#8217;s a good point, hadn&#8217;t thought about it. I would still consider that there would only be one UserForm object which is responsible to being aware of all of the possible fields, but you could perhaps supply a NewRegUserFormValidator or UpdateRegUserFormValidator to the init() which knows how to validate it in specifc contexts?</p>
<p>&gt; Maybe I&#8217;m not even using a form to update the User.<br />
&gt; Maybe the user can update their name via email.<br />
&gt; Should I still call the object used in that situation a &quot;form&quot; object &#8230;</p>
<p>The data could come from a variety of sources – forms, email, imported data, etc. But perhaps the idea is still the same because it is still just a collection of fields, but maybe I need a more abstracted name if it is used in various ways. This object is essentially taking external data and transforming it into an object, perhaps UserTransformer? Not sure. I agree the name needs some thought but perhaps the idea is still ok.</p>
<p>&gt; I feel that the logic that represents the business rules that<br />
&gt; determine whether data is valid for a User should be linked<br />
&gt; to the User object in some way, not to &quot;form&quot; objects. </p>
<p>Yes, I agree. If we consider than an object can only exist in a valid state, then there must be validation logic within the object that ensures this, e.g. thowing errors when attempting to change the object into an invalid state. In this scenario, the validation would be handled by attempting to set the data and catching errors – now *this* I am a stuck on. Seems a bit clumsy, but it does prevent duplicating the logic in the separate object.</p>
<p>&gt; I store all of those business rules in metadata &#8230;<br />
&gt; I have actually developed a complete system to do that,<br />
&gt; which is available as open source software. </p>
<p>That is an awesome mighty effort Bob! Yes, your validation library would fit perfectly wherever needed. I will have to take a closer look!</p>
<p>For anyone reading, it is here<br />
<a href="http://validatethis.riaforge.org/" rel="nofollow">http://validatethis.riaforge.org/</a></p>
<p>&gt; Perhaps OO purists will call me names for this, but I think this<br />
&gt; &quot;an object cannot be in an invalid state&quot; thing is a red herring.<br />
&gt; I prefer not to worry about &quot;rules that must be followed&quot;,<br />
&gt; but rather concentrate on allowing fundamental OO design principles<br />
&gt; to guide me, and take a practical approach &#8230;<br />
&gt; I know that I&#8217;m never going to get a User object that isn&#8217;t invalid.<br />
&gt; If a User object is populated with data from an external source,<br />
&gt; then it gets validated and if it isn&#8217;t valid it gets discarded.<br />
&gt; There is no danger of an invalid User somehow ending up<br />
&gt; floating around my system.</p>
<p>Through your comments I realised that an objects data can potentially come from anywhere; form, email, imported file, database, etc. With objects that are populated from a database though, there is a possibility that the objects could come in invalid, perhaps because to another process had changed the data. If objects were required to validate themselves then this would mean that validate() would need to be called for each object read from the db?</p>
<p>If the object could only exist in a valid state then it would bomb out as soon as the object was being read. If the object can exist in an invalid state then any errors would show up later, perhaps as side effects elsewhere in the system?</p>
<p>Thanks</p>
<p>Kevan</p>
]]></content:encoded>
	</item>
</channel>
</rss>

