<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Darin Boyd Dot Com &#187; Programming</title>
	<atom:link href="http://www.darinboyd.com/wordpress/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.darinboyd.com/wordpress</link>
	<description>This is what happens when you're interested in everything!</description>
	<lastBuildDate>Fri, 23 Jan 2009 05:41:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>UML for Rednecks</title>
		<link>http://www.darinboyd.com/wordpress/2009/01/uml-for-rednecks/</link>
		<comments>http://www.darinboyd.com/wordpress/2009/01/uml-for-rednecks/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 06:08:19 +0000</pubDate>
		<dc:creator>Darin Boyd</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Humor]]></category>
		<category><![CDATA[Modeling]]></category>
		<category><![CDATA[UML]]></category>

		<guid isPermaLink="false">http://www.darinboyd.com/wordpress/?p=196</guid>
		<description><![CDATA[Ok, I made you look.  Around the workplace, my UML diagrams have been called Redneck UML, Ghetto UML and my personal favorite, U Bonix.  In this article I&#8217;ll discuss the benefits of using UML even when you suck at it.
Why Should I Model?
I hear this question asked a lot and I think that [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, I made you look.  Around the workplace, my UML diagrams have been called Redneck UML, Ghetto UML and my personal favorite, U Bonix.  In this article I&#8217;ll discuss the benefits of using UML even when you suck at it.<span id="more-196"></span></p>
<h2>Why Should I Model?</h2>
<p>I hear this question asked a lot and I think that it deserves a good answer.  Perhaps people asked Frank LLoyd Wright &#8220;Are you going to doodle all day?&#8221;.   I&#8217;m kidding here of course.  Everyone knows that when embarking on a long, involved construction project requiring vision and determination, it is essential to be able to view the problem visually from a variety of view points.  Oh, you&#8217;re building software?  We just wing it around here.  It is amazing that I have worked on many projects that cost more than the average American home and had no blue prints, yet even the cheapest homes were build using a set of drawings.</p>
<p>UML for the sake of UML really doesn&#8217;t add any value to the project.  It is important to consider how UML or something like it can improve your communication with your work mates or clients and put these things to use in your projects.</p>
<h2>Some Good Reasons to Model</h2>
<p>There are many good reasons to model.  Below is a partial list of the benefits of adding modeling to your development process.</p>
<ul>
<li>It allows you to zoom out and see how your imagined widgets might interact in a project.</li>
<li>It allows you to zoom in and really map out what an entity might do.</li>
<li>It allows you to concentrate on the business process you are modeling without worrying about how to actually design the application for a specific platform.</li>
<li>It allows you to design the application by modeling your approach to a specific platform.</li>
<li>It allows you to get involved with Model Driven Architecture by creating models and transforms that will build applications.</li>
<li>It makes great marching orders for new people and employees.</li>
<li>It improves your literacy in the industry of your choice.  If you don&#8217;t learn to read and write UML, you&#8217;re going to be illiterate within the context of some projects.  It is fairly easy to tell when people can&#8217;t read.</li>
</ul>
<h2>Getting Started</h2>
<p>It&#8217;s easy to get started with modeling.  There are some great free tools out there.  I highly recommend anything built on <a title="Eclipse Web Site" href="http://www.eclipse.org/" target="_blank">Eclipse</a> and <a title="Ecore Project Web Site" href="http://www.eclipse.org/modeling/emf/?project=emf" target="_blank">ECore</a>. <a title="Top Case D Web Site" href="http://topcased.gforge.enseeiht.fr/" target="_blank">Top Case D</a> is my current favorite because it is ready to go with one simple download.  I&#8217;ll be discussing Top Case in detail in other articles.</p>
<p>Sometimes it&#8217;s hard to accept that we aren&#8217;t going to be very good at something and this prevents us from getting started.  This is a trap.  I encourage you to make some terrible and terribly useful diagrams using pen and paper or a diagramming tool.  The next time you start a small project, kick around your ideas for a solution with a low detail class diagram and get a feel for the process.  The great thing about some of the tools is that they allow you to use a source repository for your model and even attach documents to model entities.  It&#8217;s a great way to get organized and stay that way.</p>
<h2>Conclusion</h2>
<p>You will find that the more you create simplified snapshots in your own redneck dialect of UML, the more you will want to improve and formalize your understanding of the language.  You should have heard my thick, southern cracker accent when I was a child.  Hearing David Bowie made me want to learn proper English.  UML is a language and the more you speak, the better you will get.</p>
<p>I understand that I haven&#8217;t given you concrete instructions on how to create a proper class diagram.  Something tells me that you have seen plenty of examples of how to do this and still haven&#8217;t made the leap.  I will be doing some tutorial videos on the topic in the future, but please don&#8217;t wait on me.  I can recommend a pretty good book on the topic for a beginner. Check out <a title="UML a Biginner's Guide Amazon Link" href="http://www.amazon.com/gp/product/0072224606?ie=UTF8&amp;tag=bradotcom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0072224606&quot;" target="_blank">UML a Beginner&#8217;s Guide</a> by Jason T. Roff.</p>
<p>Draw baby draw!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darinboyd.com/wordpress/2009/01/uml-for-rednecks/feed/</wfw:commentRss>
		<slash:comments>332</slash:comments>
		</item>
		<item>
		<title>Creating a String Range Rule with Monkey Wrench</title>
		<link>http://www.darinboyd.com/wordpress/2009/01/creating-a-string-range-rule-with-monkey-wrench/</link>
		<comments>http://www.darinboyd.com/wordpress/2009/01/creating-a-string-range-rule-with-monkey-wrench/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 09:35:48 +0000</pubDate>
		<dc:creator>Darin Boyd</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Monkeywrench]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.darinboyd.com/wordpress/?p=165</guid>
		<description><![CDATA[In this article, the third in a series of creating a business objects framework for the Wordpress blogging environment, we will discuss the construction of a custom rule class based on the Rule abstract base class from the last article.
The source file for the the entire framework may be downloaded here.  We will be [...]]]></description>
			<content:encoded><![CDATA[<p>In this article, the third in a series of creating a business objects framework for the Wordpress blogging environment, we will discuss the construction of a custom rule class based on the <strong>Rule</strong> abstract base class from the last <a title="Building Monkey Wrench - The Rule Classes" href="http://www.darinboyd.com/wordpress/2009/01/building-monkey-wrench-the-rule-classes/" target="_blank">article</a>.<span id="more-165"></span></p>
<p>The source file for the the entire framework may be downloaded <a href="http://www.darinboyd.com/wordpress/wp-content/uploads/2009/01/monkeywrench.zip">here</a>.  We will be covering <strong>StringRangeRule.php</strong>.</p>
<h2>The StringRangeRule Class</h2>
<p>Using the abstract base class Rule which we created last time, we will build a class to solve a common validation problem.  For the sake of database integrity and business goals, it is common to enforce length restrictions on some of the text properties of an object.  Our string range validator can be configured to do the following.</p>
<ul>
<li>Set min and max length values so that the string length must fall within the range.</li>
<li>Set min to zero and provide a max so that the string may be any length not exceeding the max.</li>
<li>Set max to zero and provide a min so that the string may be any length as long as it is at least min characters in length.</li>
</ul>
<p>Our class will provide a neat package for handling the tasks on the above list.</p>
<p>Let&#8217;s write some code!</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;">&nbsp;
We begin by using <span style="color: #339933;">&lt;</span>strong<span style="color: #339933;">&gt;</span>require_once<span style="color: #339933;">&lt;/</span>strong<span style="color: #339933;">&gt;</span> to reference the <span style="color: #339933;">&lt;</span>strong<span style="color: #339933;">&gt;</span>Rule<span style="color: #339933;">.</span>php<span style="color: #339933;">&lt;/</span>strong<span style="color: #339933;">&gt;</span> <span style="color: #990000;">file</span> containing our base <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">.</span>  In my setup<span style="color: #339933;">,</span> the <span style="color: #339933;">&lt;</span>strong<span style="color: #339933;">&gt;</span>Rule<span style="color: #339933;">.</span>php<span style="color: #339933;">&lt;/</span>strong<span style="color: #339933;">&gt;</span> <span style="color: #990000;">file</span> is in the same directory <span style="color: #b1b100;">as</span>  our <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">.</span>  We inherit from <span style="color: #339933;">&lt;</span>strong<span style="color: #339933;">&gt;</span>Rule<span style="color: #339933;">&lt;/</span>strong<span style="color: #339933;">&gt;</span> using the <span style="color: #339933;">&lt;</span>strong<span style="color: #339933;">&gt;</span>extends<span style="color: #339933;">&lt;/</span>strong<span style="color: #339933;">&gt;</span> <span style="color: #990000;">key</span> word<span style="color: #339933;">.</span>  We declare the <span style="color: #339933;">&lt;</span>strong<span style="color: #339933;">&gt;</span>Min<span style="color: #339933;">&lt;/</span>strong<span style="color: #339933;">&gt;</span> and <span style="color: #339933;">&lt;</span>strong<span style="color: #339933;">&gt;</span>Max<span style="color: #339933;">&lt;/</span>strong<span style="color: #339933;">&gt;</span> member variables<span style="color: #339933;">.</span>  These variables are declared <span style="color: #b1b100;">as</span> protected so that you could create other classes based on our <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000000; font-weight: bold;">class</span> which would have access to the <span style="color: #990000;">Min</span> and <span style="color: #990000;">Max</span> member variables<span style="color: #339933;">.</span>
<span style="color: #339933;">&lt;</span>pre lang<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;php&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #666666; font-style: italic;">// Public State Methods</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Minimum length allowed for string.
	 *
	 * @return number
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> GetMin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Sets minimum allowed length for string.
	 *
	 * @param number $value
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> SetMin<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span>;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Maximum length allowed for string.
	 *
	 * @return number
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> GetMax<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Sets maximum allowed length for string.
	 *
	 * @param number $value
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> SetMax<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span>;
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The code above contains &#8220;getters and setters&#8221; for our member variables.  Notice that I am documenting these methods per our discussion about coding style and documentation in the first article.</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;">	<span style="color: #666666; font-style: italic;">// Constructors</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Constructor
	 * @param string $_ruleName
	 * @param string $_propertyName
	 * @param string $_min
	 * @param string $_max
	 *
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_ruleName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_propertyName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_min</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_max</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_ruleName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_propertyName</span><span style="color: #339933;">,</span> <span style="">''</span><span style="color: #009900;">&#41;</span>;
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">=</span> <span style="color: #000088;">$_min</span>;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">=</span> <span style="color: #000088;">$_max</span>;
&nbsp;
		<span style="color: #666666; font-style: italic;">// check the max and min values</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;CheckValues<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
		<span style="color: #666666; font-style: italic;">// set the display text</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;CalculateDisplayText<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The constructor above takes in the rule name and property names, as does our base class, and adds two new parameters representing the min and max values for our new class.  We call the constructor on the base class in line 70 using the <strong>parent::_construct()</strong> method and passing along the rule name and property name values.  Values for Max and Min are then assigned based on the appropriate parameter values.  In lines 76 and 79, we call helper functions in our class to check for proper min and max values and to construct a good user description based on the values for min and max.</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Overrides</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Validate<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_objectToValidate</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Check the values again to make sure the rule is set up properly.</span>
&nbsp;
		<span style="color: #000088;">$_MethodName</span> <span style="color: #339933;">=</span> <span style="">'Get'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_PropertyName;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_PropertyValue <span style="color: #339933;">=</span> <span style="color: #000088;">$_objectToValidate</span><span style="color: #339933;">-&amp;</span>gt;<span style="color: #000088;">$_MethodName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;CheckValues<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
		<span style="color: #000088;">$_MinOnly</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">&amp;</span>gt; <span style="color:#800080;">0</span> <span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">==</span> <span style="color:#800080;">0</span>;
		<span style="color: #000088;">$_MaxOnly</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">&amp;</span>gt; <span style="color:#800080;">0</span> <span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">==</span> <span style="color:#800080;">0</span>;
		<span style="color: #000088;">$_MaxAndMin</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">&amp;</span>gt; <span style="color:#800080;">0</span> <span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">&amp;</span>gt; <span style="color:#800080;">0</span> <span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">&amp;</span>lt; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max;
		<span style="color: #000088;">$_Len</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_PropertyValue<span style="color: #009900;">&#41;</span>;
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_MinOnly</span> <span style="color: #339933;">==</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_IsValid <span style="color: #339933;">=</span> <span style="color: #000088;">$_Len</span> <span style="color: #339933;">&amp;</span>gt;= <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min;
			<span style="color: #b1b100;">return</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_MaxOnly</span> <span style="color: #339933;">==</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_IsValid <span style="color: #339933;">=</span> <span style="color: #000088;">$_Len</span> <span style="color: #339933;">&amp;</span>lt;= <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max;
			<span style="color: #b1b100;">return</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_MaxAndMin</span> <span style="color: #339933;">==</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_IsValid <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_Len</span> <span style="color: #339933;">&amp;</span>gt;= <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min<span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_Len</span> <span style="color: #339933;">&amp;</span>lt;= <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max<span style="color: #009900;">&#41;</span>;
&nbsp;
			<span style="color: #b1b100;">return</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>We arrive at our only override from the Rule base class in line 84.  We declared this method to be abstract in the Rule base class, so we are required to implement the method in our new class. In line 91, we set out to get the value of the correct property from the object which has been passed in.  Since we are using a convention of &#8220;getters and setters&#8221;, we can construct the proper &#8220;get&#8221; call to grab the value from the object.  For example, if our rule is set to validate the LastName of a Person object at runtime, the call to get that value would be GetLastName().  Another call is placed to CheckValues() to make sure that the values are still good.  We do this because the object could have been edited with the interface methods since the initial call to the constructor.  Lines 96 to 99 create member variables representing how the object has been configured based on the min and max values.  The length of the property value is recorded for comparison to the min and max values.  Lines 101 to 119 set the m_IsValid variable for the correct configuration scenario.</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;">	<span style="color: #666666; font-style: italic;">// Helper Methods</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Figures out how to display the rule text to the user based on the
	 * values of Min and Max.
	 *
	 */</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> CalculateDisplayText<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">==</span> <span style="color:#800080;">0</span> <span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">&amp;</span>gt; <span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span>	<span style="color: #666666; font-style: italic;">// we have a rule where only the max has been set</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_DisplayText <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_PropertyName <span style="color: #339933;">.</span> <span style="">' may be no longer than '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">.</span> <span style="">' characters in length.'</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">&amp;</span>gt; <span style="color:#800080;">0</span> <span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">==</span> <span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span>	<span style="color: #666666; font-style: italic;">// we have a rule where only the min has been set</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_DisplayText <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_PropertyName <span style="color: #339933;">.</span> <span style="">' must be at least '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">.</span> <span style="">' characters in length.'</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">&amp;</span>gt; <span style="color:#800080;">0</span> <span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">&amp;</span>gt; <span style="color:#800080;">0</span> <span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">&amp;</span>lt; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max<span style="color: #009900;">&#41;</span>	<span style="color: #666666; font-style: italic;">// we have a rule where min and max have been set</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_DisplayText <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_PropertyName <span style="color: #339933;">.</span> <span style="">' must be between '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">.</span> <span style="">' and '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">.</span> <span style="">' characters in length.'</span>;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Checks values for min and max set by the programmer.
	 * Min must be less than max if max is greater than zero.
	 * Max must be greater than min if min is greater than zero.
	 * Neither may be a negative number.
	 * Both values may not be equal to zero at the same time.
	 *
	 */</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> CheckValues<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// check for negative values</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">&amp;</span>lt; <span style="color:#800080;">0</span> || <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">&amp;</span>lt; <span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="">'Min or Max values may not be less than zero.'</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// check for double zeros.</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">==</span> <span style="color:#800080;">0</span> <span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">==</span> <span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="">'Min or Max values may not both be set to zero.'</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// check for min less than max when max is set</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">&amp;</span>gt; <span style="color:#800080;">0</span> <span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">&amp;</span>gt;= <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="">'If Max is set to a non zero number, Min must be less than Max.'</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// check for max greater than min when min is set</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">&amp;</span>gt; <span style="color:#800080;">0</span> <span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">&amp;</span>lt;= <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Min <span style="color: #339933;">&amp;</span>amp;&amp;amp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt;m_Max <span style="color: #339933;">!=</span> <span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="">'If Min is set to a non zero number, Max must be greater than Min.'</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
?<span style="color: #339933;">&amp;</span>gt;</pre></div></div>

<p>CalculateDisplayText() creates a message for the user based on how the min and max values are set.  You can see that CheckValues() is throwing an exception if there are crazy values set up for an object of our class.  These kinds of errors would be the result of improper coding while using the class.  Their audience is the developer.  I feel that it is important to provide this kind of feedback for others.</p>
<h2>Conclusion</h2>
<p>We now have a base class and a product of that class to use going forward with our framework.  Hopefully, you&#8217;re thinking of a few other classes you might create to handle some common validation situations that you run in to.  Feel free to send in your code.  I will add them to the framework and discuss the new classes on the blog.  In the next article, we are going to build another abstract base class which makes use of the validation classes we have created so far.  I know it&#8217;s a long road, but we&#8217;ll have some really cool development tools as we move forward.</p>
<h2>Also Available in This Series</h2>
<ul>
<li><a title="A Business Objects Framework for Wordpress" href="http://www.darinboyd.com/wordpress/2009/01/a-business-objects-framework-for-php-part-1/" target="_blank">A Business Objects Framework for Wordpress</a></li>
<li><a title="Building Monkey Wrench - The Rule Classes" rel="bookmark" href="http://www.darinboyd.com/wordpress/2009/01/building-monkey-wrench-the-rule-classes/" target="_blank">Building Monkey Wrench &#8211; The Rule Classes</a></li>
</ul>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.darinboyd.com/wordpress/2009/01/creating-a-string-range-rule-with-monkey-wrench/feed/</wfw:commentRss>
		<slash:comments>250</slash:comments>
		</item>
		<item>
		<title>Cleaner Configuration Code for .Net</title>
		<link>http://www.darinboyd.com/wordpress/2009/01/cleaner-configuration-code-for-net/</link>
		<comments>http://www.darinboyd.com/wordpress/2009/01/cleaner-configuration-code-for-net/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 09:13:08 +0000</pubDate>
		<dc:creator>Darin Boyd</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.Net]]></category>

		<guid isPermaLink="false">http://www.darinboyd.com/wordpress/?p=88</guid>
		<description><![CDATA[Microsoft&#8217;s configuration system is very handy, but often configuration access code can get pretty nasty and result in a lot of duplication. In preparation for another article I am creating for the site, I decided to share a simple technique I use for managing my config code.
The Normal Way
Suppose that you have a few config [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft&#8217;s configuration system is very handy, but often configuration access code can get pretty nasty and result in a lot of duplication.<span id="more-88"></span> In preparation for another article I am creating for the site, I decided to share a simple technique I use for managing my config code.</p>
<h2>The Normal Way</h2>
<p>Suppose that you have a few config settings in the config file.  Our example has three settings.  Two of the settings are strings and the last one should be cast to a long.  Let us also suppose that we want to throw an exception reminding the developer that the application is not configured correctly if either of the string settings are missing.  For the long setting, we do not wish to throw an error if the setting is missing.  We would prefer to assume a default value unless the config file says otherwise.  If we don&#8217;t have a class in which to house these policies,  the code gets pretty messy.  Below is and example of a few simple calls with no wrapper.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> Before<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">// get the connection string for the database</span>
&nbsp;
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ConfigurationManager.<span style="color: #0000FF;">ConnectionStrings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;CacheDBConnection&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">throw</span> <span style="color: #008000;">new</span> Exception<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Config setting 'CacheDBConnection' does not exist in the config file.&quot;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
    <span style="color: #008080; font-style: italic;">// if the exception doesn’t throw, we can keep going</span>
    <span style="color: #FF0000;">string</span> _ConnectionString <span style="color: #008000;">=</span> ConfigurationManager.<span style="color: #0000FF;">ConnectionStrings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;CacheDBConnection&quot;</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">ConnectionString</span>;
&nbsp;
    <span style="color: #008080; font-style: italic;">// get the default size for the cache from the config file</span>
&nbsp;
    <span style="color: #FF0000;">long</span> _CacheSize <span style="color: #008000;">=</span> 0;
&nbsp;
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ConfigurationManager.<span style="color: #0000FF;">ConnectionStrings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;CacheSizeLimit&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
        _CacheSize <span style="color: #008000;">=</span> <span style="color: #FF0000;">long</span>.<span style="color: #0000FF;">Parse</span><span style="color: #000000;">&#40;</span>ConfigurationManager.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;CacheSizeLimit&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The above approach has many disadvantages including the following items.</p>
<ul>
<li>It is verbose</li>
<li>Making several calls like this would generate a lot of duplicate code.  This is a real problem for maintenance.</li>
<li>It is likely that many people would not put in repetitious checks for a valid configuration out of sheer laziness.</li>
<li>You have to remember the name of the config settings without any help from intellisense while you&#8217;re in the heat of coding.</li>
</ul>
<h2>A Solution to Messy Config Code</h2>
<p>The manager class I created here was built for a caching manager, so it is called <strong>ObjectCacheConfig</strong>. You can build your config class to your own specifications taking some inspiration from the class presented.  The class file may be downloaded by clicking <a title="source code" href="http://www.darinboyd.com/wordpress/wp-content/uploads/2009/01/objectcacheconfig.zip" target="_blank"></a><a href="http://www.darinboyd.com/wordpress/wp-content/uploads/2009/01/objectcacheconfig.zip">here</a>.</p>
<p>I built this class as a static class to avoid the need for an instance.  This is a fairly common pattern in .Net and I use it frequently for utility classes which need no state. The public static properties access the appropriate config file settings and perform any validity checks and casting required.   The <strong>VerifyAppSetting()</strong> helper method allows some flexibility in your policy regarding missing config settings.  <strong>VerifyConnectionString()</strong> will throw an error if the connection string does not exist.</p>
<p><strong>Note: </strong><em>In the code example below, I was unable to include my usual XML documentation comments due to formatting problems with my source code display plugin.  The XML comments are included with the actual source file.</em></p>

<div class="wp_syntax"><div class="code"><pre class="csharp csharp" style="font-family:monospace;"><span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span>;
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Text</span>;
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Configuration</span>;
&nbsp;
<span style="color: #0600FF;">namespace</span> ObjectCacheCore
<span style="color: #000000;">&#123;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> ObjectCacheConfig
    <span style="color: #000000;">&#123;</span>
&nbsp;
        <span style="color: #008080;">#region Static Properties</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> CacheDBConnection
        <span style="color: #000000;">&#123;</span>
            get
            <span style="color: #000000;">&#123;</span>
                VerifyConnectionString<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;CacheDBConnection&quot;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
                <span style="color: #0600FF;">return</span> ConfigurationManager.<span style="color: #0000FF;">ConnectionStrings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;CacheDBConnection&quot;</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">ConnectionString</span>;
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> CacheDBTable
        <span style="color: #000000;">&#123;</span>
            get
            <span style="color: #000000;">&#123;</span>
                VerifyAppSetting<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;CacheDBTable&quot;</span>, <span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span>;
&nbsp;
&nbsp;
                <span style="color: #0600FF;">return</span> ConfigurationManager.<span style="color: #0000FF;">ConnectionStrings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;CacheDBTable&quot;</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">ConnectionString</span>;
            <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">long</span> CacheSizeLimit
        <span style="color: #000000;">&#123;</span>
            get
            <span style="color: #000000;">&#123;</span>
                <span style="color: #FF0000;">long</span> _SizeLimit <span style="color: #008000;">=</span> 0;
                <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>VerifyAppSetting<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;CacheSizeLimit&quot;</span>, <span style="color: #0600FF;">false</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    _SizeLimit <span style="color: #008000;">=</span> <span style="color: #FF0000;">long</span>.<span style="color: #0000FF;">Parse</span><span style="color: #000000;">&#40;</span>ConfigurationManager.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;CacheSizeLimit&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
                <span style="color: #000000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF;">return</span> _SizeLimit;
            <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #008080;">#endregion</span>
&nbsp;
        <span style="color: #008080;">#region Helper Methods</span>
&nbsp;
        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">bool</span> VerifyAppSetting<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> settingName, <span style="color: #FF0000;">bool</span> throwIfNull<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #FF0000;">bool</span> _Exists <span style="color: #008000;">=</span> ConfigurationManager.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span>settingName<span style="color: #000000;">&#93;</span> <span style="color: #008000;">!=</span> null;
&nbsp;
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #008000;">!</span>_Exists <span style="color: #008000;">&amp;&amp;</span> throwIfNull<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #FF0000;">string</span> _Message <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Application setting '&quot;</span> <span style="color: #008000;">+</span> settingName <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;' does not exist in the config file.&quot;</span>;
                <span style="color: #0600FF;">throw</span> <span style="color: #008000;">new</span> ConfigurationErrorsException<span style="color: #000000;">&#40;</span>_Message<span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0600FF;">return</span> _Exists;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> VerifyConnectionString<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> connectionName<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #FF0000;">bool</span> _Exists <span style="color: #008000;">=</span> ConfigurationManager.<span style="color: #0000FF;">ConnectionStrings</span><span style="color: #000000;">&#91;</span>connectionName<span style="color: #000000;">&#93;</span> <span style="color: #008000;">!=</span> null;
&nbsp;
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #008000;">!</span>_Exists<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #FF0000;">string</span> _Message <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Connection string '&quot;</span> <span style="color: #008000;">+</span> connectionName <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;' does not exist in the config file.&quot;</span>;
                <span style="color: #0600FF;">throw</span> <span style="color: #008000;">new</span> ConfigurationErrorsException<span style="color: #000000;">&#40;</span>_Message<span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #008080;">#endregion</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></div></div>

<h2>Life After the Config Class</h2>
<p>Let&#8217;s see what our access code would look like now that the config manager class has been written.  The code below accomplishes the same result as our first code sample in the article.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> After<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">// get the connection string</span>
    <span style="color: #FF0000;">string</span> _ConnectionString <span style="color: #008000;">=</span> ObjectCacheConfig.<span style="color: #0000FF;">CacheDBConnection</span>;
&nbsp;
    <span style="color: #008080; font-style: italic;">// get the configured cache size limit</span>
    <span style="color: #FF0000;">long</span> _CacheSize <span style="color: #008000;">=</span> ObjectCacheConfig.<span style="color: #0000FF;">CacheSizeLimit</span>;
&nbsp;
<span style="color: #000000;">&#125;</span></pre></div></div>

<h2>In Conclusion</h2>
<p>Using a pattern similar to the above class can really clean up your application code with regard to config access. We reduced the code size and eliminated duplicate code.  Now, while coding, Visual Studio will give you a drop down menu of your config settings with full documentation for the setting if you have your xml comments in place.    It is a simple pattern, yet it could change your code dramatically if you use a lot of config settings.</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darinboyd.com/wordpress/2009/01/cleaner-configuration-code-for-net/feed/</wfw:commentRss>
		<slash:comments>1240</slash:comments>
		</item>
		<item>
		<title>Building Monkey Wrench &#8211; The Rule Classes</title>
		<link>http://www.darinboyd.com/wordpress/2009/01/building-monkey-wrench-the-rule-classes/</link>
		<comments>http://www.darinboyd.com/wordpress/2009/01/building-monkey-wrench-the-rule-classes/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 03:37:54 +0000</pubDate>
		<dc:creator>Darin Boyd</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Monkeywrench]]></category>

		<guid isPermaLink="false">http://www.darinboyd.com/wordpress/?p=19</guid>
		<description><![CDATA[This is Part II in a series of articles dedicated to building a business objects framework for the Wordpress environment.  If you haven&#8217;t read Part I of the series, please check it out.  Part I introduces the concept of a framework.
Monkey Wrench Core Classes
The following UML diagram shows the basic class structure for the earliest [...]]]></description>
			<content:encoded><![CDATA[<p>This is <strong>Part II</strong> in a series of articles dedicated to building a business objects framework for the Wordpress environment.  If you haven&#8217;t read <a title="Link to A Business Objects Framework for Wordpress" href="http://www.darinboyd.com/wordpress/2009/01/a-business-objects-framework-for-php-part-1/" target="_blank">Part I</a> of the series, please check it out.  <strong>Part I</strong> introduces the concept of a framework.<span id="more-19"></span></p>
<h2>Monkey Wrench Core Classes</h2>
<p>The following UML diagram shows the basic class structure for the earliest version of our framework.  I&#8217;ll go over each class in detail over the next several articles.  This article will focus on dealing with validation rules.</p>
<div id="attachment_27" class="wp-caption alignnone" style="width: 518px"><img class="size-full wp-image-27" title="Monkey Wrench Class Diagram" src="http://www.darinboyd.com/wordpress/wp-content/uploads/2009/01/monkeywrenchclassdiagram2.png" alt="Monkey Wrench Class Diagram" width="508" height="506" /><p class="wp-caption-text">Monkey Wrench Class Diagram</p></div>
<p>The above diagram isn&#8217;t perfect UML.  I have simplified the classes to basic properties and operations for the sake of clarity.  The actual implementation will be more elaborate.  The green classes are abstract.  The blue classes are concrete classes built by inheriting from the base classes.</p>
<h2>The Abstract Rule Class</h2>
<p>As mentioned in <a title="Link to A Business Objects Framework for Wordpress" href="http://www.darinboyd.com/wordpress/2009/01/a-business-objects-framework-for-php-part-1/" target="_blank">Part I</a> of this series of articles, part of Monkey Wrench&#8217;s charter is to provide built in validation of our business objects.  We will need a way to represent a validation rule for our objects.  Validation may take on many forms, so it would be clunky to try and create a one-size-fits-all rule class.  Instead, let&#8217;s create an abstract base class from which to create rule classes that will do their own work.  Over time, you can build a nice library of validators and use them in your projects.  Custom one-off rule classes may be created for elaborate, specific validation tasks that are unique to a specific object.</p>
<p>Our Rule object should inform the user about the particulars of a validation or business rule.  It should also take in some parameters and evaluate the object.</p>
<h2>Properties of the Rule Class</h2>
<ul>
<li><strong>Name </strong>- A unique name to identify the Rule instance in a list.  Example: <em> &#8220;Last Name Length&#8221;</em></li>
<li><strong>DisplayText</strong> &#8211; A full description of the Rule to be displayed in the User Interface at run time.  Example: <em> &#8220;Last Name must be at least 5 characters in length.&#8221;</em></li>
<li><strong>PropertyName </strong>- Name of the property of our business object to which the validation rule instance is attached.  Example:  <em>&#8220;LastName&#8221;.</em></li>
</ul>
<h2>Operations of the Rule Class</h2>
<ul>
<li><strong>IsValid()</strong> &#8211; Returns the result of the validation.</li>
<li><strong>SetRuleValue()</strong> &#8211; Allows for the manual setting of the <strong>IsValid()</strong> value.  We&#8217;ll need this sometimes, but most often our Rule subclass will take care of setting this value.</li>
<li><strong>Validate()</strong> &#8211; An abstract method to be implemented by the subclasses.  This is where the object performs the actual validation.  The object to validate is passed in as a parameter to the Validate() method.</li>
</ul>
<h2>The Rule Class Implementation</h2>
<p>The source file for the the entire framework may be downloaded <a href="http://www.darinboyd.com/wordpress/wp-content/uploads/2009/01/monkeywrench.zip">here</a>.  We&#8217;ll be looking at the <em><strong>Rule.php</strong></em> file.</p>
<p>This following section of code defines our abstract base class and a few protected member variables which may be accessed by our concrete subclasses.  All of the variables were explained earlier with the exception of the <strong>m_PropertyValue </strong>variable.  The <strong>m_PropertyValue</strong> variable is used to contain the actual data represented by the <strong>PropertyName</strong> on the object which is being validated.  So, if you have an object called Person with a LastName property, our subclass would fetch the value stored in Person-&gt;LastName and store that value in <strong>m_PropertyValue</strong>.</p>
<p>Notice that I am using JavaDoc style comments here.  The Doygen documentation tool can generate API documents from these comments.  This is a personal preference, but a useful artifact in your code if you want good documentation.  IDE&#8217;s such as PHPEclipse read these comments in real time and give you more feedback as to what your functions do with tooltips and prompts.</p>
<p>Also, I preface the class level variables with an &#8220;m_&#8221;.  I do this so that it is easy to tell the scope of the variable when you are down in a function.  Modern IDE&#8217;s like PHPEclipse make it easier to track down where a variable is declared.  Having a convention for scope is very handy when you don&#8217;t have a fancy IDE.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #0000ff; font-style: italic;">/**
 * Class representing a business or validation rule. *
 */</span>
abstract <span style="color: #000000; font-weight: bold;">class</span> Rule
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Member Variables</span>
	protected <span style="color: #000088;">$m_Name</span> <span style="color: #339933;">=</span> <span style="">''</span>;
	protected <span style="color: #000088;">$m_DisplayText</span> <span style="color: #339933;">=</span> <span style="">''</span>;
	protected <span style="color: #000088;">$m_PropertyName</span> <span style="color: #339933;">=</span> <span style="">''</span>;
	protected <span style="color: #000088;">$m_PropertyValue</span> <span style="color: #339933;">=</span> <span style="">''</span>;
	protected <span style="color: #000088;">$m_IsValid</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">false</span>;</pre></td></tr></table></div>

<p>The next section has  the &#8220;getters&#8221; and &#8220;setters&#8221; one would expect in Java and other curly brace languages.  It is times like these when I really miss C#.  Maybe one day PHP will have properties.  For the Rule class, this is not required, but I&#8217;m trying to keep reasonable form here.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;">	<span style="color: #666666; font-style: italic;">// Public State Methods</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Unique Name for the rule.
	 *
	 * @return string
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> GetName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">m_Name</span>;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Sets unique Name for the rule.
	 *
	 * @param string $value
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> SetName<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">m_Name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span>;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Name of the Property to be validated.
	 *
	 * @return string
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> GetPropertyName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">m_PropertyName</span>;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Sets the name of the Property to be validated.
	 *
	 * @param string $value
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> SetPropertyName<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">m_PropertyName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span>;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Display text for the rule.
	 * Used to notify the user of the exact purpose of the rule.
	 *
	 * @return string
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> GetDisplayText<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">m_DisplayText</span>;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Sets Display text for the rule.
	 *
	 * @param string $value
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> SetDisplayText<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">m_DisplayText</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span>;
	<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>In the last bit of code, we have the <strong>IsValid() </strong>and <strong>SetRuleValue()</strong> methods described earlier in the article.  There is also a constructor and an abstract declaration for the <strong>Validate()</strong> method.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;">	<span style="color: #0000ff; font-style: italic;">/**
	 * Indicates whether or not the rule has passed validation.
	 *
	 * @return boolean
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> IsValid<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">m_IsValid</span>;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Sets the value of the IsBroken member variable
	 * to the parameter value
	 *
	 * @param  boolean $value
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> SetRuleValue<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">m_IsValid</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span>;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Constructors</span>
&nbsp;
	<span style="color: #0000ff; font-style: italic;">/**
	 * Constructor: sets name and display text.
	 *
	 * @param  string $_name;
	 * @param  string $_displayText;
	 * @param  string $_propertyName;
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_propertyName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_displayText</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">m_Name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_name</span>;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">m_PropertyName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_propertyName</span>;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">m_DisplayText</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_displayText</span>;		
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
	<span style="color: #666666; font-style: italic;">// Abstract Methods</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> abstract <span style="color: #000000; font-weight: bold;">function</span> Validate<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_objectToValidate</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Although our code doesn&#8217;t do very much, we have laid a reasonable foundation from which to build validators.  In the next article, we will use the Rule class to build a validator for string ranges.  Frameworks aren&#8217;t the most exciting things to read about, but I promise that you&#8217;ll be able to see the payoff if you hang in there with me.</p>
<h2>Also Available in This Series</h2>
<ul>
<li><a title="A Business Objects Framework for Wordpress" href="http://www.darinboyd.com/wordpress/2009/01/a-business-objects-framework-for-php-part-1/" target="_blank">A Business Objects Framework for Wordpress</a></li>
<li><a title="Creating a String Range Rule with Monkey Wrench" rel="bookmark" href="http://www.darinboyd.com/wordpress/2009/01/creating-a-string-range-rule-with-monkey-wrench/" target="_blank">Creating a String Range Rule with Monkey Wrench</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.darinboyd.com/wordpress/2009/01/building-monkey-wrench-the-rule-classes/feed/</wfw:commentRss>
		<slash:comments>726</slash:comments>
		</item>
		<item>
		<title>A Business Objects Framework for Wordpress</title>
		<link>http://www.darinboyd.com/wordpress/2009/01/a-business-objects-framework-for-php-part-1/</link>
		<comments>http://www.darinboyd.com/wordpress/2009/01/a-business-objects-framework-for-php-part-1/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 04:12:04 +0000</pubDate>
		<dc:creator>Darin Boyd</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Monkeywrench]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.darinboyd.com/wordpress/?p=5</guid>
		<description><![CDATA[In this series of articles, I will cover the development of a business objects framework written in PHP for the Wordpress blogging platform.  I come from a Java/C++/C# background, so I am quite fond of the benefits of Object Oriented Programming when it comes to validating and persisting data to a database.  The framework  I  [...]]]></description>
			<content:encoded><![CDATA[<p>In this series of articles, I will cover the development of a business objects framework written in PHP for the <a title="Wordpress website link" href="http://www.wordpress.net">Wordpress</a> blogging platform.  I come from a Java/C++/C# background, so I am quite fond of the benefits of Object Oriented Programming when it comes to validating and persisting data to a database.  The framework  I  will construct draws inspiration from my work on other platforms.<span id="more-5"></span>  Some of you who are experienced PHP programmers may think that my approach is strange.  Those of you with any experience with the <a title="CSLA" href="http://www.lhotka.net/cslanet/" target="_blank">CSLA</a> framework may see a lot of similarities in the tutorial framework and older versions of <a title="CSLA" href="http://www.lhotka.net/cslanet/" target="_blank">CSLA</a>.</p>
<h2>Why Build a Framework?</h2>
<p>Frameworks are useful for many reasons. Below is a short list of some of the most common benefits of developing a business objects framework.  For an exhaustive presentation on the rationale for using frameworks as well as a complete discussion of the design of a complete framework, I recommend <a title="Exper C# Business Objects" href="http://www.amazon.com/gp/product/1430210192?ie=UTF8&amp;tag=darinboyd-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1430210192" target="_blank">Expert C# 2008 Business Objects</a>.</p>
<ul>
<li><strong>Separation of Concerns</strong> &#8211; Code for the business logic and persistence details may exist in one or more layers.  This keeps database concerns and business logic out of the UI code.  A layered architecture makes it easier to build a variety of user interfaces for the same code base.</li>
<li><strong>Specialization of Tasks</strong> -   The layered architecture allows people on a team to work on the programming tasks for which they are most suited.  I am a terrible web developer.  I like the fact that I can build a robust core and let the people with black turtlenecks put a slick user interface on top of it.  It is also a relief to designers that they can concentrate on the interface and use a simple, clean API which has been prepared for them by the core programmers.</li>
<li><strong>Coding Standards</strong> &#8211; Frameworks set a good example by helping to establish coding style and methods for all of the developers on a team.  Even when working alone, the establishment of styles and patterns is very helpful and increases productivity.</li>
<li><strong>Collaboration</strong> &#8211; All of the above items result in better collaboration in a team environment.  It is easy to get help from others when you have a clean and easy to follow code base.  New trainees also get up to speed a lot faster in the presence of a framework.  This builds confidence very early for new people and it also means that they are actually helping out on day one.</li>
<li><strong>Code Generation</strong> &#8211; Established style and methodology make it easy to generate a significant percentage of your boring, boiler plate, error prone work using a code generation tool.  It is fairly easy to write code generation tools and there are a few really nice free tools to do the job as well.  We&#8217;ll get in to this in other articles.</li>
</ul>
<h2>What Will Our Framework Do?</h2>
<p>The framework we are going to design will take care of the following tasks.</p>
<ul>
<li><strong>CRUD </strong>- <strong>C</strong>reation, <strong>R</strong>etrieval, <strong>U</strong>pdate and <strong>D</strong>eletion of records in the database.</li>
<li><strong>Validation</strong> &#8211; Our objects will be self validating.  All validation rules for fields and business logic for the entities will be represented as classes.</li>
</ul>
<p>Our framework will be implemented in one layer.  I am creating the framework for use with the Wordpress blogging system, so I&#8217;ll make use of some of the nice database features built in to Wordpress.  The framework may be used outside the Wordpress environment by including the proper files which allow use of <strong>$wpdb</strong>.  For more information of <strong>$wpdb</strong>, go <a title="Wordpress wpdb info" href="http://codex.wordpress.org/wpdb_Class" target="_blank">here</a>.  Of course, you could use another database.  It is also possible to separate the actual data access code into another suite of classes.  This takes a lot of extra work, but it does allow you to swap out your database technology without changing the rest of your code. This approach makes sense if you might switch database platforms.</p>
<p>Before we continue and actually build the framework, we should give it a name. I am tired of typing &#8220;the framework&#8221;.  For a working title, let&#8217;s call it <strong>Monkey Wrench.</strong> My wife, Jana, is rather fond of monkeys, so I&#8217;m sure she would approve.</p>
<h2>Coming Up. Building Monkey Wrench</h2>
<p>In the next article, we will begin building the <strong>Monkey Wrench</strong> framework.  See you next time!</p>
<h2>Also Available in This Series</h2>
<ul>
<li><a title="Building Monkey Wrench - The Rule Classes" rel="bookmark" href="http://www.darinboyd.com/wordpress/2009/01/building-monkey-wrench-the-rule-classes/" target="_blank">Building Monkey Wrench &#8211; The Rule Classes</a></li>
<li><a title="Creating a String Range Rule with Monkey Wrench" rel="bookmark" href="http://www.darinboyd.com/wordpress/2009/01/creating-a-string-range-rule-with-monkey-wrench/" target="_blank">Creating a String Range Rule with Monkey Wrench</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.darinboyd.com/wordpress/2009/01/a-business-objects-framework-for-php-part-1/feed/</wfw:commentRss>
		<slash:comments>553</slash:comments>
		</item>
	</channel>
</rss>
