<?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>Conceptric &#187; tdd</title>
	<atom:link href="http://www.conceptric.co.uk/tag/tdd/feed" rel="self" type="application/rss+xml" />
	<link>http://www.conceptric.co.uk</link>
	<description>Ideas and Applications</description>
	<lastBuildDate>Fri, 12 Aug 2011 13:00:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Programming from a different angle</title>
		<link>http://www.conceptric.co.uk/programming-from-a-different-angle.htm</link>
		<comments>http://www.conceptric.co.uk/programming-from-a-different-angle.htm#comments</comments>
		<pubDate>Fri, 15 Feb 2008 21:25:52 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[simpletest]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.jameswhinfrey.co.uk/programming-from-a-different-angle.htm</guid>
		<description><![CDATA[I don&#8217;t feel I&#8217;ve got the programming experience I&#8217;d like for my future plans. So, I&#8217;ve got one of those personal project &#8212; the type that you never seem to get round to &#8212; in mind to provide me with a good workout. Which programming platform to use for the server-side application? Whilst I have [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t feel I&#8217;ve got the programming experience I&#8217;d like for my future plans. So, I&#8217;ve got one of those personal project &#8212; the type that you never seem to get round to &#8212; in mind to provide me with a good workout.</p>

<p>Which programming platform to use for the server-side application? Whilst I have to admit that I&#8217;m not the greatest fan of PHP, it&#8217;s definitely the best option. Why? Because I need to run this application locally on a minimal server and PHP is available wherever you find Apache, and the skills should have some commercial value.</p>

<p>I&#8217;ve recently read a great deal about agile development, <abbr title="Test Driven Development">TDD</abbr> and employing software design patterns. As part of this project I&#8217;d like to apply some of what I&#8217;ve learned.</p>

<h3>A test framework.</h3>

<p>Now I&#8217;m going to need a testing framework, and I&#8217;ve gone for <a href="http://simpletest.org/">SimpleTest</a>. This framework not only provides unit testing, but the ability to create tests for web pages. I prefer to run my test suites from the command line, which is relatively easy to arrange with the TextReporter object. I&#8217;ve combined the whole thing with <a href="http://ant.apache.org/">Apache Ant</a> to automate most of the tasks in the project, including deployment.</p>

<p>Unfortunately, it appears that SimpleTest doesn&#8217;t play particularly well with PHP5, although they&#8217;re in the process of making the transition.</p>

<p>I&#8217;ve encountered the mass of error messages generated as the result of <code>E_STRICT</code>. This is easily solved by using a customised php.ini file as an option at the command prompt when executing the test code. Once this is done you can see the actual test messages!</p>

<p>A more significant problem is that the Mock object code cannot be called as static class methods in the way the documentation suggests. A little snooping through the code leads me to think that it&#8217;s due to PHP4 without the <code>static</code> keyword in the method headers required by PHP5. I don&#8217;t have a work-round for this, and I don&#8217;t want to have to alter all this code. I hope they address this as the transition to PHP5 continues, but at the moment my code is simple enough for me to write my own mocks.</p>

<p>When all is said and done, if you know how to use any of the xUnit test frameworks, SimpleTest is very easy to set-up and use.</p>

<h3>Driving with tests.</h3>

<p>Simple the tests may be, but using them to steer the direction of your coding effort takes a different mindset. The hardest part is learning which questions to ask when developing your tests. Asking the right questions about functionality will result in clean, precise code.</p>

<p>There&#8217;s always a temptation add just a little more functionality, but resist it. The point is to remain in control of the code at all times. When it&#8217;s not working, it must be because you&#8217;ve added new tests describing new functionality. The code should never contain functionality that hasn&#8217;t been demanded by a test. Good refactoring can produce beautiful code without breaking the tests &#8212; still in control.</p>

<p>I think I&#8217;m getting the hang of it in relatively simple cases, but there&#8217;s much more to learn. I&#8217;ve found it a very liberating way to develop software, whilst remaining in total control &#8212; you are using version control?</p>

<h3>Patterns in the code</h3>

<p>Whilst there are loads of <abbr title="Model&#8212;View&#8212;Controller">MVC</abbr> based frameworks out there, I want to know how it works first hand. This topic is worth an article of it&#8217;s own, and that&#8217;s what I&#8217;ll give it.</p>

<p>There&#8217;s a good chance that the core application model will need to implement a facade pattern, but lets not make any assumptions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/programming-from-a-different-angle.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

