<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Validation Information in Metadata</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/19/validation-information-in-metadata.aspx</link><description>Mike asks: Just curious if your metadata also contains validation rules or not? Things like property is required or range of valid values. It could include them in three possible ways – it currently uses one and I’ve had two others working in the past</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: Validation Information in Metadata</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/19/validation-information-in-metadata.aspx#1521067</link><pubDate>Thu, 21 Feb 2008 20:02:46 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1521067</guid><dc:creator>Kathleen</dc:creator><description>&lt;p&gt;Alan,&lt;/p&gt;
&lt;p&gt;I agree that rules engines are good for certain types of validation, but we're constantly in a dance between what our applications are enforcing on the business and those the business should be able to configure. Whether a value is required is absolutely a business rule, but one we'll rarely allow the business to control. For certain types of data, I also wouldn't let anyone enter negative numbers, dates in the last century, etc. &lt;/p&gt;
&lt;p&gt;We engineer businesses, and have certain responsibilities in response to that.&lt;/p&gt;
&lt;p&gt;I think rules engines are great where they apply. But for most businesses, adding a rules engine just to manage valid ranges seems overkill and many organizations don't have anyone who cares enough to keep these configurations accurate and understand the implications of changing them. Users have a very different perspective - and I do when I'm using other programs. How do I do what I want to do now, often not what I really want to do. So rules engines have a lot of potential for chaos if they are used for validation other than in organization that understands how and why its running on rules.&lt;/p&gt;
&lt;p&gt;For simple rules - such as ranges - my hope is we'll have an engine that parses simple check constraints, and encourage people to record non-complex contraints their. Regardless of whether its in the database, I'd like to see all rules in metadata or runtime rules engines, but I'm not sure 100% is achievable there. That makes them very easy to update, although it does require redployment. &lt;/p&gt;
&lt;p&gt;And much as I like workflow, its a darn shame the rules engine is locked inside. &lt;/p&gt;
&lt;p&gt;(just random thoughts from a tired person)&lt;/p&gt;
&lt;p&gt;Kathleen&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1521067" width="1" height="1"&gt;</description></item><item><title>re: Validation Information in Metadata</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/19/validation-information-in-metadata.aspx#1519418</link><pubDate>Tue, 19 Feb 2008 22:24:05 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1519418</guid><dc:creator>AllanN</dc:creator><description>&lt;p&gt;Validation Rules can and should be broken into two seperate groups as stated by Baxter above, this is because the database contains constraints which should not be confused with &amp;quot;Business Rules&amp;quot;. &amp;nbsp;Constraints can&amp;#39;t and shouldn&amp;#39;t be overwritten by user descisins as they will break the application and/or corrupt data. &amp;nbsp;Business Rules on the other hand can and normally change on a very regular basis according the the business (e.g. tax rates and who they apply to, and when. &amp;nbsp;whether to apply a surcharge to a rental customer based on age, etc), hard-coding these rules into an application template is wrong. &amp;nbsp;However, I am not stating they shouldn&amp;#39;t be in a rules template, but that&amp;#39;s a different story.&lt;/p&gt;
&lt;p&gt;I pose this question &amp;quot;How do you define &amp;#39;If obj1.field1 &amp;gt; obj2.field1 then apply obj3.field1 to obj4.field1&amp;#39; to an application template? &amp;nbsp;It would also mean the business that put that rule in place can not change it without recompiling the application code. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I think this question belongs in a rules engine blog and not the code gen blog as they are VERY different beasts. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am very keen to hear thoughts on this as there are now a few choices;&lt;/p&gt;
&lt;p&gt;1. &amp;nbsp;Creating Workflow objects from templates, this is my prefered option, with a designer for businesses allowing them to change the rules,&lt;/p&gt;
&lt;p&gt;2. &amp;nbsp;Implement a third party rules engine like ILOG, Visual Rules or BRE.&lt;/p&gt;
&lt;p&gt;3. &amp;nbsp;For simple csla projects, expose hand-crafted class for rules, derived from XML based file.&lt;/p&gt;
&lt;p&gt;There are many others, but you get the idea.&lt;/p&gt;
&lt;p&gt;My rule, &amp;quot;Rule are not developer code, they belong to the business, controlled by the business, written by the business&amp;quot;. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1519418" width="1" height="1"&gt;</description></item><item><title>re: Validation Information in Metadata</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/19/validation-information-in-metadata.aspx#1519192</link><pubDate>Tue, 19 Feb 2008 17:04:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1519192</guid><dc:creator>Kathleen</dc:creator><description>&lt;p&gt;In the long run, yes. A model is the place to start. It's just a hard jump to make. It would of course make the logic very simple. But are you ready to convince your DBA not to changt the database?&lt;/p&gt;
&lt;p&gt;You're on the list of folks working toward the open source tool, and one of the other guys on there has already done work on model first devleopment so I think this will resurface. I think it would be great to have that as a realistic model, but its hard, and harder to convince people to do it. Entity Frameworks has announced that it will not make their V1. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1519192" width="1" height="1"&gt;</description></item><item><title>re: Validation Information in Metadata</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/19/validation-information-in-metadata.aspx#1519123</link><pubDate>Tue, 19 Feb 2008 15:04:47 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1519123</guid><dc:creator>Baxter Lane</dc:creator><description>&lt;p&gt;Have you considered applying the validation in reverse? Having the generator write both the validation for the database (check constraints) and the validation for the business rules?&lt;/p&gt;
&lt;p&gt;This might only wok well if you are writing a project from scratch. &lt;/p&gt;
&lt;p&gt;I have been considering the same thing and have thought about how I can centralize the logic, in the business layer, to provide the same validation features to validators in the UI that the business layer would use. One idea I had would be to place regular expressions in an extended field property on my SQL Server tables as metadata. This would work quite well but I’m not sure it is ideal. While regular expressions are wonderfully powerful I’ve recently heard them compared to “cartoon characters swearing”. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1519123" width="1" height="1"&gt;</description></item></channel></rss>