<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>JoergM.com</title>
	
	<link>http://www.joergm.com</link>
	<description>Agile software development and more by Joerg Mueller</description>
	<lastBuildDate>Sun, 14 Feb 2010 11:08:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Joergmcom" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="joergmcom" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Ten years ago …</title>
		<link>http://www.joergm.com/2010/02/ten-years-ago/</link>
		<comments>http://www.joergm.com/2010/02/ten-years-ago/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 11:08:09 +0000</pubDate>
		<dc:creator>Joerg</dc:creator>
				<category><![CDATA[history]]></category>
		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://www.joergm.com/?p=330</guid>
		<description><![CDATA[This is really a fun exercise.  Just try to remember the situation as it was ten years ago. You can do this for several topics, but as this is a technology blog I will focus on technology. Beside of fun it has some nice side effects like improving your long term memory or giving you [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joergm.com%2F2010%2F02%2Ften-years-ago%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joergm.com%2F2010%2F02%2Ften-years-ago%2F&amp;source=JoergM&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>This is really a fun exercise.  Just try to remember the situation as it was ten years ago. You can do this for several topics, but as this is a technology blog I will focus on technology. Beside of fun it has some nice side effects like improving your long term memory or giving you a better feeling how fast things are really moving. That&#8217;s something which is easily missed if you only look at short term events. And if you forget this you might be surprised by things happening faster than you thought.</p>
<p>So here are my points. They are completely from my memory and not guaranteed to be accurate.  This will of course describe the situation where I lived, which was in Germany.</p>
<p>Ten years ago &#8230;</p>
<p><strong>Hardware</strong></p>
<ul>
<li>My<strong> </strong>private<strong> PC</strong> was a 233 Mhz Pentium with about 64 MB of Ram and a 6 GB HD. At this time it was already more than 2 years old. I think a good PC at this time would have had a 600 Mhz Pentium 2. It used Windows ME, which was still DOS based but the only possible choice if you wanted to occasionally play a game. I had a second partition with SUSE Linux, but just to experiment. Using it as the primary desktop OS would have been a masochistic experience.</li>
<li>My<strong> </strong>business<strong> Notebook</strong> was a Compaq  with something between 300 and 400 Mhz, a 13 inch Display and about 4 GB hard drive. That was pretty good at this time. Buying a notebook like this for private use was unlikely as they were priced at about 7000 Deutsche Mark (ca. 3500 Euro)  each. The <strong>Euro</strong> was not used 10 years ago, but price tags already had to include it.</li>
<li><strong>Apple</strong> started to become popular again. The iMac (the colored one with a CRT Screen) was the first Mac that was available in general electronic stores (like Media Markt) in Germany. It still used System 9. I thought it might be a nice toy for my girlfriend, but for serious computing?</li>
<li>Speaking of <strong>CRT</strong>. This was the dominant Display technology. A 17 inch display with a screen resolution of 1024 * 768 was the standard. The first 15 inch <strong>LCD</strong> Displays were available but they were ridiculous expensive and were only useful for showing static pictures. As soon as something started to move on the screen you did know you just burned money.</li>
</ul>
<p><strong>Internet</strong></p>
<ul>
<li>My <strong>Internet Connection</strong> at home was an ISDN line. (64 kBit up and down) This at least allowed to get a phone call, while browsing the net at the same time.</li>
<li>I think at about this time I ordered my first <strong>DSL</strong>. I had to wait more than one year to get it. Transfer rates of 768 kBit download  and 128 kBit upload were revolutionary at this time. Even more important was the <strong>flat rate</strong>, as you usually had to pay per minute.</li>
<li><strong>Google</strong> was the new kid on the block. Beside better search results it had a revolutionary interface. Just a search box and a logo. All other search engines (Altavista, Excite, Lycos …) tried to be portals to the internet including news, ads and much more. They sometimes took minutes to load on a dial-up connection.</li>
</ul>
<p><strong>Mobile technology</strong></p>
<ul>
<li><strong>Mobile Phones</strong> just started to become popular for the masses. Until then they were seen as status symbols. I had two phones at this time a Siemens S25 as company phone and a C25 as private. The S25 even had a color display (the only one on the market). It had stunning 4 colors.</li>
<li><strong>SMS</strong> just started too. People learnt how to use this strange 160 character message thing. It was priced 0.39 DM each. There are still phone providers today that charge 0.19 Euro, which is even a bit more expensive than 10 years ago.</li>
<li><strong>Mobile data transfer</strong> was only possible in GSM-dailup-mode which meant 9600 bit/s up- and download. The first GPRS-phones which allowed package oriented transfer and 48.000 bit/s download were available about a year later.</li>
<li><strong>Palm PDAs</strong> were wildly successful in Business. It was a status symbol to have one. The Palm V had a really nice design, but had a monochrome LCD Display. The latest invention was the Palm IIIc which was the first to have a color display (240*240 and 256 colors). I had one and the most annoying thing was that you could not read anything on this display when you were outside.</li>
</ul>
<p><strong>Consumer electronics</strong></p>
<ul>
<li>Most people used <strong>CD-Players</strong> for listening to music. Portable CD-Players were pretty common.</li>
<li>There were the first dedicated <strong>MP3</strong> Players. But they used Flash-RAM which was very expensive. A 64 Mbyte Compact Flash card did cost about 500 Deutsche Mark (ca. 300 Dollars) and did not store more music than a CD. That was not really a competition for CD-Players or even the classic Walkman.</li>
<li><strong>TVs</strong> were usually CRT. There were the first flatscreens based on plasma technology. But they were priced at the same range as a small car. A lot of the CRT TVs were already 16:9. But you needed several strong men to move one. Some of these monsters had more than 100 kg.</li>
</ul>
<p><strong>Software and Programming</strong></p>
<ul>
<li><strong>Java</strong> was a huge hype. It was used in a lot of places, especially on the server side. It was not very successful on the desktop. (Deja vu?) Java was also recognized as being very slow. Which is funny because today many people compare new programming languages like Groovy, Scala or even Ruby to Java as the benchmark.</li>
<li>Java already had some <strong>IDEs.</strong> I think the most prominent was the Borland JBuilder. Things like automated refactoring were still unknown.</li>
<li>There were some rumors about a strange thing called <strong>Extreme Programming</strong>. Those guys were supposed to call programming the most important thing when creating software. Scary!</li>
<li><strong>Open Sourc</strong><strong>e</strong> software was used in some companies. Especially as web servers. It was ok to use it for this unimportant piece of infrastructure. But using open source for some mission critical stuff would still have been a revolution.</li>
</ul>
<p>I could write on for hours but that&#8217;s probably enough for now. I hope you enjoyed reading this as much as I enjoyed writing. Please share your own memories about ten years ago in the comments or on your own blog!</p>




	<a rel="nofollow"  href="http://twitter.com/home?status=Ten%20years%20ago%20...%20-%20http%3A%2F%2Fwww.joergm.com%2F2010%2F02%2Ften-years-ago%2F" title="Twitter"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.joergm.com%2F2010%2F02%2Ften-years-ago%2F&amp;title=Ten%20years%20ago%20...&amp;notes=This%20is%20really%20a%20fun%20exercise.%20%C2%A0Just%20try%20to%20remember%20the%20situation%20as%20it%20was%20ten%20years%20ago.%20You%20can%20do%20this%20for%20several%20topics%2C%20but%20as%20this%20is%20a%20technology%20blog%20I%20will%20focus%20on%20technology.%20Beside%20of%20fun%20it%20has%20some%20nice%20side%20effects%20like%20improving%20y" title="del.icio.us"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.joergm.com%2F2010%2F02%2Ften-years-ago%2F&amp;title=Ten%20years%20ago%20..." title="DZone"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.joergm.com%2F2010%2F02%2Ften-years-ago%2F&amp;title=Ten%20years%20ago%20..." title="Reddit"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.joergm.com%2F2010%2F02%2Ften-years-ago%2F&amp;t=Ten%20years%20ago%20..." title="HackerNews"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.joergm.com%2F2010%2F02%2Ften-years-ago%2F&amp;title=Ten%20years%20ago%20...&amp;annotation=This%20is%20really%20a%20fun%20exercise.%20%C2%A0Just%20try%20to%20remember%20the%20situation%20as%20it%20was%20ten%20years%20ago.%20You%20can%20do%20this%20for%20several%20topics%2C%20but%20as%20this%20is%20a%20technology%20blog%20I%20will%20focus%20on%20technology.%20Beside%20of%20fun%20it%20has%20some%20nice%20side%20effects%20like%20improving%20y" title="Google Bookmarks"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.joergm.com%2F2010%2F02%2Ften-years-ago%2F&amp;title=Ten%20years%20ago%20...&amp;bodytext=This%20is%20really%20a%20fun%20exercise.%20%C2%A0Just%20try%20to%20remember%20the%20situation%20as%20it%20was%20ten%20years%20ago.%20You%20can%20do%20this%20for%20several%20topics%2C%20but%20as%20this%20is%20a%20technology%20blog%20I%20will%20focus%20on%20technology.%20Beside%20of%20fun%20it%20has%20some%20nice%20side%20effects%20like%20improving%20y" title="Digg"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.joergm.com%2F2010%2F02%2Ften-years-ago%2F" title="Technorati"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Ten%20years%20ago%20...&amp;url=http%3A%2F%2Fwww.joergm.com%2F2010%2F02%2Ften-years-ago%2F" title="Slashdot"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" /></a>
	<a rel="nofollow"  href="mailto:?subject=Ten%20years%20ago%20...&amp;body=http%3A%2F%2Fwww.joergm.com%2F2010%2F02%2Ften-years-ago%2F" title="email"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.joergm.com/2010/02/ten-years-ago/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why all programmers should blog</title>
		<link>http://www.joergm.com/2010/01/why-all-programmers-should-blog/</link>
		<comments>http://www.joergm.com/2010/01/why-all-programmers-should-blog/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 09:11:35 +0000</pubDate>
		<dc:creator>Joerg</dc:creator>
				<category><![CDATA[agile]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[clean code]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.brainoutprintln.com/?p=298</guid>
		<description><![CDATA[There are some obvious reasons why you should start blogging when you are a programmer. Most of them also apply to everybody else: You share your knowledge. This is a benefit for all of us. If everybody would be blogging about all the little issues they had then a Google-Search would help us even more. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joergm.com%2F2010%2F01%2Fwhy-all-programmers-should-blog%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joergm.com%2F2010%2F01%2Fwhy-all-programmers-should-blog%2F&amp;source=JoergM&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>There are some obvious reasons why you should start blogging when you are a programmer. Most of them also apply to everybody else:</p>
<ul>
<li>You share your knowledge. This is a benefit for all of us. If everybody would be blogging about all the little issues they had then a Google-Search would help us even more. I am sure nearly every problem in the world is already solved. It is just not written down.</li>
<li>It&#8217;s a kind of self marketing. A potential employer can get a much better picture of your abilities than he could from CVs or references. When I hire somebody it is already a huge plus for him when he has a blog at all.</li>
<li>Explaining things to other people is the best way to learn. You can only teach what you fully understand. This is at least as efficient as hands on experience.</li>
<li>You might even make some money with blogging. There are several sites about this. If you are interested look <a title="here" href="http://www.copyblogger.com/" target="_blank">here</a> or <a title="here" href="http://www.problogger.net/" target="_blank">here</a>.</li>
</ul>
<p>But the main reason is something else. Some years ago I read an article about software documentation. There was a lot of wisdom in it, but one phrase sticked to my brain:</p>
<p><em>Programming is doing something weird to your brain. When you write a piece of documentation right after a programming session the result is likely to be barely readable for human beings</em>.</p>
<p>If that&#8217;s true then the opposite should work too.  Blogging teaches you to write for people, which is exactly what you should do in your code. Good code needs to be easy to understand to be easy to maintain. There are whole books about this like the famous <a title="Clean Code" href="http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1264841558&amp;sr=8-1" target="_blank">Clean Code</a> by Uncle Bob.</p>
<p>I think blogging does something weird to your brain, that makes your code better readable for human beings. So:</p>
<p><strong>If you want to become a better programmer, start blogging!</strong></p>




	<a rel="nofollow"  href="http://twitter.com/home?status=Why%20all%20programmers%20should%20blog%20-%20http%3A%2F%2Fwww.joergm.com%2F2010%2F01%2Fwhy-all-programmers-should-blog%2F" title="Twitter"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.joergm.com%2F2010%2F01%2Fwhy-all-programmers-should-blog%2F&amp;title=Why%20all%20programmers%20should%20blog&amp;notes=There%20are%20some%20obvious%20reasons%20why%20you%20should%20start%20blogging%20when%20you%20are%20a%20programmer.%20Most%20of%20them%20also%20apply%20to%20everybody%20else%3A%0D%0A%0D%0A%09You%20share%20your%20knowledge.%20This%20is%20a%20benefit%20for%20all%20of%20us.%20If%20everybody%20would%20be%20blogging%20about%20all%20the%20little%20issu" title="del.icio.us"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.joergm.com%2F2010%2F01%2Fwhy-all-programmers-should-blog%2F&amp;title=Why%20all%20programmers%20should%20blog" title="DZone"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.joergm.com%2F2010%2F01%2Fwhy-all-programmers-should-blog%2F&amp;title=Why%20all%20programmers%20should%20blog" title="Reddit"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.joergm.com%2F2010%2F01%2Fwhy-all-programmers-should-blog%2F&amp;t=Why%20all%20programmers%20should%20blog" title="HackerNews"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.joergm.com%2F2010%2F01%2Fwhy-all-programmers-should-blog%2F&amp;title=Why%20all%20programmers%20should%20blog&amp;annotation=There%20are%20some%20obvious%20reasons%20why%20you%20should%20start%20blogging%20when%20you%20are%20a%20programmer.%20Most%20of%20them%20also%20apply%20to%20everybody%20else%3A%0D%0A%0D%0A%09You%20share%20your%20knowledge.%20This%20is%20a%20benefit%20for%20all%20of%20us.%20If%20everybody%20would%20be%20blogging%20about%20all%20the%20little%20issu" title="Google Bookmarks"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.joergm.com%2F2010%2F01%2Fwhy-all-programmers-should-blog%2F&amp;title=Why%20all%20programmers%20should%20blog&amp;bodytext=There%20are%20some%20obvious%20reasons%20why%20you%20should%20start%20blogging%20when%20you%20are%20a%20programmer.%20Most%20of%20them%20also%20apply%20to%20everybody%20else%3A%0D%0A%0D%0A%09You%20share%20your%20knowledge.%20This%20is%20a%20benefit%20for%20all%20of%20us.%20If%20everybody%20would%20be%20blogging%20about%20all%20the%20little%20issu" title="Digg"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.joergm.com%2F2010%2F01%2Fwhy-all-programmers-should-blog%2F" title="Technorati"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Why%20all%20programmers%20should%20blog&amp;url=http%3A%2F%2Fwww.joergm.com%2F2010%2F01%2Fwhy-all-programmers-should-blog%2F" title="Slashdot"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" /></a>
	<a rel="nofollow"  href="mailto:?subject=Why%20all%20programmers%20should%20blog&amp;body=http%3A%2F%2Fwww.joergm.com%2F2010%2F01%2Fwhy-all-programmers-should-blog%2F" title="email"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.joergm.com/2010/01/why-all-programmers-should-blog/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Scripting magic with Groovy, Grape and Jetty</title>
		<link>http://www.joergm.com/2009/12/scripting-magic-with-groovy-grape-and-jetty/</link>
		<comments>http://www.joergm.com/2009/12/scripting-magic-with-groovy-grape-and-jetty/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 15:56:29 +0000</pubDate>
		<dc:creator>Joerg</dc:creator>
				<category><![CDATA[groovy]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[Jetty]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://www.brainoutprintln.com/?p=276</guid>
		<description><![CDATA[Groovy 1.7 has just been release and it&#8217;s time to play again. One of the new features, Grape inspired me to the try the following. I created a script that acts as a simple webserver using embedded jetty without the need to install anything else than Groovy 1.7 on your computer. Just save the script [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F12%2Fscripting-magic-with-groovy-grape-and-jetty%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F12%2Fscripting-magic-with-groovy-grape-and-jetty%2F&amp;source=JoergM&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Groovy 1.7 has just been release and it&#8217;s time to play again. One of the new features, <a href="http://groovy.codehaus.org/Grape">Grape</a> inspired me to the try the following. I created a script that acts as a simple webserver using embedded jetty without the need to install anything else than Groovy 1.7 on your computer. Just save the script as simpleWebServer, make it executable and start it like </p>
<pre class="brush: plain;">
./simpleWebServer -d someDirWithHTMLFiles -p 9000
</pre>
<p>Surf to http://localhost:9000 and you will see. </p>
<p>Here is the full script. I will explain the details further down.</p>
<pre class="brush: groovy;">
#!/usr/bin/env groovy

@Grab('org.mortbay.jetty:jetty:6.1.22')
import org.mortbay.jetty.*;
import org.mortbay.jetty.handler.*

def cli = new CliBuilder (usage:'simpleHtmlServer -p PORT -d DIRECTORY')
cli.with {
 h longOpt:'help', 'Usage information'
 p longOpt:'port',argName:'port', args:1, type:Number.class,'Default is 8080'
 d longOpt:'dir', argName:'directory', args:1, 'Default is .'
}

def opts = cli.parse(args)
if(!opts) return
if(opts.help) {
  cli.usage()
  return
}

def server = new Server(opts.port.toInteger()?:8080)
def resourceHandler = new ResourceHandler(welcomeFiles:[&quot;index.html&quot;],
                                         resourceBase:opts.dir?:&quot;.&quot;)
server.handler = new HandlerList(handlers:[resourceHandler, new DefaultHandler()])

server.start()
server.join()
</pre>
<p>Here are the magic details about the script:</p>
<p><strong>1. The Shebang</strong></p>
<p>The first important thing about this script is the shebang. </p>
<pre class="brush: groovy;">
#!/usr/bin/env groovy
</pre>
<p>If you are using a real operating system (sorry Windows users), this will let you start the script like a normal executable. I usually skip the .groovy appendix on script files, so it really feels like you are using a normal command line utility.</p>
<p><strong>2. Grape</strong></p>
<p>The next line uses the new feature of Groovy 1.7, called Grape. This is a dependency System that allows to load any dependency, that is available in the maven-repositories to be used inside a script.</p>
<pre class="brush: groovy;">@Grab('org.mortbay.jetty:jetty:6.1.22')</pre>
<p>The syntax is pretty easy. It uses the maven notation: groupId:artifactId:version. There is an alternative version that uses separate attributes for each but I prefer the shortcut.<br />
This line will lookup the dependency in the maven repository, download it and store it in ~/.groovy/grape. So the first start of the script might take a moment. The second time will be faster.<br />
Grape allows to use the full java ecosystem in a simple groovy script without any additional install. Groovy 1.7 is enough. I think this makes scripting in groovy incredible powerful.</p>
<p><strong>3. The CliBuilder</strong><br />
The script should really feel like a command line utility. Therefore it needs to deal with parameters. This is where the CliBuilder comes in. </p>
<pre class="brush: groovy;">
def cli = new CliBuilder (usage:'simpleHtmlServer -p PORT -d DIRECTORY')
cli.with {
 h longOpt:'help', 'Usage information'
 p longOpt:'port',argName:'port', args:1, type:Number.class,'Default is 8080'
 d longOpt:'dir', argName:'directory', args:1, 'Default is .'
}

def opts = cli.parse(args)
if(!opts) return
if(opts.help) {
  cli.usage()
  return
}
</pre>
<p>Groovy includes Apache commons CLI. But where the Java version is already helpful in parsing parameters, the Groovy version gets really simple. The example above creates one CliBuilder, that provides a &#8220;DSL&#8221; for defining the parameters. Further down they are three parameters defined. This is all thats needed.<br />
After the args are parsed we can just simply use them using Groovy properties syntax like opts.parameterName. Even a pretty usage statement can be printed, when &#8211;help is called.</p>
<p><strong>4. Dynamic constructors</strong><br />
I used one of the embedded Jetty examples (FileServer.java) as the foundation of my script. The configuration of the handlers looked something like that in Java:</p>
<pre class="brush: java;">
ResourceHandler resource_handler=new ResourceHandler();
resource_handler.setWelcomeFiles(new String[]{&quot;index.html&quot;});
resource_handler.setResourceBase(args.length==2?args[1]:&quot;.&quot;);

HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[]{resource_handler,new DefaultHandler()});
</pre>
<p>Thats pretty long. Now the Groovy version looks like that:</p>
<pre class="brush: groovy;">
def resourceHandler = new ResourceHandler(welcomeFiles:[&quot;index.html&quot;],
                                          resourceBase:opts.dir?:&quot;.&quot;)
server.handler = new HandlerList(handlers:[resourceHandler, new DefaultHandler()])
</pre>
<p>It uses dynamic constructors. Groovy allows to call a virtual constructor with a map of arguments, where the elements are actually bean properties. This allows a much more concise construction of an object, even if the original creator wasn&#8217;t so kind to provide a convenience constructor.</p>
<p><strong>5. The Elvis Operator</strong></p>
<p>You probably wondered what the following statement did in the last example:</p>
<pre class="brush: plain;">
opts.dir?:&quot;.&quot;
</pre>
<p>Well, that was Elvis. In Java there is the ternary operator, which goes like this:</p>
<pre class="brush: plain;">
(condition)?(result if true):(result if false)
</pre>
<p>In Grovvy there is something called the Groovy truth, which says if a statement is null, then it is false, else it is true. This makes the Elvis operator possible. Elvis says, if the statement is true (as in Groovy truth) then use the value of the statement, else use the value after the colon.  This is a very concise way for realizing default values, which is often needed in scripts</p>
<p>With all the scripting features that were added in earlier versions and with Grape in 1.7 I think Groovy is finally a great alternative to usual scripting languages. When you are experienced in Java it&#8217;s probably much simpler to write a script in Groovy than in Perl, Ruby or even Bash. For me this is definitely true.</p>
<p>Well done, Groovy team! </p>




	<a rel="nofollow"  href="http://twitter.com/home?status=Scripting%20magic%20with%20Groovy%2C%20Grape%20and%20Jetty%20-%20http%3A%2F%2Fwww.joergm.com%2F2009%2F12%2Fscripting-magic-with-groovy-grape-and-jetty%2F" title="Twitter"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F12%2Fscripting-magic-with-groovy-grape-and-jetty%2F&amp;title=Scripting%20magic%20with%20Groovy%2C%20Grape%20and%20Jetty&amp;notes=Groovy%201.7%20has%20just%20been%20release%20and%20it%27s%20time%20to%20play%20again.%20One%20of%20the%20new%20features%2C%20Grape%20inspired%20me%20to%20the%20try%20the%20following.%20I%20created%20a%20script%20that%20acts%20as%20a%20simple%20webserver%20using%20embedded%20jetty%20without%20the%20need%20to%20install%20anything%20else%20than%20" title="del.icio.us"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F12%2Fscripting-magic-with-groovy-grape-and-jetty%2F&amp;title=Scripting%20magic%20with%20Groovy%2C%20Grape%20and%20Jetty" title="DZone"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F12%2Fscripting-magic-with-groovy-grape-and-jetty%2F&amp;title=Scripting%20magic%20with%20Groovy%2C%20Grape%20and%20Jetty" title="Reddit"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.joergm.com%2F2009%2F12%2Fscripting-magic-with-groovy-grape-and-jetty%2F&amp;t=Scripting%20magic%20with%20Groovy%2C%20Grape%20and%20Jetty" title="HackerNews"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.joergm.com%2F2009%2F12%2Fscripting-magic-with-groovy-grape-and-jetty%2F&amp;title=Scripting%20magic%20with%20Groovy%2C%20Grape%20and%20Jetty&amp;annotation=Groovy%201.7%20has%20just%20been%20release%20and%20it%27s%20time%20to%20play%20again.%20One%20of%20the%20new%20features%2C%20Grape%20inspired%20me%20to%20the%20try%20the%20following.%20I%20created%20a%20script%20that%20acts%20as%20a%20simple%20webserver%20using%20embedded%20jetty%20without%20the%20need%20to%20install%20anything%20else%20than%20" title="Google Bookmarks"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F12%2Fscripting-magic-with-groovy-grape-and-jetty%2F&amp;title=Scripting%20magic%20with%20Groovy%2C%20Grape%20and%20Jetty&amp;bodytext=Groovy%201.7%20has%20just%20been%20release%20and%20it%27s%20time%20to%20play%20again.%20One%20of%20the%20new%20features%2C%20Grape%20inspired%20me%20to%20the%20try%20the%20following.%20I%20created%20a%20script%20that%20acts%20as%20a%20simple%20webserver%20using%20embedded%20jetty%20without%20the%20need%20to%20install%20anything%20else%20than%20" title="Digg"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.joergm.com%2F2009%2F12%2Fscripting-magic-with-groovy-grape-and-jetty%2F" title="Technorati"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Scripting%20magic%20with%20Groovy%2C%20Grape%20and%20Jetty&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F12%2Fscripting-magic-with-groovy-grape-and-jetty%2F" title="Slashdot"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" /></a>
	<a rel="nofollow"  href="mailto:?subject=Scripting%20magic%20with%20Groovy%2C%20Grape%20and%20Jetty&amp;body=http%3A%2F%2Fwww.joergm.com%2F2009%2F12%2Fscripting-magic-with-groovy-grape-and-jetty%2F" title="email"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.joergm.com/2009/12/scripting-magic-with-groovy-grape-and-jetty/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IntelliJ IDEAs new directory-based project format</title>
		<link>http://www.joergm.com/2009/10/intellij-ideas-new-directory-based-project-format/</link>
		<comments>http://www.joergm.com/2009/10/intellij-ideas-new-directory-based-project-format/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 09:21:42 +0000</pubDate>
		<dc:creator>Joerg</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[intellij idea]]></category>

		<guid isPermaLink="false">http://www.brainoutprintln.com/?p=265</guid>
		<description><![CDATA[I am currently playing with the EAP-Version (Early Access Program) of my favorite IDE IntelliJ IDEA. Since the new version is not that far away it is time to learn the new features and I discovered one that surprised me. A small but pretty nice change. (Update: Thanks to Strug I have realized that this [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F10%2Fintellij-ideas-new-directory-based-project-format%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F10%2Fintellij-ideas-new-directory-based-project-format%2F&amp;source=JoergM&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I am currently playing with the EAP-Version (Early Access Program) of my favorite IDE  IntelliJ IDEA. Since the new version is not that far away it is time to learn the new features and I discovered one that surprised me. A small but pretty nice change.</p>
<p>(<strong>Update: </strong>Thanks to Strug I have realized that this feature is already present in Idea 8, you can use the action &#8220;Open in New (Directory based) format&#8221; to convert your project. Fortunately they renamed it to &#8220;Save as Directory-Based Format …&#8221; in Maia. )</p>
<p>IDEA has a new format to store the project files. It is called directory-based. Instead of using the three famous files <em>.ipr .iml</em> and <em>.iws</em> IDEA will now store all information into a directory, which is simply called <em>.idea</em>. It is located in the root folder of the project. This seems to be somewhat similar to eclipse&#8217;s .project folder. In a small example project I created the content of the new directory looks like this:</p>
<pre>-rw-r--r--  1 joerg  joerg    163 17 Okt 09:53 ant.xml
-rw-r--r--  1 joerg  joerg   2107 17 Okt 09:53 compiler.xml
drwxr-xr-x  3 joerg  joerg    102 17 Okt 09:53 copyright
drwxr-xr-x  3 joerg  joerg    102 17 Okt 09:53 dictionaries
-rw-r--r--  1 joerg  joerg    277 17 Okt 09:53 encodings.xml
-rw-r--r--  1 joerg  joerg    170 17 Okt 09:53 fileColors.xml
-rw-r--r--  1 joerg  joerg   1595 17 Okt 09:53 misc.xml
-rw-r--r--  1 joerg  joerg    258 17 Okt 09:53 modules.xml
-rw-r--r--  1 joerg  joerg    207 17 Okt 09:53 templateLanguages.xml
-rw-r--r--  1 joerg  joerg    169 17 Okt 09:53 vcs.xml
-rw-r--r--  1 joerg  joerg  38245 17 Okt 10:21 workspace.xml</pre>
<p>The files included in this directory depend on the settings you change in the IDE. So, if you would for instance set the SQL dialect for your project there will be another file called sqldialects.xml containing all settings about this.</p>
<p>There is one special file in there, which is workspace.xml. This file contains individual settings for the workspace, which are definitely not intended to be shared via version control. This is equivalent to the .iws file of the old format. IDEA will put this file automatically on the ignore list of your version control.</p>
<p>I see some advantages of the new format.</p>
<ul>
<li>First of all it is easier to find specific settings. The filenames are meaningful and the files are small.</li>
<li>The new structure allows a very detailed control of which settings you want to share with your colleagues. If you don&#8217;t want to share e.g. your file coloring (another new feature of Maia) just put the file on the ignore list.</li>
<li>Directories of the projects saved in the new format will be recognized as projects in the open-project dialog. In the past this was one annoying additional click as you had to choose the .ipr file before.</li>
</ul>
<p>The new directory based format is a small change but a very good one. It is often a sum of little detail-improvements that save a lot of trouble in daily work. So I am looking forward to the other details to be discovered.</p>
<p>By the way JetBrains released an open source version of IDEA two days ago. So if you want to try this just go to <a title="jetbrains.org" href="http://www.jetbrains.org" target="_blank">www.jetbrains.org</a> and download the Community Edition.</p>




	<a rel="nofollow"  href="http://twitter.com/home?status=IntelliJ%20IDEAs%20new%20directory-based%20project%20format%20-%20http%3A%2F%2Fwww.joergm.com%2F2009%2F10%2Fintellij-ideas-new-directory-based-project-format%2F" title="Twitter"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F10%2Fintellij-ideas-new-directory-based-project-format%2F&amp;title=IntelliJ%20IDEAs%20new%20directory-based%20project%20format&amp;notes=I%20am%20currently%20playing%20with%20the%20EAP-Version%20%28Early%20Access%20Program%29%20of%20my%20favorite%20IDE%20%20IntelliJ%20IDEA.%20Since%20the%20new%20version%20is%20not%20that%20far%20away%20it%20is%20time%20to%20learn%20the%20new%20features%20and%20I%20discovered%20one%20that%20surprised%20me.%20A%20small%20but%20pretty%20nice%20chan" title="del.icio.us"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F10%2Fintellij-ideas-new-directory-based-project-format%2F&amp;title=IntelliJ%20IDEAs%20new%20directory-based%20project%20format" title="DZone"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F10%2Fintellij-ideas-new-directory-based-project-format%2F&amp;title=IntelliJ%20IDEAs%20new%20directory-based%20project%20format" title="Reddit"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.joergm.com%2F2009%2F10%2Fintellij-ideas-new-directory-based-project-format%2F&amp;t=IntelliJ%20IDEAs%20new%20directory-based%20project%20format" title="HackerNews"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.joergm.com%2F2009%2F10%2Fintellij-ideas-new-directory-based-project-format%2F&amp;title=IntelliJ%20IDEAs%20new%20directory-based%20project%20format&amp;annotation=I%20am%20currently%20playing%20with%20the%20EAP-Version%20%28Early%20Access%20Program%29%20of%20my%20favorite%20IDE%20%20IntelliJ%20IDEA.%20Since%20the%20new%20version%20is%20not%20that%20far%20away%20it%20is%20time%20to%20learn%20the%20new%20features%20and%20I%20discovered%20one%20that%20surprised%20me.%20A%20small%20but%20pretty%20nice%20chan" title="Google Bookmarks"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F10%2Fintellij-ideas-new-directory-based-project-format%2F&amp;title=IntelliJ%20IDEAs%20new%20directory-based%20project%20format&amp;bodytext=I%20am%20currently%20playing%20with%20the%20EAP-Version%20%28Early%20Access%20Program%29%20of%20my%20favorite%20IDE%20%20IntelliJ%20IDEA.%20Since%20the%20new%20version%20is%20not%20that%20far%20away%20it%20is%20time%20to%20learn%20the%20new%20features%20and%20I%20discovered%20one%20that%20surprised%20me.%20A%20small%20but%20pretty%20nice%20chan" title="Digg"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.joergm.com%2F2009%2F10%2Fintellij-ideas-new-directory-based-project-format%2F" title="Technorati"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=IntelliJ%20IDEAs%20new%20directory-based%20project%20format&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F10%2Fintellij-ideas-new-directory-based-project-format%2F" title="Slashdot"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" /></a>
	<a rel="nofollow"  href="mailto:?subject=IntelliJ%20IDEAs%20new%20directory-based%20project%20format&amp;body=http%3A%2F%2Fwww.joergm.com%2F2009%2F10%2Fintellij-ideas-new-directory-based-project-format%2F" title="email"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.joergm.com/2009/10/intellij-ideas-new-directory-based-project-format/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A poor man’s countdown</title>
		<link>http://www.joergm.com/2009/08/a-poor-mans-countdown/</link>
		<comments>http://www.joergm.com/2009/08/a-poor-mans-countdown/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 21:13:45 +0000</pubDate>
		<dc:creator>Joerg</dc:creator>
				<category><![CDATA[agile]]></category>
		<category><![CDATA[scrum]]></category>
		<category><![CDATA[countdown]]></category>
		<category><![CDATA[low-tech]]></category>

		<guid isPermaLink="false">http://www.brainoutprintln.com/?p=224</guid>
		<description><![CDATA[We all know those high-tech solutions that show the time left to a certain event. There are huge LED-Displays, Dashboard-Widgets or even iPhone apps. For an upcoming release of our software a colleague installed a very low-tech version. You just need: a tape measure scissors a wall (a glass wall in our case) and something [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F08%2Fa-poor-mans-countdown%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F08%2Fa-poor-mans-countdown%2F&amp;source=JoergM&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>
We all know those high-tech solutions that show the time left to a certain event. There are huge LED-Displays,  Dashboard-Widgets or even iPhone apps.
</p>
<table>
<tr>
<td>
<img src="http://www.brainoutprintln.com/wp-content/uploads/2009/08/countdown.jpg" alt="countdown" title="countdown" width="250" height="300" class="alignnone size-full wp-image-225" />
</td>
<td valign="top" style="padding-left:10px;">
For an upcoming release of our software a colleague installed a very low-tech version.<br />
</br><br />
You just need:</p>
<ul>
<li>a tape measure</li>
<li>scissors</li>
<li>a wall (a glass wall in our case)</li>
<li>and something to attach the tape measure to the wall (some Scotch tape or Blue Tack will do)</li>
</ul>
<p>Attach the tape measure to the wall and cut a centimeter off each day. <strong>That&#8217;s it.</strong>
</td>
</tr>
</table>
<p>
It should not be a problem to raise the budget for this solution. Most of the stuff will be around in any office. A tape measure can often be found in furniture stores for free, although a plastic tape measure for a few cents usually looks much better.<br />
I love this kind of low-tech solutions. It&#8217;s a nice contrast to the high-tech around and even marketing can understand it.</p>




	<a rel="nofollow"  href="http://twitter.com/home?status=A%20poor%20man%27s%20countdown%20-%20http%3A%2F%2Fwww.joergm.com%2F2009%2F08%2Fa-poor-mans-countdown%2F" title="Twitter"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F08%2Fa-poor-mans-countdown%2F&amp;title=A%20poor%20man%27s%20countdown&amp;notes=%0D%0AWe%20all%20know%20those%20high-tech%20solutions%20that%20show%20the%20time%20left%20to%20a%20certain%20event.%20There%20are%20huge%20LED-Displays%2C%20%20Dashboard-Widgets%20or%20even%20iPhone%20apps.%20%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AFor%20an%20upcoming%20release%20of%20our%20software%20a%20colleague%20installed%20a%20very%20low-tech%20ver" title="del.icio.us"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F08%2Fa-poor-mans-countdown%2F&amp;title=A%20poor%20man%27s%20countdown" title="DZone"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F08%2Fa-poor-mans-countdown%2F&amp;title=A%20poor%20man%27s%20countdown" title="Reddit"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.joergm.com%2F2009%2F08%2Fa-poor-mans-countdown%2F&amp;t=A%20poor%20man%27s%20countdown" title="HackerNews"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.joergm.com%2F2009%2F08%2Fa-poor-mans-countdown%2F&amp;title=A%20poor%20man%27s%20countdown&amp;annotation=%0D%0AWe%20all%20know%20those%20high-tech%20solutions%20that%20show%20the%20time%20left%20to%20a%20certain%20event.%20There%20are%20huge%20LED-Displays%2C%20%20Dashboard-Widgets%20or%20even%20iPhone%20apps.%20%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AFor%20an%20upcoming%20release%20of%20our%20software%20a%20colleague%20installed%20a%20very%20low-tech%20ver" title="Google Bookmarks"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F08%2Fa-poor-mans-countdown%2F&amp;title=A%20poor%20man%27s%20countdown&amp;bodytext=%0D%0AWe%20all%20know%20those%20high-tech%20solutions%20that%20show%20the%20time%20left%20to%20a%20certain%20event.%20There%20are%20huge%20LED-Displays%2C%20%20Dashboard-Widgets%20or%20even%20iPhone%20apps.%20%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AFor%20an%20upcoming%20release%20of%20our%20software%20a%20colleague%20installed%20a%20very%20low-tech%20ver" title="Digg"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.joergm.com%2F2009%2F08%2Fa-poor-mans-countdown%2F" title="Technorati"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=A%20poor%20man%27s%20countdown&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F08%2Fa-poor-mans-countdown%2F" title="Slashdot"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" /></a>
	<a rel="nofollow"  href="mailto:?subject=A%20poor%20man%27s%20countdown&amp;body=http%3A%2F%2Fwww.joergm.com%2F2009%2F08%2Fa-poor-mans-countdown%2F" title="email"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.joergm.com/2009/08/a-poor-mans-countdown/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Scala Pattern Matching explained</title>
		<link>http://www.joergm.com/2009/04/scala-pattern-matching-explained/</link>
		<comments>http://www.joergm.com/2009/04/scala-pattern-matching-explained/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 17:02:02 +0000</pubDate>
		<dc:creator>Joerg</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[Pattern Matching]]></category>

		<guid isPermaLink="false">http://www.brainoutprintln.com/?p=190</guid>
		<description><![CDATA[I am currently reading Programming in Scala. For a programmer coming from an imperative world there many new concepts to learn. One of them is Pattern Matching. There are already lots of articles about it, but explaining something is still one of the best ways to learn. Here are the first 4 levels of understanding [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Fscala-pattern-matching-explained%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Fscala-pattern-matching-explained%2F&amp;source=JoergM&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I am currently reading <a href="http://www.amazon.com/Programming-Scala-Comprehensive-Step-step/dp/0981531601/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1239687420&#038;sr=8-1">Programming in Scala</a>. For a programmer coming from an imperative world there many new concepts to learn. One of them is Pattern Matching. There are already lots of articles about it, but explaining something is still one of the best ways to learn. Here are the first 4 levels of understanding Pattern Matching.</p>
<p><strong>Level 1 &#8211; Pattern Matching as simple switch/case replacement</strong></p>
<p>Pattern Matching can simply be used to replace Java switch/case statements. This is called constant pattern and looks like this:</p>
<pre>
<pre class="brush: scala;">
  def constantMatch(value:Any) = {
    value match {
      case &quot;Hello&quot; =&gt; &quot;You said hello!&quot;
      case 1 =&gt; &quot;Oh, thats a 1!&quot;
      case _ =&gt; &quot;Don't know what you want!&quot;
    }
  }
</pre>
</pre>
<p>ConstantMatch is a function that takes a parameter of type Any. Any is the Scala pendant to java.lang.Object. This value is now matched against several constants. The first case is a String the second an Int and the last case is a wildcard for any other value.<br />
There are a few differences to Java. First, there is no &#8220;fall through&#8221;. If a pattern has been matched its value will be returned. Thats the part after the => operator. This can be a full code block. The example above just shows the short version. The second difference is if no pattern matches Scala will throw a MatchError Exception. This is why the wildcard pattern is needed as the last line. This is more or less the same as the default clause of Java.  </p>
<p><strong>Level 2 &#8211; Introducing Variable patterns</strong></p>
<p>Now level 1 was already more powerful than Java switch/case. But there are some more levels to go. The next step is introducing variable pattern. Here is an example:</p>
<pre>
<pre class="brush: scala;">
 def variableMatch(value:Any) = {
    value match {
      case 1 =&gt;&quot;Oh, thats a 1!&quot;
      case x =&gt;&quot;And thats a&quot;+x+&quot;!&quot;;
    }
  }
</pre>
</pre>
<p>Instead of validating every possibly value the value itself is put into a variable. This variable can then be processed in the result block. You might recognize that there is no wildcard case(<em>case _ => &#8230;</em>). This is not necessary as the variable pattern will match any possible value. A wildcard would not even be possible. The compiler will complain that it is unreachable code.</p>
<p><strong>Level 3 &#8211; Type Patterns</strong></p>
<p>Type patterns allow to calculate the result based on the type of the value. Instead of using instanceof in Java or isInstanceOf in Scala this can just be done in a case statement. Let&#8217;s assume we have a class hierarchy used to calculate the financial value of different types of property. </p>
<pre>
<pre class="brush: scala;">
abstract class Property {
  val value: BigDecimal
}

case class House(address: Address, override val value:BigDecimal) extends Property
case class Car(horsepower: Int, override val value:BigDecimal) extends Property
case class Horse(Age:Int, override val value:BigDecimal) extends Property
case class Address(street: String, city: String)
</pre>
</pre>
<p>Ignore the case keyword for the moment. This is level 4. For all Java people, this code can be put in one file, although it is not recommended practice. I just do it here for simplicity. Property is the abstract base class. It defines a field value as all property needs to have a value. House, Car and Horse inherit from Property and add additional information. Address will be used in a later example.</p>
<p>For a special calculation the value will be applied based on the type of property. Houses will be applied with 80% of their value, Horses with 50% and the value of Cars will not be applied at all. Using Pattern Matching this looks like this:</p>
<pre>
<pre class="brush: scala;">
  def applyPropertyValue(property:Property):BigDecimal = property match {
    case house:House =&gt; house.value * 0.8
    case horse:Horse =&gt; horse.value * 0.5
    case car:Car =&gt; 0
    case _ =&gt; property.value
  }
</pre>
</pre>
<p>Without any instanceof or casting the value has been calculated based on the type of property. Here is a wildcard pattern used in the last line again. If there is another type of property the full value will be applied. </p>
<p><strong>Level 4 &#8211; Constructor patterns and Case Classes</strong><br />
The last example already used case classes even if it would have worked with normal classes too. Case classes have some special characteristics. </p>
<ul>
<li>There is a special factory method that allows the class to be instantiated without the new keyword. <em>Car(150,20000)</em> creates a Car object with 150 horsepower and a value of 20.000.</li>
<li> All parameters in the constructor are automatically defined as <em>val</em>. So they are fields and can be accessed from other objects.</li>
<li>The compiler generates meaningful implementations of equals, hashcode and toString.</li>
<li> And of course they can be used in constructor patterns.  </li>
</ul>
<p>In our example we need some very special cases to calculate the value. If a house is in Berlin 90% instead of 80% of the value can be applied. Cars with a horsepower of more than 150 can be applied with 50% of their value instead of 0. Our function now gets two more lines:</p>
<pre>
<pre class="brush: scala;">
  def applyPropertyValue(property:Property):BigDecimal = property match {
    case House(Address(_,&quot;Berlin&quot;),value) =&gt; value * 0.9 //Deep match
    case Car(horsepower, value) if horsepower &gt; 150 =&gt; value * 0.5 //Pattern Guard
    case house:House =&gt; house.value * 0.8
    case horse:Horse =&gt; horse.value * 0.5
    case car:Car =&gt; 0
    case _ =&gt; property.value
  }
</pre>
</pre>
<p>The more special a case is the earlier it has to be validated. If the general case for Car would be matched first, the more specialized pattern would never be validated. In simple cases the Scala compiler complains about the code being unreachable.<br />
The two new lines use the constructor pattern, that is only possible for case classes. But both also demonstrate other features of Pattern Matching.  The House pattern shows a nested pattern. The important condition is in class Address, which is nested inside House. This kind of deep matches can save a lot of code. Imagine how many if statements, casts and instanceofs this needs in Java. The Car example shows another syntax for pattern matching. It is called Pattern Guards. An additional if after the pattern allows to validate conditions, before the pattern code will be excecuted. </p>
<p><strong>Level 5 and above</strong><br />
This is still not all that can be learned about Pattern Matching. The story goes on with sequence patterns, sealed classes, partial functions and much more. But by now you should be able to understand most Pattern Matching statements that can be found in Scala. For more details I can only recommend reading <a href="http://www.amazon.com/Programming-Scala-Comprehensive-Step-step/dp/0981531601/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1239687420&#038;sr=8-1">Programming in Scala</a>. It contains a lot of fun stuff like that.</p>




	<a rel="nofollow"  href="http://twitter.com/home?status=Scala%20Pattern%20Matching%20explained%20-%20http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Fscala-pattern-matching-explained%2F" title="Twitter"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Fscala-pattern-matching-explained%2F&amp;title=Scala%20Pattern%20Matching%20explained&amp;notes=I%20am%20currently%20reading%20Programming%20in%20Scala.%20For%20a%20programmer%20coming%20from%20an%20imperative%20world%20there%20many%20new%20concepts%20to%20learn.%20One%20of%20them%20is%20Pattern%20Matching.%20There%20are%20already%20lots%20of%20articles%20about%20it%2C%20but%20explaining%20something%20is%20still%20one%20of%20the" title="del.icio.us"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Fscala-pattern-matching-explained%2F&amp;title=Scala%20Pattern%20Matching%20explained" title="DZone"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Fscala-pattern-matching-explained%2F&amp;title=Scala%20Pattern%20Matching%20explained" title="Reddit"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Fscala-pattern-matching-explained%2F&amp;t=Scala%20Pattern%20Matching%20explained" title="HackerNews"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Fscala-pattern-matching-explained%2F&amp;title=Scala%20Pattern%20Matching%20explained&amp;annotation=I%20am%20currently%20reading%20Programming%20in%20Scala.%20For%20a%20programmer%20coming%20from%20an%20imperative%20world%20there%20many%20new%20concepts%20to%20learn.%20One%20of%20them%20is%20Pattern%20Matching.%20There%20are%20already%20lots%20of%20articles%20about%20it%2C%20but%20explaining%20something%20is%20still%20one%20of%20the" title="Google Bookmarks"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Fscala-pattern-matching-explained%2F&amp;title=Scala%20Pattern%20Matching%20explained&amp;bodytext=I%20am%20currently%20reading%20Programming%20in%20Scala.%20For%20a%20programmer%20coming%20from%20an%20imperative%20world%20there%20many%20new%20concepts%20to%20learn.%20One%20of%20them%20is%20Pattern%20Matching.%20There%20are%20already%20lots%20of%20articles%20about%20it%2C%20but%20explaining%20something%20is%20still%20one%20of%20the" title="Digg"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Fscala-pattern-matching-explained%2F" title="Technorati"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Scala%20Pattern%20Matching%20explained&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Fscala-pattern-matching-explained%2F" title="Slashdot"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" /></a>
	<a rel="nofollow"  href="mailto:?subject=Scala%20Pattern%20Matching%20explained&amp;body=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Fscala-pattern-matching-explained%2F" title="email"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.joergm.com/2009/04/scala-pattern-matching-explained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Five random lessons learned about Scala</title>
		<link>http://www.joergm.com/2009/04/five-random-lessons-learned-about-scala/</link>
		<comments>http://www.joergm.com/2009/04/five-random-lessons-learned-about-scala/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 06:18:32 +0000</pubDate>
		<dc:creator>Joerg</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[lessons learned]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[testng]]></category>

		<guid isPermaLink="false">http://www.brainoutprintln.com/?p=166</guid>
		<description><![CDATA[Since a week I am playing around with Scala to see what all this fuss is about. After Twitter has anounced that they are using Scala (see this presentation) there is a real hype now. So far I must admit I am impressed. This language is really nice. I will certainly have a very detailed [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Ffive-random-lessons-learned-about-scala%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Ffive-random-lessons-learned-about-scala%2F&amp;source=JoergM&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Since a week I am playing around with <a href="http://www.scala-lang.org">Scala</a> to see what all this fuss is about. After Twitter has anounced that they are using Scala (<a href="http://www.slideshare.net/al3x/why-scala-presentation">see this presentation</a>) there is a real hype now. So far I must admit I am impressed. This language is really nice. I will certainly have a very detailed look. The book &#8220;<a href="http://www.amazon.com/Programming-Scala-Comprehensive-Step-step/dp/0981531601/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1239687420&#038;sr=8-1">Programming in Scala</a>&#8221; is already on its way from Amazon. </p>
<p>The following lessons learned are just a kind of note to self. These are some random experiences I made when playing around. Your first lessons will probably be completely different.</p>
<p><strong>1. Scala != Groovy</strong><br />
Although this is obvious, when you have prior experience in Groovy it is tempting to fall into your Groovy habits. Both languages look similar at a glance but are very different in detail. For instance I very often write <strong>def</strong> when defining a variable where it should be <strong>val</strong> or <strong>var</strong>. The fact that <strong>def</strong> is a valid keyword in Scala and is used to define methods is not helpful in this regard. There are so many other subtile differences that I can&#8217;t mention them here. Just be aware of that. </p>
<p><strong>2. Use a decompiler</strong><br />
A decompiler can be very useful when learning Scala. Just compile the Scala class and then decompile it. This way you can easily see, what the Scala compiler is creating when using certain language features. I discovered a nice decompiler while doing this. It can be found <a href="http://java.decompiler.free.fr/">here</a>.  The decompiler was key for solving the next issue.</p>
<p><strong>3. Be careful with field level annotations</strong><br />
It is a great feature of Scala that you can use established Java frameworks and just replace the Java code with Scala. This way you can easily use Spring and the likes. I did that but had sudden problems with the Spring @Autowired annotation. I annotated the field like that:</p>
<pre>
<pre class="brush: scala;">
@Autowired
var pollService: IPollService = _;
</pre>
</pre>
<p>Spring was starting to complain about missing parameters on the annotated method. <em>What?</em><br />
Ok, I was aware that Scala generates corresponding methods for a field just like Groovy does. But what was the issue here? The Spring annotation is defined as field level and method level annotation. But when it is used on a method it has to be a setter which gets at least one parameter. The decompiler saved the day. It shows that Scala is applying the annotation three times. At the field, at the setter <em>pollService_$eq()</em> and the getter <em>pollService()</em>. The last causes the Spring exception. (For all Scala experts, the @BeanProperty annotation does not solve the problem)<br />
The (ugly) workaround is to create the setter manually and annotate only this. Here is how:</p>
<pre>
<pre class="brush: scala;">
var pollService: IPollService = _;

@Autowired
def setPollService(pollService: IPollService) = {this.pollService = pollService}
</pre>
</pre>
<p><strong>4. Switch of &#8220;Compile Scala files first&#8221; in IDEA</strong> </p>
<p>There is a small bug/inconvinience in the current Scala plugin of IntelliJ Idea. It occurs when you have a project with combined Java and Scala sources.  Any Java class that is located in a test source folder will not compile. You will get an error message <em>&#8220;ClassX is already defined as class ClassX&#8221;</em>. To fix this you can simply change the Scala compiler settings. Go to Settings->Compiler->Scala and uncheck &#8220;Compile Scala Files First&#8221;. It is not perfect, as you might need to manually (Ctrl-Shift-F9) compile Scala sources that Java files depend on. But at least you can compile everything now. </p>
<p><strong>5. Use Scalatest!</strong><br />
If you want to write tests in Scala try <a href="http://www.artima.com/scalatest/">Scalatest</a>. It shows perfectly what can be done in Scala. It enables different styles of testing like xUnit or BDD just by applying different traits. And it enables you to use TestNG in your Scala tests. This way you can just start tests in Scala as if they where Java, at least in Intellij Idea. Here is a small example how a Test can look like:</p>
<pre>
<pre class="brush: scala;">
@Test def testCreateTopicPoll() = {
  val pollDto = preparePoll
  val pollId = pollService saveOrUpdateTopicPoll pollDto;
  pollId should not be null
}
</pre>
</pre>
<p>Look at the last line. Isn&#8217;t that beautiful? This is real code. You would not need any comments to explain, what is under test here. </p>
<p>I can strongly recommend that you have a look into Scala. It is a very interesting language with some nice concepts. I hope that some of my lessons learned help you when doing your first steps. Then let me know what lessons you learned!</p>




	<a rel="nofollow"  href="http://twitter.com/home?status=Five%20random%20lessons%20learned%20about%20Scala%20-%20http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Ffive-random-lessons-learned-about-scala%2F" title="Twitter"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Ffive-random-lessons-learned-about-scala%2F&amp;title=Five%20random%20lessons%20learned%20about%20Scala&amp;notes=Since%20a%20week%20I%20am%20playing%20around%20with%20Scala%20to%20see%20what%20all%20this%20fuss%20is%20about.%20After%20Twitter%20has%20anounced%20that%20they%20are%20using%20Scala%20%28see%20this%20presentation%29%20there%20is%20a%20real%20hype%20now.%20So%20far%20I%20must%20admit%20I%20am%20impressed.%20This%20language%20is%20really%20nice.%20I" title="del.icio.us"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Ffive-random-lessons-learned-about-scala%2F&amp;title=Five%20random%20lessons%20learned%20about%20Scala" title="DZone"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Ffive-random-lessons-learned-about-scala%2F&amp;title=Five%20random%20lessons%20learned%20about%20Scala" title="Reddit"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Ffive-random-lessons-learned-about-scala%2F&amp;t=Five%20random%20lessons%20learned%20about%20Scala" title="HackerNews"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Ffive-random-lessons-learned-about-scala%2F&amp;title=Five%20random%20lessons%20learned%20about%20Scala&amp;annotation=Since%20a%20week%20I%20am%20playing%20around%20with%20Scala%20to%20see%20what%20all%20this%20fuss%20is%20about.%20After%20Twitter%20has%20anounced%20that%20they%20are%20using%20Scala%20%28see%20this%20presentation%29%20there%20is%20a%20real%20hype%20now.%20So%20far%20I%20must%20admit%20I%20am%20impressed.%20This%20language%20is%20really%20nice.%20I" title="Google Bookmarks"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Ffive-random-lessons-learned-about-scala%2F&amp;title=Five%20random%20lessons%20learned%20about%20Scala&amp;bodytext=Since%20a%20week%20I%20am%20playing%20around%20with%20Scala%20to%20see%20what%20all%20this%20fuss%20is%20about.%20After%20Twitter%20has%20anounced%20that%20they%20are%20using%20Scala%20%28see%20this%20presentation%29%20there%20is%20a%20real%20hype%20now.%20So%20far%20I%20must%20admit%20I%20am%20impressed.%20This%20language%20is%20really%20nice.%20I" title="Digg"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Ffive-random-lessons-learned-about-scala%2F" title="Technorati"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Five%20random%20lessons%20learned%20about%20Scala&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Ffive-random-lessons-learned-about-scala%2F" title="Slashdot"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" /></a>
	<a rel="nofollow"  href="mailto:?subject=Five%20random%20lessons%20learned%20about%20Scala&amp;body=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Ffive-random-lessons-learned-about-scala%2F" title="email"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.joergm.com/2009/04/five-random-lessons-learned-about-scala/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Inheritance of class annotations in TestNG</title>
		<link>http://www.joergm.com/2009/04/inheritance-of-class-annotations-in-testng/</link>
		<comments>http://www.joergm.com/2009/04/inheritance-of-class-annotations-in-testng/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 08:15:47 +0000</pubDate>
		<dc:creator>Joerg</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[JUG Berlin]]></category>
		<category><![CDATA[testng]]></category>

		<guid isPermaLink="false">http://www.brainoutprintln.com/?p=132</guid>
		<description><![CDATA[Recently Oliver Fischer introduced TestNG at the Berlin-Brandenburg JUG. At one point there was an interesting discussion with the audience about class level annotations. Why should they be used? You can annotate a class like this: @Test public class Foo { ... Now every public method in this class is considered a test method. Several [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Finheritance-of-class-annotations-in-testng%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Finheritance-of-class-annotations-in-testng%2F&amp;source=JoergM&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Recently <a href="http://www.swe-blog.net/">Oliver Fischer</a> introduced TestNG at the <a href="http://www.jug-bb.de/">Berlin-Brandenburg JUG</a>. At one point there was an interesting discussion with the audience about class level annotations. Why should they be used? You can annotate a class like this:</p>
<pre>
<pre class="brush: java;">
@Test
public class Foo
{
...
</pre>
</pre>
<p>Now every public method in this class is considered a test method. Several people in the audience mentioned that they would still prefer to mark the test explicitly. This is just more readable. But if so, what might be a good reason to use class level annotations?</p>
<p>One very nice characteristic of class level annotations is that they can be inherited. Let&#8217;s assume you want several classes in a specific testgroup. What you don&#8217;t want to do is to annotate each and every test method with <em>@Test(groups = {&#8220;MyTestGroup&#8221;})</em>. This is simply not <a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself">DRY</a>. Using inheritance, you can instead create a base-class like this:</p>
<pre>
<pre class="brush: java;">
@Test(groups = {&quot;MyTestGroup&quot;})
public class BaseClass
{
...
</pre>
</pre>
<p>Now each test class that should be in this group can just extend <em>BaseClass</em>. </p>
<pre>
<pre class="brush: java;">
public class MyTestClass extends BaseClass
{
...
</pre>
</pre>
<p>Every public method in these classes is a test method and they belong to the group <em>MyTestGroup</em>. You probably still want to add the <em>@Test</em> annotation to each of the methods for readability. The group assignment is still valid. </p>
<p>What other ideas do you have for making use of annotation inheritance in TestNG?</p>




	<a rel="nofollow"  href="http://twitter.com/home?status=Inheritance%20of%20class%20annotations%20in%20TestNG%20%20-%20http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Finheritance-of-class-annotations-in-testng%2F" title="Twitter"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Finheritance-of-class-annotations-in-testng%2F&amp;title=Inheritance%20of%20class%20annotations%20in%20TestNG%20&amp;notes=Recently%20Oliver%20Fischer%20introduced%20TestNG%20at%20the%20Berlin-Brandenburg%20JUG.%20At%20one%20point%20there%20was%20an%20interesting%20discussion%20with%20the%20audience%20about%20class%20level%20annotations.%20Why%20should%20they%20be%20used%3F%20You%20can%20annotate%20a%20class%20like%20this%3A%0D%0A%0D%0A%0D%0A%5Bcode%20lang%3D%22j" title="del.icio.us"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Finheritance-of-class-annotations-in-testng%2F&amp;title=Inheritance%20of%20class%20annotations%20in%20TestNG%20" title="DZone"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Finheritance-of-class-annotations-in-testng%2F&amp;title=Inheritance%20of%20class%20annotations%20in%20TestNG%20" title="Reddit"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Finheritance-of-class-annotations-in-testng%2F&amp;t=Inheritance%20of%20class%20annotations%20in%20TestNG%20" title="HackerNews"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Finheritance-of-class-annotations-in-testng%2F&amp;title=Inheritance%20of%20class%20annotations%20in%20TestNG%20&amp;annotation=Recently%20Oliver%20Fischer%20introduced%20TestNG%20at%20the%20Berlin-Brandenburg%20JUG.%20At%20one%20point%20there%20was%20an%20interesting%20discussion%20with%20the%20audience%20about%20class%20level%20annotations.%20Why%20should%20they%20be%20used%3F%20You%20can%20annotate%20a%20class%20like%20this%3A%0D%0A%0D%0A%0D%0A%5Bcode%20lang%3D%22j" title="Google Bookmarks"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Finheritance-of-class-annotations-in-testng%2F&amp;title=Inheritance%20of%20class%20annotations%20in%20TestNG%20&amp;bodytext=Recently%20Oliver%20Fischer%20introduced%20TestNG%20at%20the%20Berlin-Brandenburg%20JUG.%20At%20one%20point%20there%20was%20an%20interesting%20discussion%20with%20the%20audience%20about%20class%20level%20annotations.%20Why%20should%20they%20be%20used%3F%20You%20can%20annotate%20a%20class%20like%20this%3A%0D%0A%0D%0A%0D%0A%5Bcode%20lang%3D%22j" title="Digg"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Finheritance-of-class-annotations-in-testng%2F" title="Technorati"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Inheritance%20of%20class%20annotations%20in%20TestNG%20&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Finheritance-of-class-annotations-in-testng%2F" title="Slashdot"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" /></a>
	<a rel="nofollow"  href="mailto:?subject=Inheritance%20of%20class%20annotations%20in%20TestNG%20&amp;body=http%3A%2F%2Fwww.joergm.com%2F2009%2F04%2Finheritance-of-class-annotations-in-testng%2F" title="email"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.joergm.com/2009/04/inheritance-of-class-annotations-in-testng/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Super simple method to create a boolean decision table</title>
		<link>http://www.joergm.com/2009/03/super-simple-method-to-create-a-boolean-decision-table/</link>
		<comments>http://www.joergm.com/2009/03/super-simple-method-to-create-a-boolean-decision-table/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 20:44:02 +0000</pubDate>
		<dc:creator>Joerg</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[decision tables]]></category>

		<guid isPermaLink="false">http://www.brainoutprintln.com/?p=133</guid>
		<description><![CDATA[Today one of our test engineers, Manfred, presented about systematic identification of test values. One of the topics were decision tables. I was fascinated how easy he created tables with all possible combinations. Here is how: Write the conditions in seperate rows. Condition A Condition B Condition C Now make 2^n columns where n is [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Fsuper-simple-method-to-create-a-boolean-decision-table%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Fsuper-simple-method-to-create-a-boolean-decision-table%2F&amp;source=JoergM&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Today one of our test engineers, Manfred, presented about systematic identification of test values. One of the topics were decision tables. I was fascinated how easy he created tables with all possible combinations. Here is how:</p>
<ol>
<li>Write the conditions in seperate rows.</li>
<pre>
<pre class="brush: plain;">
Condition A
Condition B
Condition C
</pre>
</pre>
<li>Now make 2^n columns where n is the number of conditions.</li>
<pre>
<pre class="brush: plain;">
Condition A |   |   |   |   |   |   |   |   |
Condition B |   |   |   |   |   |   |   |   |
Condition C |   |   |   |   |   |   |   |   |
</pre>
</pre>
<li>Start at the bottom condition and write alternating Y and N.</li>
<pre>
<pre class="brush: plain;">
Condition A |   |   |   |   |   |   |   |   |
Condition B |   |   |   |   |   |   |   |   |
Condition C | Y | N | Y | N | Y | N | Y | N |
</pre>
</pre>
<li>Fill the next row with alternating Y Y N N &#8230;</li>
<pre>
<pre class="brush: plain;">
Condition A |   |   |   |   |   |   |   |   |
Condition B | Y | Y | N | N | Y | Y | N | N |
Condition C | Y | N | Y | N | Y | N | Y | N |
</pre>
</pre>
<li>Each row you double the number of consecutive Ys and Ns.</li>
<pre>
<pre class="brush: plain;">
Condition A | Y | Y | Y | Y | N | N | N | N |
Condition B | Y | Y | N | N | Y | Y | N | N |
Condition C | Y | N | Y | N | Y | N | Y | N |
</pre>
</pre>
<li>Do so until all rows are filled.</li>
<li>Now you can add your decisions to the table.</li>
<pre>
<pre class="brush: plain;">
Condition A | Y | Y | Y | Y | N | N | N | N |
Condition B | Y | Y | N | N | Y | Y | N | N |
Condition C | Y | N | Y | N | Y | N | Y | N |
---------------------------------------------
Decision 1  |   | X | X |   |   |   |   |   |
...
</pre>
</pre>
</ol>
<p>Using this algorithm you can be sure you covered all combinations. It doesn&#8217;t matter how many conditions you have and you don&#8217;t even have to think <img src='http://www.joergm.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Thanks Manfred!</p>




	<a rel="nofollow"  href="http://twitter.com/home?status=Super%20simple%20method%20to%20create%20a%20boolean%20decision%20table%20-%20http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Fsuper-simple-method-to-create-a-boolean-decision-table%2F" title="Twitter"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Fsuper-simple-method-to-create-a-boolean-decision-table%2F&amp;title=Super%20simple%20method%20to%20create%20a%20boolean%20decision%20table&amp;notes=Today%20one%20of%20our%20test%20engineers%2C%20Manfred%2C%20presented%20about%20systematic%20identification%20of%20test%20values.%20One%20of%20the%20topics%20were%20decision%20tables.%20I%20was%20fascinated%20how%20easy%20he%20created%20tables%20with%20all%20possible%20combinations.%20Here%20is%20how%3A%0D%0A%0D%0A%0D%0A%09Write%20the%20condi" title="del.icio.us"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Fsuper-simple-method-to-create-a-boolean-decision-table%2F&amp;title=Super%20simple%20method%20to%20create%20a%20boolean%20decision%20table" title="DZone"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Fsuper-simple-method-to-create-a-boolean-decision-table%2F&amp;title=Super%20simple%20method%20to%20create%20a%20boolean%20decision%20table" title="Reddit"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Fsuper-simple-method-to-create-a-boolean-decision-table%2F&amp;t=Super%20simple%20method%20to%20create%20a%20boolean%20decision%20table" title="HackerNews"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Fsuper-simple-method-to-create-a-boolean-decision-table%2F&amp;title=Super%20simple%20method%20to%20create%20a%20boolean%20decision%20table&amp;annotation=Today%20one%20of%20our%20test%20engineers%2C%20Manfred%2C%20presented%20about%20systematic%20identification%20of%20test%20values.%20One%20of%20the%20topics%20were%20decision%20tables.%20I%20was%20fascinated%20how%20easy%20he%20created%20tables%20with%20all%20possible%20combinations.%20Here%20is%20how%3A%0D%0A%0D%0A%0D%0A%09Write%20the%20condi" title="Google Bookmarks"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Fsuper-simple-method-to-create-a-boolean-decision-table%2F&amp;title=Super%20simple%20method%20to%20create%20a%20boolean%20decision%20table&amp;bodytext=Today%20one%20of%20our%20test%20engineers%2C%20Manfred%2C%20presented%20about%20systematic%20identification%20of%20test%20values.%20One%20of%20the%20topics%20were%20decision%20tables.%20I%20was%20fascinated%20how%20easy%20he%20created%20tables%20with%20all%20possible%20combinations.%20Here%20is%20how%3A%0D%0A%0D%0A%0D%0A%09Write%20the%20condi" title="Digg"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Fsuper-simple-method-to-create-a-boolean-decision-table%2F" title="Technorati"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Super%20simple%20method%20to%20create%20a%20boolean%20decision%20table&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Fsuper-simple-method-to-create-a-boolean-decision-table%2F" title="Slashdot"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" /></a>
	<a rel="nofollow"  href="mailto:?subject=Super%20simple%20method%20to%20create%20a%20boolean%20decision%20table&amp;body=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Fsuper-simple-method-to-create-a-boolean-decision-table%2F" title="email"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.joergm.com/2009/03/super-simple-method-to-create-a-boolean-decision-table/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tomahawk and Spring Webflow</title>
		<link>http://www.joergm.com/2009/03/tomahawk-and-spring-webflow/</link>
		<comments>http://www.joergm.com/2009/03/tomahawk-and-spring-webflow/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 07:21:43 +0000</pubDate>
		<dc:creator>Joerg</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[tomahawk]]></category>
		<category><![CDATA[webflow]]></category>

		<guid isPermaLink="false">http://www.brainoutprintln.com/?p=51</guid>
		<description><![CDATA[I recently ran into a configuration problem when using Apache Tomahawk and Spring Webflow together. When using some of the more advanced components like &#60;t:inputDate&#62; I got an error message: ... java.lang.IllegalStateException: ExtensionsFilter not correctly configured. JSF mapping missing. ... I did configure the MyFacesExtensionsFilter like shown in the documentation but that was not enough: [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Ftomahawk-and-spring-webflow%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Ftomahawk-and-spring-webflow%2F&amp;source=JoergM&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I recently ran into a configuration problem when using <a href="http://myfaces.apache.org/tomahawk/index.html">Apache Tomahawk</a> and <a href="http://www.springsource.org/webflow">Spring Webflow</a> together. When using some of the more advanced components like &lt;t:inputDate&gt; I got an error message:</p>
<pre>
<pre class="brush: plain;">
...
java.lang.IllegalStateException: ExtensionsFilter not correctly configured. JSF mapping missing.
...
</pre>
</pre>
<p>I did configure the MyFacesExtensionsFilter like shown in the documentation but that was not enough: </p>
<pre>
<pre class="brush: xml;">
 &lt;filter&gt;
    &lt;filter-name&gt;MyFacesExtensionsFilter&lt;/filter-name&gt;
    &lt;filter-class&gt;org.apache.myfaces.webapp.filter.ExtensionsFilter&lt;/filter-class&gt;
     ...
    &lt;/init-param&gt;
  &lt;/filter&gt;

  &lt;filter-mapping&gt;
    &lt;filter-name&gt;MyFacesExtensionsFilter&lt;/filter-name&gt;
    &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
  &lt;/filter-mapping&gt;
</pre>
</pre>
<p>After some debugging it turned out that this filter was never called. The solution is simple. When you combine Spring Webflow and JSF the Faces Servlet has no real function. It just needs to be there for some compatibility reasons. The real servlet that needs to be filtered is the <em>Spring MVC Dispatcher Servlet</em>. So you need to change the filter mapping like this: </p>
<pre>
<pre class="brush: xml;">
&lt;filter-mapping&gt;
    &lt;filter-name&gt;MyFacesExtensionsFilter&lt;/filter-name&gt;
    &lt;servlet-name&gt;Spring MVC Dispatcher Servlet&lt;/servlet-name&gt;
&lt;/filter-mapping&gt;
</pre>
</pre>
<p>This also applies for all other filters that are usually applied to the faces servlet, like the <a href="http://myfaces.apache.org/trinidad/index.html">Trinidad</a> filter. </p>




	<a rel="nofollow"  href="http://twitter.com/home?status=Tomahawk%20and%20Spring%20Webflow%20-%20http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Ftomahawk-and-spring-webflow%2F" title="Twitter"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Ftomahawk-and-spring-webflow%2F&amp;title=Tomahawk%20and%20Spring%20Webflow&amp;notes=I%20recently%20ran%20into%20a%20configuration%20problem%20when%20using%20Apache%20Tomahawk%20and%20Spring%20Webflow%20together.%20When%20using%20some%20of%20the%20more%20advanced%20components%20like%20%26lt%3Bt%3AinputDate%26gt%3B%20I%20got%20an%20error%20message%3A%0D%0A%0D%0A%0D%0A%5Bcode%5D%0D%0A...%0D%0Ajava.lang.IllegalStateException%3A%20Ex" title="del.icio.us"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Ftomahawk-and-spring-webflow%2F&amp;title=Tomahawk%20and%20Spring%20Webflow" title="DZone"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Ftomahawk-and-spring-webflow%2F&amp;title=Tomahawk%20and%20Spring%20Webflow" title="Reddit"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Ftomahawk-and-spring-webflow%2F&amp;t=Tomahawk%20and%20Spring%20Webflow" title="HackerNews"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Ftomahawk-and-spring-webflow%2F&amp;title=Tomahawk%20and%20Spring%20Webflow&amp;annotation=I%20recently%20ran%20into%20a%20configuration%20problem%20when%20using%20Apache%20Tomahawk%20and%20Spring%20Webflow%20together.%20When%20using%20some%20of%20the%20more%20advanced%20components%20like%20%26lt%3Bt%3AinputDate%26gt%3B%20I%20got%20an%20error%20message%3A%0D%0A%0D%0A%0D%0A%5Bcode%5D%0D%0A...%0D%0Ajava.lang.IllegalStateException%3A%20Ex" title="Google Bookmarks"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Ftomahawk-and-spring-webflow%2F&amp;title=Tomahawk%20and%20Spring%20Webflow&amp;bodytext=I%20recently%20ran%20into%20a%20configuration%20problem%20when%20using%20Apache%20Tomahawk%20and%20Spring%20Webflow%20together.%20When%20using%20some%20of%20the%20more%20advanced%20components%20like%20%26lt%3Bt%3AinputDate%26gt%3B%20I%20got%20an%20error%20message%3A%0D%0A%0D%0A%0D%0A%5Bcode%5D%0D%0A...%0D%0Ajava.lang.IllegalStateException%3A%20Ex" title="Digg"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Ftomahawk-and-spring-webflow%2F" title="Technorati"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Tomahawk%20and%20Spring%20Webflow&amp;url=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Ftomahawk-and-spring-webflow%2F" title="Slashdot"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" /></a>
	<a rel="nofollow"  href="mailto:?subject=Tomahawk%20and%20Spring%20Webflow&amp;body=http%3A%2F%2Fwww.joergm.com%2F2009%2F03%2Ftomahawk-and-spring-webflow%2F" title="email"><img src="http://www.joergm.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.joergm.com/2009/03/tomahawk-and-spring-webflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
