<?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>skardal.com</title>
	<atom:link href="http://skardal.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://skardal.com</link>
	<description>&#60;insert deep thoughts here&#62;</description>
	<lastBuildDate>Fri, 13 Apr 2012 17:18:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Anagram kata in Scala</title>
		<link>http://skardal.com/2012/04/13/anagram-kata-in-scala/</link>
		<comments>http://skardal.com/2012/04/13/anagram-kata-in-scala/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 17:18:40 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://skardal.com/?p=262</guid>
		<description><![CDATA[I did this code kata some weeks ago at an internal conference at work. I solved it using Scala, and learned quite a bit from repeating the task several times. The source code is available at GitHub.]]></description>
			<content:encoded><![CDATA[<p>I did <a title="Anagram Kata" href="http://codekata.pragprog.com/2007/01/kata_six_anagra.html">this code kata</a> some weeks ago at an internal conference at work. I solved it using Scala, and learned quite a bit from repeating the task several times.</p>
<p>The source code is available at <a href="https://github.com/tskardal/kata_anagrams">GitHub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://skardal.com/2012/04/13/anagram-kata-in-scala/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with Spock</title>
		<link>http://skardal.com/2012/02/11/getting-started-with-spock/</link>
		<comments>http://skardal.com/2012/02/11/getting-started-with-spock/#comments</comments>
		<pubDate>Sat, 11 Feb 2012 12:49:00 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Groovy]]></category>

		<guid isPermaLink="false">http://skardal.com/?p=252</guid>
		<description><![CDATA[Spock is a testing framework. You write tests in Groovy, which results in less code that is more readable. Good! I first heard about Spock on Communities in Action and wanted to take it for a test ride. The problem &#8230; <a href="http://skardal.com/2012/02/11/getting-started-with-spock/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Spock is a testing framework. You write tests in Groovy, which results in less code that is more readable. Good!</p>
<p>I first heard about Spock on <a title="Communities in Action" href="http://cia.cantara.no" target="_blank">Communities in Action</a> and wanted to take it for a test ride. The problem was that I had some trouble getting started as the documentation seemed to be a bit outdated. Here&#8217;s a short summary of what I had to do.</p>
<p>The first obstacle was finding a binary download. I ended up grabbing one from their <a title="Spock build server" href="http://builds.spockframework.org/" target="_blank">build server</a>.</p>
<p>The next step is adding the spock-core-*.jar to your project and enable groovy support. (In Intellij I got a &#8220;dialog&#8221; in the top of my groovy file saying that I had to configure the Groovy SDK.)</p>
<p>Next up is adding a new test class and extend spock.lang.Specification. When the test is written, you can run it as a regular JUnit test.</p>
<p>Sweet!</p>
<p>Here&#8217;s a simple example</p>
<pre class="brush:groovy">
class GLMathTest extends Specification {  

  def "multiplying 4x4 matrix"() {
    given:
    float[] m1 = [
      1, 0, 0, 0,
      1, 1, 0, 0,
      1, 0, 1, 0,
      1, 0, 0, 1,
    ]
    float[] m2 = [
      1, 5, 9, 13,
      2, 6, 10, 14,
      3, 7, 11, 15,
      4, 8, 12, 16
    ]

    when:
    float[] result = GLMath.multiply4x4(m1, m2)

    then:
    result == [
      28, 5, 9, 13,
      32, 6, 10, 14,
      36, 7, 11, 15,
      40, 8, 12, 16
    ]
  }
}</pre>
<p><strong>Resources</strong><br />
Spock &#8211; <a href="http://code.google.com/p/spock/" target="_blank">http://code.google.com/p/spock/<br />
</a>Tutorial #1 - <a href="http://tv.jetbrains.net/videocontent/getting-started-with-spock-and-groovy" target="_blank">http://tv.jetbrains.net/videocontent/getting-started-with-spock-and-groovy<br />
</a>Tutorial #2 &#8211;  <a href="http://tv.jetbrains.net/videocontent/spock-and-mock-object-basics" target="_blank">http://tv.jetbrains.net/videocontent/spock-and-mock-object-basics</a></p>
]]></content:encoded>
			<wfw:commentRss>http://skardal.com/2012/02/11/getting-started-with-spock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scalatra sample application</title>
		<link>http://skardal.com/2011/11/16/scalatra-sample-application/</link>
		<comments>http://skardal.com/2011/11/16/scalatra-sample-application/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 21:21:01 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Scala]]></category>
		<category><![CDATA[scalatra]]></category>

		<guid isPermaLink="false">http://skardal.com/?p=242</guid>
		<description><![CDATA[A lot has happend since last time I wrote a post. I&#8217;ve moved to Oslo, and started working at Bouvet. Which I&#8217;m very pleased with! Recently I gave a short introduction to Scalatra at one of our big internal competence events. &#8230; <a href="http://skardal.com/2011/11/16/scalatra-sample-application/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A lot has happend since last time I wrote a post. I&#8217;ve moved to Oslo, and started working at <a href="http://bouvet.no">Bouvet</a>. Which I&#8217;m very pleased with!</p>
<p>Recently I gave a short introduction to <a href="http://scalatra.org">Scalatra</a> at one of our big internal competence events. The slides weren&#8217;t that good, and in norwegian, so I&#8217;m not planning on publishing them. Anyway. While working on my presentation I ended up writing some sample applications upon github. They&#8217;re available <a href="https://github.com/tskardal/todo-sample">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://skardal.com/2011/11/16/scalatra-sample-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mini &#8220;discovery&#8221;: how to run all tests from within Eclipse!</title>
		<link>http://skardal.com/2010/05/28/run-all-tests-from-within-eclipse/</link>
		<comments>http://skardal.com/2010/05/28/run-all-tests-from-within-eclipse/#comments</comments>
		<pubDate>Fri, 28 May 2010 20:45:14 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://skardal.com/?p=185</guid>
		<description><![CDATA[For quite some time I&#8217;ve been unaware of the possibility to run all JUnit tests from within Eclipse. I thought the only way it could be done (besides using Maven etc) was to manually create test suites. What I&#8217;ve done &#8230; <a href="http://skardal.com/2010/05/28/run-all-tests-from-within-eclipse/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For quite some time I&#8217;ve been unaware of the possibility to run all JUnit tests from within Eclipse. I thought the only way it could be done (besides using Maven etc) was to manually create test suites. What I&#8217;ve done &#8220;wrong&#8221; is just doing a &#8220;Run as JUnit test&#8221; on the <em>packages</em>. Turns out you can also do thins on a <em>source folder</em>, causing every JUnit test in that folder to execute! <img src='http://skardal.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://skardal.com/2010/05/28/run-all-tests-from-within-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Becoming test driven &#8211; the first steps</title>
		<link>http://skardal.com/2010/04/18/becoming-test-driven-the-first-steps/</link>
		<comments>http://skardal.com/2010/04/18/becoming-test-driven-the-first-steps/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 18:13:08 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[OO Design]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://skardal.com/?p=167</guid>
		<description><![CDATA[TDD. The most common meaning of this abbreviation is probably Test Driven Development or Test Driven Design. Simply put, it&#8217;s all about writing test code before writing production code. Why would one like to do that, you may ask? The answer is &#8230; <a href="http://skardal.com/2010/04/18/becoming-test-driven-the-first-steps/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>TDD. The most common meaning of this abbreviation is probably Test Driven Development or Test Driven Design. Simply put, it&#8217;s all about writing test code before writing production code. Why would one like to do that, you may ask? The answer is simple; your code will eventually become a lot better and easier to maintain. Not only for yourself, but for everyone that have to understand and work with your code. I won&#8217;t write a lot about pros and cons, or what it is (Check out the link in the final paragraph!). I&#8217;ll just list a few pointers to how to get started and how to get better. I myself can barely claim to perform TDD, but I strive to get there! So..I don&#8217;t claim to be an expert, I just want to do some TDD advertising <img src='http://skardal.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><strong>Unit tests<br />
<span style="font-weight: normal;">The first thing to do is to actually learn how to write unit tests, and how to do it right. When I first tried to do some work using TDD, after a while I figured out that my tests weren&#8217;t that good. I thought I knew what a unit test was and that I could jump right into it. Turned out that I had some things to learn <img src='http://skardal.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  What&#8217;s a <em>mock</em>? Or a </span><span style="font-weight: normal;"><span style="font-weight: normal;"><em>stub</em></span></span><span style="font-weight: normal;">? What is the difference between a <em>unit test</em> and an <em>integration test</em>? What is meant by Inversion of Control / Dependency Injection? You&#8217;ll find answers to all of these questions by doing a little bit of Google magic. Still, I want to recommend <a href="http://www.artofunittesting.com/">The Art of Unit Testing</a> by Roy Osherove. Though the examples are done using C#, everyone will make use of this book. This book will teach you a lot about unit testing!</span></strong></p>
<p><strong>Test first<br />
<span style="font-weight: normal;">A common problem with unit tests is that the production code is hard to test. There can be many reasons for this, and I guess the most common is dealing with dependencies. Though there are many factors that can affect the testability of code, a common divisor is that code that is <em>hard to test is bad code. </em>One<em> </em>of the advantages when writing the test on beforehand is that you are forced to write the code in a way that is testable! This can be quite difficult to get started with (at least I think it is/was). The only thing to do is practice. Of course, you should also read up a bit on the topic, but in the end I think it&#8217;s all about practice. And if not able to write the test up front, at least write it </span>while <span style="font-weight: normal;">you are working on the code . The book <a href="http://www.amazon.com/dp/0321146530/">Test Driven Development: By Example</a> by Kent Beck is highly recommended!</span></strong></p>
<p><strong>Kata<br />
<span style="font-weight: normal;">One way to practice TDD is to perform so called code <a href="http://en.wikipedia.org/wiki/Kata_(programming)">Kata</a>&#8216;s.  These are exercises that are meant to be done repeatedly. In addition to practicing TDD and test first thinking, you will become better at using your IDE. Some Kata&#8217;s that I know of are <a href="http://osherove.com/tdd-kata-1/">string calculator</a> and <a href="http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata">bowling game</a>.</span></strong></p>
<p><strong>Inspiration<br />
<span style="font-weight: normal;">There is a lot of good resources, books and blogs with content related to TDD. &#8220;Uncle Bob&#8221; has done a lot of  amazing presentations. and I suggest checking out <a href="http://railsconf.blip.tv/file/2089545/">this one</a> (if you&#8217;re in a hurry, jump to ~23:28). I bet it will motivate you to start doing test driven development!</span><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://skardal.com/2010/04/18/becoming-test-driven-the-first-steps/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Michael Feathers visited Kristiansand</title>
		<link>http://skardal.com/2010/02/16/michael-feathers-at-javabin/</link>
		<comments>http://skardal.com/2010/02/16/michael-feathers-at-javabin/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 22:33:05 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[OO Design]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[javaBin]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://skardal.com/?p=155</guid>
		<description><![CDATA[This evening Michael Feathers gave a talk at javaBin Sørlandet, the local Java user group. Michael Feathers is a &#8220;programmer celebrity&#8221; and is perhaps most known as the author of the book Working effectively with legacy code, the author of the C++ unit &#8230; <a href="http://skardal.com/2010/02/16/michael-feathers-at-javabin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://skardal.com/wordpress/wp-content/uploads/legacycode.jpg"><img class="alignright" title="legacycode" src="http://skardal.com/wordpress/wp-content/uploads/legacycode-226x300.jpg" alt="" width="126" height="168" /></a>This evening Michael Feathers gave a talk at javaBin Sørlandet, the local Java user group. Michael Feathers is a &#8220;programmer celebrity&#8221; and is perhaps most known as the author of the book <a title="Working effectively with legacy code" href="http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1266354216&amp;sr=8-1">Working effectively with legacy code</a>, the author of the C++ unit testing framework <a href="http://sourceforge.net/apps/mediawiki/cppunit/index.php?title=Main_Page">CPPUnit</a> and for being one of the <a href="http://www.objectmentor.com/omTeam/feathers_m.html">Object Mentor</a>&#8216;s.</p>
<p>I&#8217;m actually reading the book at the moment, and I find it very good and interesting. Put shortly, it will teach you how to add features to an existing code base (that is not in test harness) in a good way. It contains a lot of typical questions with good answers. Really a lot of useful tips and tricks that will make you a better programmer, and less painful to work with legacy code!</p>
<p>The talk Michael Feathers gave was not on legacy code, but on <em>the synergy between testable code and good design</em>, and it was indeed very interesting! Code that&#8217;s hard to test, is most likely hard to test because the design isn&#8217;t that good. For instance, a widely asked question is how to test private methods. There are lots of answers to this, but one of the solutions to his example was to extract the code into a new class. The reason for this was separation of concerns. By following the Single Responsibility Principle (SRP), we get classes that in most cases are easy to understand, and also easy to test. Also, as he quoted Robert Martin (Uncle Bob) on that when a class has a single responsibility, there is only one reason for it to change.</p>
<p>Feathers also drew a line from how software design got better when separating the concerns and making more, but simpler classes, with how our brain is working and how we find it easier to understand and remember things when they are less complex. Two dependencies are way better than five!</p>
<p>Another good point (based on a quote from some guy I don&#8217;t remember the name of) was that the people that find simplifying a system unnecessary is most often the system expert. The guys who live in the code base all day long, and now every corner of it. Though this may be OK for them, a developer that never has seen the code before will most likely have to spend hours, days, weeks or months in it before her/she gets a good overview and gets comfortable adding features or making changes. It&#8217;s clearly that a simpler design is a better design!</p>
<p><strong>Disclaimer: </strong><br />
This is not meant to be a complete summary of the talk that was given on today&#8217;s meeting, but more like a teaser for you, and note to self for me <img src='http://skardal.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  I might as well also have expressed something in a different way, and not necessariliy 100% correct. But anyway, it was fun to attend, and I&#8217;ll continue on my path towards becoming better at TDD and good design.</p>
]]></content:encoded>
			<wfw:commentRss>http://skardal.com/2010/02/16/michael-feathers-at-javabin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Groovy++ ?</title>
		<link>http://skardal.com/2010/02/07/some-more-jvm-stuff/</link>
		<comments>http://skardal.com/2010/02/07/some-more-jvm-stuff/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 12:55:22 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[podcast]]></category>

		<guid isPermaLink="false">http://skardal.com/?p=147</guid>
		<description><![CDATA[Just a short Sunday blog post I just noticed a link popping up on Twitter from @DZone with the message; &#8220;Will Groovy spell the end of Scala?&#8221;. Following the link it turned out that it actually wasn&#8217;t Groovy, but Groovy++. &#8230; <a href="http://skardal.com/2010/02/07/some-more-jvm-stuff/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just a short Sunday blog post <img src='http://skardal.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I just noticed a link popping up on Twitter from <a href="http://twitter.com/DZone">@DZone</a> with the message; &#8220;Will Groovy spell the end of Scala?&#8221;. Following the link it turned out that it actually wasn&#8217;t Groovy, but Groovy++. Groovy++ introduces static typing without losing the dynamic benefits and powers. Read more in the <a href="http://bluetrainsoftware.blogspot.com/2010/02/will-groovy-spell-end-of-scala.html">blog post </a> and also check out <a href="http://groovy.dzone.com/articles/sneak-peak-groovy-what-it-why">this article</a> on Groovy++.</p>
<p>In the blog post there is also a link to a podcast show named <a href="http://www.illegalargument.com/">Illegal Argument</a>. This show is discussing topics related to Java and the JVM. I haven&#8217;t listened to it yet,  but I will!</p>
]]></content:encoded>
			<wfw:commentRss>http://skardal.com/2010/02/07/some-more-jvm-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Groovy</title>
		<link>http://skardal.com/2010/02/06/getting-groovy/</link>
		<comments>http://skardal.com/2010/02/06/getting-groovy/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 21:40:37 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[griffon]]></category>
		<category><![CDATA[pivot]]></category>
		<category><![CDATA[podcast]]></category>

		<guid isPermaLink="false">http://skardal.com/?p=135</guid>
		<description><![CDATA[Lately I&#8217;ve tried out the Grails framework a bit for a little pet project. It started with a little peek on Groovy, and then after a little messing around with the &#8220;getting started&#8221; part, I wanted to check out grails &#8230; <a href="http://skardal.com/2010/02/06/getting-groovy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve tried out the <a href="http://grails.org">Grails framework</a> a bit for a little pet project. It started with a little peek on <a href="http://groovy.codehaus.org">Groovy</a>, and then after a little messing around with the &#8220;getting started&#8221; part, I wanted to check out grails as well. I must say it was very pleasant to work with!</p>
<p>Though it was a very little project I did with Grails, I think ihas potential. I really like the way everything is done by convention, and the plugins just makes it incredible simple to have a lot of functionality up and running in no time! Security, searching and JMS just to mention a few. Check out the <a href="http://www.grails.org/plugin">plugin portal</a> if you are curious. One more thing I find cool is that you can run Grails applications on Google App Engine. This is done very easily by using a plugin!</p>
<p>I also noticed a project named <a href="http://griffon.codehaus.org/">Griffon</a> which is a Grails like framework for developing desktop applications in Groovy. I haven&#8217;t tried it out, but it seems interesting. As I read about Griffon I also got aware of the UI toolkits <a href="http://www.eclipse.org/swt/">SWT</a> and <a href="http://pivot.apache.org/">Pivot</a>. Frankly I did only know of AWT and Swing, but the next time I decide to write a GUI app in Java or Groovy, I&#8217;ll definitely consider trying out one of these <img src='http://skardal.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Finally, some groovy and grails resources.</p>
<p><a href="http://grailstutorials.com">http://grailstutorials.com</a> &#8211; The design is crap, but there are a lot of tutorials)<br />
<a href="http://grailspodcast.com/blog/list"> http://grailspodcast.com/blog/list</a> &#8211; Interesting podcasts with the latest grails/groovy news<br />
<a href="http://goo.gl/uTEM"> http://goo.gl/uTEM</a> &#8211; An article on groovy meta programming (there&#8217;s a lot of groovy stuff on the same site)</p>
]]></content:encoded>
			<wfw:commentRss>http://skardal.com/2010/02/06/getting-groovy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BDD &#8211; Behaviour Driven Development</title>
		<link>http://skardal.com/2010/01/30/bdd-behaviour-driven-development/</link>
		<comments>http://skardal.com/2010/01/30/bdd-behaviour-driven-development/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 14:25:23 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[bdd]]></category>

		<guid isPermaLink="false">http://skardal.com/?p=127</guid>
		<description><![CDATA[When I first was reading about Behaviour Driven Development, I just thought of it as a different way of naming tests. Just giving the test a name that describes the behaivour that it will cover. This is not exactly right &#8230; <a href="http://skardal.com/2010/01/30/bdd-behaviour-driven-development/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When I first was reading about Behaviour Driven Development, I just thought of it as a different way of naming tests. Just giving the test a name that describes the behaivour that it will cover. This is not exactly right for what I&#8217;ve learned now. I might write more about it later, but for now I&#8217;ll just list a couple of resources that I&#8217;ve found.</p>
<p><strong>What exactly is BDD? </strong></p>
<p>Read Dan North&#8217;s intorduction <a href="http://dannorth.net/introducing-bdd">here</a>. Also, you should take a look at Rob Conery&#8217;s <a href="http://blog.wekeroad.com/2009/05/14/kona-3">introduction screencast</a>.</p>
<p><strong>Frameworks</strong></p>
<p>To get the most out of BDD I think a framework is necessary. There exist a lot of frameworks that let you write a textual specification of features/scenarios. The framework then analyse them and require you to write a set of test to cover what you&#8217;ve specified and give you output telling you if the tests are failing or successful. This way you get a test suite that&#8217;s readable for a person that don&#8217;t know anything about programming.</p>
<p>The first framework I ever saw in action is <a href="http://jbehave.org">JBehave</a> (note that the actual navigation is way down at the bottom of the page(!?)). This also have a .NET implementation called <a href="http://nbehave.org">NBehave</a>. I started out with JBehave, but as I didn&#8217;t find that much documentation for it, I started looking for alternatives. I then came over <a href="http://cukes.info">Cucumber</a>. This is a Ruby framework which seem to be used widely, and also have a lot of documentation and examples. Though this is a Ruby framework, it is possible to use it with a lot of different languages. For instance <em>cuke4duke</em> and  JRuby opens the door to a lot of languages running on the JVM, and there is also a .NET version called <em>cuke4nuke</em>.</p>
<p>Currently I&#8217;m trying out cuke4duke with Java. I found the <a href="http://github.com/aslakhellesoy/cuke4duke/tree/master/examples">examples</a> very helpful to get started with Java and Maven</p>
]]></content:encoded>
			<wfw:commentRss>http://skardal.com/2010/01/30/bdd-behaviour-driven-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat + Apache (+ Grails)</title>
		<link>http://skardal.com/2010/01/24/tomcat-apache-grails/</link>
		<comments>http://skardal.com/2010/01/24/tomcat-apache-grails/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 13:38:09 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ajp]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://skardal.com/?p=111</guid>
		<description><![CDATA[I&#8217;ve spent quite some time on deploying my first grails application to a Tomcat server, and get the setup just the way I want it. I thought that writing a small tutorial on how to do it was a good &#8230; <a href="http://skardal.com/2010/01/24/tomcat-apache-grails/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent quite some time on deploying my first grails application to a Tomcat server, and get the setup just the way I want it. I thought that writing a small tutorial on how to do it was a good idea, as I then have it for later use, and perhaps someone else can have good use of it. The grails part of this is not very important, as it will be just the same for Java applications. I don&#8217;t claim this to be the ultimate(or even correct) setup, but at least it is working the way I want it to. Feel free to comment!</p>
<p>Deploying a grails application to Tomcat is actually quite easy. Just create a <em>war file</em>, and place it in the <em>webapps</em> folder.</p>
<p>To create a war with production environment settings issue the command</p>
<pre>grails prod war</pre>
<p>When placing this in the webapps folder, Tomcat will automatically unpack the war to a folder with the same name. You can access it at http://server.address:8080/appname (8080 is the default listen port). For some cases this might be good enough. If you on the other hand want to access the webapp without having to specify both the port number and the application name, you want some kind of virtual hosting.</p>
<p>In my case I wanted to access the application from a domain name. I don&#8217;t have much experience with either tomcat or apache configuration, but I knew how to set up a name based virtual host on apache. Name based means that Apache interprets the incoming request and decides what to serve it based on the domain name. In addition to this we can also set up a name based virtual host on Tomcat. Having this we just need some kind of connection between Tomcat and Apache. This way Apache becomes the entry point, while Tomcat is the application server. Let&#8217;s start!</p>
<p>In this example I&#8217;m using a Ubuntu server, Tomcat 6.0 and Apache 2.2</p>
<p><strong>Set up a virtual host in Apache and load the necessary modules</strong></p>
<p>Create a new file in /etc/apache2/sites-available/ and name it after the domain name. Edit it, and write something like this:</p>
<pre class="brush:xml">  &lt;VirtualHost *:80&gt;
    ServerName domain.com
    ProxyPass / ajp://localhost:8009/
  &lt;/VirtualHost&gt;</pre>
<p>This will redirect all incoming requests for domain.com to Tomcat. AJP is a protocol used to connect Tomcat and Apache, and 8009 is the default port. Read more <a href="http://en.wikipedia.org/wiki/Apache_JServ_Protocol">here</a> or google it. AJP depends on the mod_proxy, but (at least on my system) when you enable mod_proxy_ajp mod_proxy will be enabled automatically.</p>
<pre>sudo a2enmod proxy_ajp</pre>
<p>When we&#8217;re at it, you also have to enable your new site (the one we defined in sites-available)</p>
<pre>sudo a2ensite name-of-site (the filename you chose some steps ago)</pre>
<p>Note that it now also is listed under <em>sites-enabled. </em>Now we&#8217;ll continue with configuring Tomcat.</p>
<p><strong>Tomcat configuration</strong></p>
<p>There isn&#8217;t too much to be done with Tomcat. Open server.xml in &lt;tomcat-dir&gt;/conf/. First find the AJP connector line, and uncomment it if it&#8217;s currently active. Then scroll to the bottom, (or wherever your &lt;/Engine&gt; tag is. Inside it add a new name basd host like this:</p>
<pre class="brush:xml"> &lt;!-- Uncomment this line --&gt;
 &lt;Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /&gt;

 &lt;Engine&gt;
    &lt;!-- *snip* --&gt;
    &lt;Host name="domain.com" appBase="webapps/appName"&gt;
        &lt;Context path="" docBase="." /&gt;
    &lt;/Host&gt;
  &lt;/Engine&gt;</pre>
<p>Now we&#8217;re ready, and hopefully everything works! Remember to restart both apache and tomcat!</p>
<p><strong>Resources</strong></p>
<p><strong><span style="font-weight: normal;"><a href="http://oreilly.com/java/archive/tomcat-tips.html">http://oreilly.com/java/archive/tomcat-tips.html</a></span></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://skardal.com/2010/01/24/tomcat-apache-grails/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

