<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Groovy programming tips and tricks. Subscribe to this blog, make the switch from Java to Groovy and get more productive!</description><title>Groovy Programming</title><generator>Tumblr (3.0; @groovy-programming)</generator><link>http://groovy-programming.com/</link><item><title>Groovy annotations: @TupleConstructor</title><description>&lt;p&gt;If you use an inversion-of-control/dependency injection container like &lt;a href="http://picocontainer.org/"&gt;PicoContainer&lt;/a&gt; that favors constructor injection, you might have classes that look like this:&lt;/p&gt;
&lt;pre&gt;class Foo {

 Guh guh

 Keks keks

 Blorb blorb

 Foo(Guh guh, Keks keks, Blorb blorb) {
  this.guh = guh
  this.keks = keks
  this.blorb = blorb
 }

}
&lt;/pre&gt;
&lt;p&gt;Notice the constructor only sets fields? Why should you have to write this glue code yourself?&lt;/p&gt;
&lt;p&gt;Fortunately, since 1.8.0, Groovy has a &lt;a href="http://groovy.codehaus.org/gapi/groovy/transform/TupleConstructor.html"&gt;&lt;code&gt;@TupleConstructor&lt;/code&gt;&lt;/a&gt; annotation that removes the need for a constructor.&lt;/p&gt;
&lt;pre&gt;@TupleConstructor
class Foo {

 Guh guh

 Keks keks

 Blorb blorb

}
&lt;/pre&gt;
&lt;p&gt;Behind the scenes, Groovy will add an empty constructor, as well as &lt;code&gt;n&lt;/code&gt; new constructors, where n is the number of fields in the class. For the Foo class above, Groovy would add&lt;/p&gt;
&lt;pre&gt;class Foo {

 Foo() {}
 Foo(Guh guh) { … }
 Foo(Guh guh, Keks keks) { … }
 Foo(Guh guh, Keks keks, Blorb blorb) { … }

}
&lt;/pre&gt;
&lt;p&gt;So, the next time you come across constructors that merely set some fields, replace them with &lt;code&gt;@TupleConstructor&lt;/code&gt;.&lt;/p&gt;</description><link>http://groovy-programming.com/post/23298032023</link><guid>http://groovy-programming.com/post/23298032023</guid><pubDate>Fri, 18 May 2012 19:44:47 +0200</pubDate><category>groovy</category><category>annotation</category><category>constructor</category><category>dependency injection</category><category>ioc</category><category>inversion-of-control</category></item><item><title>Copy Properties or how to Clone a Class to a different Class</title><description>&lt;p&gt;&lt;a href="http://twitter.com/#!/renescheibe"&gt;René&lt;/a&gt; has asked me how to copy properties/fields of an instance of one class to an instance of another class. I.e. you have&lt;/p&gt;
&lt;pre&gt;class A {
    int a
}&lt;/pre&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;pre&gt;class B {
    int a
}&lt;/pre&gt;
&lt;p&gt;where B obviously does not extend A. You want to copy all properties of an instance of A to an instance of B.&lt;/p&gt;
&lt;h2&gt;Copy Properties&lt;/h2&gt;
&lt;p&gt;The solution is to access the &lt;code&gt;properties&lt;/code&gt; property of A, filter it to remove the &lt;code&gt;class&lt;/code&gt; and &lt;code&gt;metaClass&lt;/code&gt; fields (which can&amp;#8217;t be copied) and then use the &lt;a href="http://groovy.codehaus.org/api/groovy/lang/GroovyObject.html#setProperty%28java.lang.String,%20java.lang.Object%29"&gt;&lt;code&gt;GroovyObject#setProperty&lt;/code&gt;&lt;/a&gt; method on an instance of B.&lt;/p&gt;
&lt;pre&gt;class Copy {
	
	static GroovyObject copy(GroovyObject from, GroovyObject to) {
		from?.properties?.findAll { !(it.key =~ ~/(meta)?[cC]lass/) }?.each {
			try {
				to.setProperty(it.key, from[it.key])
			}
			catch (MissingPropertyException ex) {}
		}
		to
	}
	
	static &amp;lt;T&amp;gt; T copy(GroovyObject from, Class&amp;lt;T&amp;gt; to) {
		copy(from, to.newInstance())
	}

}
&lt;/pre&gt;
&lt;h2&gt;Clone a Class to a different Class&lt;/h2&gt;
&lt;p&gt;The code also lets you instantiate classes which is useful in case you want to clone an instance of A down its class hierarchy.&lt;/p&gt;
&lt;pre&gt;class A {
    int a
}

class C extends A {
 int foo
}
&lt;/pre&gt;
&lt;p&gt;Calling&lt;/p&gt;
&lt;pre&gt;A someA = new A(a: 42)
C someC = use (Copy) { someA.copy(C) }
&lt;/pre&gt;
&lt;p&gt;will give you a clone of A that is of type C.&lt;/p&gt;</description><link>http://groovy-programming.com/post/17161894018</link><guid>http://groovy-programming.com/post/17161894018</guid><pubDate>Mon, 06 Feb 2012 19:48:24 +0100</pubDate><category>class</category><category>cloning</category><category>clone</category><category>properties</category><category>property</category><category>field</category><category>fields</category><category>instance</category><category>cloning</category></item><item><title>Groovy programming with... with</title><description>&lt;p&gt;The &lt;a href="http://groovy.codehaus.org/groovy-jdk/java/lang/Object.html#with(groovy.lang.Closure)"&gt;&lt;code&gt;with&lt;/code&gt; method&lt;/a&gt;, which is added to all objects by Groovy, “allows the closure to be called for the object reference self.”&lt;/p&gt;
&lt;p&gt;This sounds a bit complicated so here are some easy use cases for &lt;code&gt;with&lt;/code&gt;:&lt;/p&gt;
&lt;h2&gt;Setting fields&lt;/h2&gt;
&lt;p&gt;Many APIs force you to do endless &lt;code&gt;obj.setSomething(something)&lt;/code&gt; calls. In Groovy, …&lt;/p&gt;
&lt;pre&gt;keks.setFoo(someFoo);
keks.setRolf(copter);
keks.setFnuh(guh);
&lt;/pre&gt;
&lt;p&gt;… becomes…&lt;/p&gt;
&lt;pre&gt;keks.with {
 foo = someFoo
 rolf = copter
 fnuh = guh
}
&lt;/pre&gt;
&lt;p&gt;PROTIP: This works great with the JEE &lt;code&gt;HttpServletRequest&lt;/code&gt; and &lt;code&gt;HttpServletResponse&lt;/code&gt; classes.&lt;/p&gt;
&lt;h2&gt;Removing temporary variables&lt;/h2&gt;
&lt;p&gt;Conditional blocks in which you access another property of the same object can look like this&lt;/p&gt;
&lt;pre&gt;if (new File('rofl').exists()) {
 assert new File('rofl').length() &amp;gt; 0;
}
&lt;/pre&gt;
&lt;p&gt;or you might be tempted to use a temporary variable&lt;/p&gt;
&lt;pre&gt;File f = new File('rofl');
if (f.exists()) {
 assert f.length() &amp;gt; 0;
}
&lt;/pre&gt;
&lt;p&gt;neither of which conveys that it’s all about the file. Groovy makes this easier and more readable:&lt;/p&gt;
&lt;pre&gt;new File('rofl').with {
 if (exists()) {
  assert length() &amp;gt; 0
 }
}
&lt;/pre&gt;
&lt;h2&gt;Harmonizing API access&lt;/h2&gt;
&lt;p&gt;By going with &lt;code&gt;with&lt;/code&gt;, you can turn any API, wether it’s fluent or setter-based into one simple, easy-to-read style.&lt;/p&gt;</description><link>http://groovy-programming.com/post/16069789641</link><guid>http://groovy-programming.com/post/16069789641</guid><pubDate>Wed, 18 Jan 2012 19:46:07 +0100</pubDate><category>groovy</category><category>with</category><category>method</category><category>clean</category><category>cleaner</category><category>code</category></item><item><title>Cleaner logging with Log4j, Commons Logging and java.util.logging</title><description>&lt;p&gt;Logging frameworks are the Java programmer&amp;#8217;s finger exercise &amp;#8212; think content management systems for PHP programmers.&lt;/p&gt;
&lt;p&gt;Most libraries these days use either Log4j or commons-logging, which is fine because &lt;a href="http://slf4j.org"&gt;SLF4J&lt;/a&gt; can replace commons-logging and redirect output from classes using either API to Log4j.&lt;/p&gt;
&lt;p&gt;Problems only arise when the odd library uses the java.util.logging log framework. Not only is it initialized globally, it also can&amp;#8217;t be replaced on the classpath because of its location in java.*. And its output is ugly.&lt;/p&gt;
&lt;p&gt;With the public interest in Log4j, commons-logging and java.util.logging something like 100&amp;#160;: 10&amp;#160;: 0.5 (source: AdWords), not even Sun using the JDK for leverage can turn a mediocre also-ran product into a winner.&lt;/p&gt;
&lt;p&gt;This means that java.util.logging must go. Thankfully, there&amp;#8217;s a SLF4JBridgeHandler in SLF4J, but how to replace java.util.logging loggers with the SLF4JBridgeHandler?&lt;/p&gt;
&lt;pre&gt;import java.util.logging.LogManager
import java.util.logging.Logger

import org.slf4j.bridge.SLF4JBridgeHandler

class KillJavaUtilLogging {

    static {
        Logger log = LogManager.logManager.getLogger('')
        while (log.parent) {
            log = log.parent
        }
        log.with {
            handlers.each { removeHandler(it) }
            addHandler(new SLF4JBridgeHandler())
        }
    }

}
&lt;/pre&gt;
&lt;p&gt;Now, simply mentioning KillJavaUtilLogging will redirect all java.util.logging output into SLF4J where it is logged using Log4j (or commons-logging, if you want).&lt;/p&gt;
&lt;pre&gt;class BlobFilter implements Filter {
    
    {
        KillJavaUtilLogging
    }
}
&lt;/pre&gt;
&lt;p&gt;The corresponding Maven POM dependencies might look like this:&lt;/p&gt;
&lt;pre&gt;		&amp;lt;dependency&amp;gt;
			&amp;lt;groupId&amp;gt;log4j&amp;lt;/groupId&amp;gt;
			&amp;lt;artifactId&amp;gt;log4j&amp;lt;/artifactId&amp;gt;
			&amp;lt;version&amp;gt;1.2.16&amp;lt;/version&amp;gt;
		&amp;lt;/dependency&amp;gt;
		&amp;lt;dependency&amp;gt;
			&amp;lt;groupId&amp;gt;org.slf4j&amp;lt;/groupId&amp;gt;
			&amp;lt;artifactId&amp;gt;slf4j-log4j12&amp;lt;/artifactId&amp;gt;
			&amp;lt;version&amp;gt;1.6.2&amp;lt;/version&amp;gt;
		&amp;lt;/dependency&amp;gt;
		&amp;lt;dependency&amp;gt;
			&amp;lt;groupId&amp;gt;org.slf4j&amp;lt;/groupId&amp;gt;
			&amp;lt;artifactId&amp;gt;jcl-over-slf4j&amp;lt;/artifactId&amp;gt;
			&amp;lt;version&amp;gt;1.6.2&amp;lt;/version&amp;gt;
		&amp;lt;/dependency&amp;gt;
		&amp;lt;dependency&amp;gt;
			&amp;lt;groupId&amp;gt;org.slf4j&amp;lt;/groupId&amp;gt;
			&amp;lt;artifactId&amp;gt;jul-to-slf4j&amp;lt;/artifactId&amp;gt;
			&amp;lt;version&amp;gt;1.6.2&amp;lt;/version&amp;gt;
		&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;</description><link>http://groovy-programming.com/post/10983645751</link><guid>http://groovy-programming.com/post/10983645751</guid><pubDate>Mon, 03 Oct 2011 19:10:32 +0200</pubDate><category>java</category><category>integration</category><category>logging</category><category>logger</category><category>log</category><category>log4j</category><category>commons</category><category>apache</category><category>commons-logging</category><category>clogging</category><category>java.util.logging</category><category>jul</category><category>maven</category><category>pom</category><category>pom.xml</category></item><item><title>CodeNarc for Eclipse released</title><description>&lt;p&gt;My friend &lt;a href="http://twitter.com/#!/renescheibe"&gt;&lt;span role="presentation" class="objectBox objectBox-string "&gt;René&lt;/span&gt;&lt;/a&gt; has released &lt;a href="http://codenarceclipse.sourceforge.net/"&gt;CodeNarc for Eclipse&lt;/a&gt; which integrates &lt;a href="http://codenarc.sourceforge.net/"&gt;CodeNarc&lt;/a&gt; into Eclipse.&lt;/p&gt;
&lt;p&gt;CodeNarc tries to find errors and potential problems in Groovy code. The &lt;a href="http://codenarc.sourceforge.net/codenarc-rules-basic.html"&gt;list of code checks&lt;/a&gt; is already quite large and covers a lot more than the basics (for example bitwise OR instead of boolean OR).&lt;/p&gt;
&lt;p&gt;If you find yourself writing more Groovy and less Java, it might make sense to expand  static analysis to dynamic code, just as it is normally done for Java with tools like PMD, CheckStyle or FindBugs.&lt;/p&gt;
&lt;p&gt;The Eclipse update sites are&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://codenarceclipse.sourceforge.net/eclipse/release/"&gt;&lt;a href="http://codenarceclipse.sourceforge.net/eclipse/release/"&gt;http://codenarceclipse.sourceforge.net/eclipse/release/&lt;/a&gt;&lt;/a&gt; for release builds&lt;/li&gt;
&lt;li&gt;&lt;a href="http://codenarceclipse.sourceforge.net/eclipse/snapshot/"&gt;&lt;a href="http://codenarceclipse.sourceforge.net/eclipse/snapshot/"&gt;http://codenarceclipse.sourceforge.net/eclipse/snapshot/&lt;/a&gt;&lt;/a&gt; for snapshot builds&lt;/li&gt;
&lt;/ul&gt;</description><link>http://groovy-programming.com/post/8965805542</link><guid>http://groovy-programming.com/post/8965805542</guid><pubDate>Mon, 15 Aug 2011 23:15:27 +0200</pubDate><category>static analysis</category><category>groovy</category><category>eclipse</category><category>plugin</category><category>plugins</category></item><item><title>Groovy operators: The spread operator is null-safe</title><description>&lt;p&gt;Groovy&amp;#8217;s spread operator lets you collect a property of objects from a collection. Here&amp;#8217;s an example:&lt;/p&gt;
&lt;pre&gt;[ 1, 2, 3 ]*.toString() == [ '1', '2', '3' ]&lt;/pre&gt;
&lt;p&gt;This is identical but shorter than calling&lt;/p&gt;
&lt;pre&gt;[ 1, 2, 3 ].collect { it.toString() }&lt;/pre&gt;
&lt;p&gt;Keep in mind that, just like &lt;code&gt;.collect&lt;/code&gt;, the spread operator is null-safe, i.E. both of these work without throwing any exceptions:&lt;/p&gt;
&lt;pre&gt;null*.toString()
[ 1, null, 3 ]*.toString()
&lt;/pre&gt;</description><link>http://groovy-programming.com/post/6899630959</link><guid>http://groovy-programming.com/post/6899630959</guid><pubDate>Sat, 25 Jun 2011 13:18:10 +0200</pubDate><category>spread</category><category>spread operator</category><category>operator</category><category>operators</category><category>groovy</category><category>null</category><category>null-safe</category></item><item><title>Performance of four methods of concatenating Strings...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_lllqixhqIf1qbau5mo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;h1&gt;Performance of four methods of concatenating Strings together&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;plus: &lt;code&gt;a + a&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;.concat: &lt;code&gt;a.concat(b)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;GString: &lt;code&gt;"${a}${b}".toString()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;left shift: &lt;code&gt;a &lt;&lt; b&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;.concat is the fastest method in all cases. If you’d like a more groovy version, &lt;code&gt;a &lt;&lt; b&lt;/code&gt; is faster than &lt;code&gt;a + b&lt;/code&gt;.&lt;/p&gt;</description><link>http://groovy-programming.com/post/5732276432</link><guid>http://groovy-programming.com/post/5732276432</guid><pubDate>Sun, 22 May 2011 16:49:45 +0200</pubDate><category>groovy</category><category>string</category><category>strings</category><category>performance</category><category>gstring</category><category>concat</category><category>leftShift</category></item><item><title>Java hangs when converting 2.2250738585072012e-308 -- prevent DOS attacks with Groovy</title><description>&lt;p&gt;&lt;a href="http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/"&gt;The big news now&lt;/a&gt; is that&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Java — both its runtime and compiler — go into an infinite loop when converting the decimal number 2.2250738585072012e-308 to double-precision binary floating-point.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This has a big impact on web applications since many of them use the &lt;code&gt;java.lang.Double#parseDouble(String)&lt;/code&gt; method with data input by the user.&lt;/p&gt;
&lt;p&gt;While I’m sure most programmers are aware of SQL injection, this is a new threat since user input is usually handled only with &lt;code&gt;try { double foo = Double.parseDouble(input); } catch (NumberFormatException ex) { /* Flip it and reverse it */ }&lt;/code&gt; which does not protect against the denial-of-service attack with the value mentioned above.&lt;/p&gt;
&lt;h2&gt;A Groovy Solution&lt;/h2&gt;
&lt;p&gt;Fortunately, Groovy makes it easy to protect yourself from this attack. A simple regular expression that tests for &lt;code&gt;/[eE]-\d*30\d/&lt;/code&gt; is all it takes.&lt;/p&gt;
&lt;p&gt;Here is an example of my &lt;a href="http://pearsoncorrelation.com"&gt;Pearson Correlation Calculator&lt;/a&gt;:&lt;/p&gt;
&lt;h3&gt;Vulnerable Code&lt;/h3&gt;
&lt;pre&gt;def calculateFromTwoColumns(String x, String y) {

    def xTokens = (x ?: '').tokenize(defaultSeparator)
    def yTokens = (y ?: '').tokenize(defaultSeparator)

    correlation(xTokens.collect { it as double }, yTokens.collect { it as double })

}&lt;/pre&gt;
&lt;h3&gt;Safe Code&lt;/h3&gt;
&lt;pre&gt;def calculateFromTwoColumns(String x, String y) {

    def xTokens = (x ?: '').tokenize(defaultSeparator).
        findAll { !(it =~ /[eE]-\d*30\d/).find() }
    def yTokens = (y ?: '').tokenize(defaultSeparator).
        findAll { !(it =~ /[eE]-\d*30\d/).find() }

    correlation(xTokens.collect { it as double }, yTokens.collect { it as double })

}&lt;/pre&gt;
&lt;p&gt;This will protect against all the values mentioned in the article, such as 0.00022250738585072012e-304, 00000000002.2250738585072012e-308, 2.225073858507201200000e-308, 2.2250738585072012e-00308, 2.2250738585072012997800001e-308.&lt;/p&gt;</description><link>http://groovy-programming.com/post/3072661748</link><guid>http://groovy-programming.com/post/3072661748</guid><pubDate>Wed, 02 Feb 2011 21:26:00 +0100</pubDate><category>dos</category><category>attack</category><category>denial of service</category><category>java</category><category>double</category><category>as double</category><category>toDouble</category><category>parseDouble</category></item><item><title>Count Words in Groovy</title><description>&lt;p&gt;This is a little snippet to show you how to get the word count of a text in Groovy.&lt;/p&gt;
&lt;pre&gt;def text = '''
right about now, the funk soul brother.
check it out now, the funk soul brother.
'''
int words = text
    .collect { it.charAt(0).digit || it.charAt(0).letter ? it : ' ' }
    .join('').tokenize(' ').size()
&lt;/pre&gt;</description><link>http://groovy-programming.com/post/981557418</link><guid>http://groovy-programming.com/post/981557418</guid><pubDate>Fri, 20 Aug 2010 10:24:48 +0200</pubDate><category>word</category><category>words</category><category>count</category><category>counting</category><category>groovy</category><category>snippet</category></item><item><title>Long number arithmetic problematic in Groovy</title><description>&lt;p&gt;When you divide &lt;code&gt;long&lt;/code&gt; numbers in Groovy, you are calling a recursive algorithm that only terminates once an Exception is thrown (&lt;code&gt;org.codehaus.groovy.runtime.typehandling.BigDecimalMath#normalize(BigDecimal)&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;This is not a good thing because with Groovy&amp;#8217;s inflated call stacks, it means that, for every long division, the entire stack is cloned. And that&amp;#8217;s costing CPU cycles and memory.&lt;/p&gt;
&lt;h2&gt;Problem&lt;/h2&gt;
&lt;pre&gt;long a = 100
long b = 10
double d = a / b
&lt;/pre&gt;
&lt;p&gt;Will cause an Exception to be thrown.&lt;/p&gt;
&lt;h2&gt;Solution&lt;/h2&gt;
&lt;pre&gt;long a = 100
long b = 10
double d = (double) a / b
&lt;/pre&gt;
&lt;p&gt;Will not cause an Exception to be thrown and will be faster in your average “container” environment.&lt;/p&gt;
&lt;h2&gt;Background&lt;/h2&gt;
&lt;p&gt;I noticed this when I was profiling &lt;a href="http://media.io"&gt;media.io&lt;/a&gt; in &lt;a href="http://yourkit.com"&gt;YourKit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When you write &lt;a href="http://pastebin.com/RYNuafRe"&gt;a simple test case&lt;/a&gt;, the numbers are very similar, but when you get stacks that are 30 or more stack elements deep, long division will become slower than double division:&lt;/p&gt;
&lt;pre&gt;Warming up, this could take 5 s or so
long: 1791
double: 2004
long (deep): 2138
&lt;/pre&gt;</description><link>http://groovy-programming.com/post/683498414</link><guid>http://groovy-programming.com/post/683498414</guid><pubDate>Thu, 10 Jun 2010 14:29:38 +0200</pubDate><category>groovy</category><category>arithmeticexception</category><category>number</category><category>long</category><category>exception</category><category>slow</category><category>slowdown</category><category>optimization</category><category>number</category><category>numbers</category><category>division</category><category>divide</category></item><item><title>"Groovy creates BigDecimal numbers deliberately. […] 3.5 is a BigDecimal, whereas 3.5f is a..."</title><description>“Groovy creates BigDecimal numbers deliberately. […] 3.5 is a BigDecimal, whereas 3.5f is a float or 3.5d is a double. Also, when creating variables, if you say double constant = 3.14, you’ll get the a double, although def constant = 3.14 will give you a BigDecimal.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Comment by Guillaume Laforge on &lt;a href="http://weblogs.java.net/blog/forax/archive/2010/05/24/jvm-language-developpers-your-house-burning#comment-14874"&gt;JVM Language developpers: Your house is burning&lt;/a&gt;.&lt;/em&gt;</description><link>http://groovy-programming.com/post/631803276</link><guid>http://groovy-programming.com/post/631803276</guid><pubDate>Tue, 25 May 2010 19:49:00 +0200</pubDate><category>number</category><category>double</category><category>bigdecimal</category><category>literal</category><category>performance</category><category>optimization</category></item><item><title>foo.class or foo.getClass()? Which one to use?</title><description>&lt;p&gt;Groovy converts calls to &lt;code&gt;foo.x&lt;/code&gt; to &lt;code&gt;foo.getX()&lt;/code&gt; – that’s common perception.&lt;/p&gt;
&lt;p&gt;Now, you might be tempted to write &lt;code&gt;foo.class&lt;/code&gt; to access the object’s class.&lt;/p&gt;
&lt;p&gt;But when you do that, sometimes &lt;code&gt;null&lt;/code&gt; is returned, depending on how much Groovy and Java there is in your project.&lt;/p&gt;
&lt;h2&gt;The reason&lt;/h2&gt;
&lt;p&gt;For Groovy objects – which is any class generated from a file with a &lt;code&gt;.groovy&lt;/code&gt; extension –, &lt;code&gt;foo.class&lt;/code&gt; will be mapped to &lt;code&gt;foo.getProperty('class')&lt;/code&gt; which is (most likely) null.&lt;/p&gt;
&lt;p&gt;In other words, &lt;code&gt;foo.class&lt;/code&gt; works for Java objects but probably not for Groovy objects, which is why you should use &lt;code&gt;foo.getClass()&lt;/code&gt;.&lt;/p&gt;</description><link>http://groovy-programming.com/post/624854643</link><guid>http://groovy-programming.com/post/624854643</guid><pubDate>Sun, 23 May 2010 14:36:13 +0200</pubDate><category>class</category><category>getclass</category><category>java</category><category>groovy</category><category>hybrid</category><category>error</category><category>errors</category><category>trap</category></item><item><title>Three good reasons for Groovy</title><description>&lt;ol&gt;&lt;li&gt;
&lt;h2&gt;It’s easy to learn&lt;/h2&gt;
&lt;p&gt;If you know Java, you know Groovy. You start by getting rid of boilerplate code such as casts, getters and setters and the &lt;code&gt;public&lt;/code&gt; keyword. And semicolons. Then, you replace tedious loops with &lt;code&gt;any&lt;/code&gt;, &lt;code&gt;each&lt;/code&gt;, &lt;a href="http://groovy-programming.com/post/516574575"&gt;&lt;code&gt;find&lt;/code&gt;&lt;/a&gt; and &lt;code&gt;findAll&lt;/code&gt;. &lt;a href="http://groovy-programming.com/post/507845186"&gt;Groovy’s operators&lt;/a&gt; and &lt;a href="http://groovy-programming.com/post/506426634"&gt;metaprogramming&lt;/a&gt; might come next.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h2&gt;Wide syntactic range&lt;/h2&gt;
&lt;p&gt;A while ago, I converted a Ruby script to Groovy and, while the Groovy version was a few characters shorter (thanks to the built-in &lt;a href="http://groovy.codehaus.org/groovy-jdk/java/util/Collection.html#sum()"&gt;sum method&lt;/a&gt;), it looked 99 % like the original Ruby script.&lt;/p&gt;
&lt;p&gt;When I was writing mostly Java, I thought it was designed to make everybody’s code look the same.&lt;/p&gt;
&lt;p&gt;I know now that Java doesn’t stop anyone from writing bad or unintelligible code so there’s no benefit of a language that always looks the same.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h2&gt;Killer productivity hacks&lt;/h2&gt;
&lt;p&gt;It’s easy to increase your productivity if all you know is Java. Groovy has its fair share of &lt;a href="http://groovy-programming.com/post/516574575"&gt;ways to make coding easier&lt;/a&gt;, but I assume every language has that these days, so let me show you something else.&lt;/p&gt;
&lt;p&gt;If you mistype a method name, Groovy suggests possible methods:&lt;/p&gt;
&lt;pre&gt;groovy.lang.MissingPropertyException:
No such property: stdErr for class: fnuh.Guh
Possible solutions: stderr, stdOut
&lt;/pre&gt;
&lt;p&gt;That’s smarter than necessary and you can find it at many places in Groovy.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;</description><link>http://groovy-programming.com/post/604773263</link><guid>http://groovy-programming.com/post/604773263</guid><pubDate>Sun, 16 May 2010 23:02:53 +0200</pubDate><category>groovy</category><category>language</category><category>design</category><category>java</category><category>comparison</category><category>design</category><category>benefit</category><category>benefits</category></item><item><title>as Groovy as it can go!</title><description>&lt;p&gt;“&lt;code&gt;as&lt;/code&gt;” is one of the wonderful little things in Groovy.&lt;/p&gt;
&lt;p&gt;Instead of boring you with what it is, I searched my workspace for my uses of “&lt;code&gt;as&lt;/code&gt;” and let the examples talk instead.&lt;/p&gt;
&lt;h2&gt;Closures and &lt;code&gt;as&lt;/code&gt; as a Replacement for Anonymous Inner Classes&lt;/h2&gt;
&lt;pre&gt;def nullIOFileFilter = { true } as IOFileFilter
&lt;/pre&gt;
&lt;p&gt;What it does: Creates a &lt;a href="http://java.sun.com/javase/6/docs/api/java/lang/reflect/Proxy.html"&gt;Proxy&lt;/a&gt; that implements &lt;a href="http://commons.apache.org/io/api-release/org/apache/commons/io/filefilter/IOFileFilter.html"&gt;IOFileFilter&lt;/a&gt; (from commons-io) with every method call on the proxy being delegated to the closures (which always returns &lt;code&gt;true&lt;/code&gt;). There are many interfaces with one or two methods in Java and this makes it effortless.&lt;/p&gt;
&lt;p&gt;The same in Java:&lt;/p&gt;
&lt;pre&gt;IOFileFilter filter = new IOFileFilter() {

    public boolean accept(File file) {
        return true;
    }

    public boolean accept(File dir, String name) {
        return true;
    }

};
&lt;/pre&gt;
&lt;h2&gt;&lt;code&gt;as&lt;/code&gt; for automatic Array Conversion&lt;/h2&gt;
&lt;pre&gt;['fnuh', 42, 'guh'] as String[]&lt;/pre&gt;
&lt;p&gt;What it does: Converts the list into a String array. This does more than just calling &lt;a href="http://java.sun.com/javase/6/docs/api/java/util/List.html#toArray()"&gt;List#toArray()&lt;/a&gt; because 42 clearly isn&amp;#8217;t a String but is converted to one.&lt;/p&gt;
&lt;p&gt;The same in Java:&lt;/p&gt;
&lt;pre&gt;String[] stringArray = new String[something.size()];
for (int i = 0; i &amp;lt; something.size(); ++i) {
    Object o = something.get(i);
    stringArray[i] = o instanceof String ? o : o.toString();
}
&lt;/pre&gt;
&lt;p&gt;Sorry, Java.&lt;/p&gt;
&lt;h2&gt;&lt;code&gt;as&lt;/code&gt; for String-to-Character Conversion&lt;/h2&gt;
&lt;pre&gt;'%' as char&lt;/pre&gt;
&lt;p&gt;What it does: Takes the first character of the String and returns it as &lt;code&gt;char&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;The desperate Pseudo Object&lt;/h2&gt;
&lt;pre&gt;{} as Configuration&lt;/pre&gt;
&lt;p&gt;What it does: Creates an object that implements Configuration but doesn&amp;#8217;t do anything. Useful in those cases where there are null checks in place but the object doesn&amp;#8217;t need to do anything. I touched this before in &lt;a href="http://groovy-programming.com/post/506426634"&gt;Dynamic Proxies with Metaprogramming&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Type Conversion&lt;/h2&gt;
&lt;pre&gt;foo(bla.keks as int, doStuff() as String)&lt;/pre&gt;
&lt;p&gt;What it does: Converts values to primitives and to Strings.&lt;/p&gt;</description><link>http://groovy-programming.com/post/538285066</link><guid>http://groovy-programming.com/post/538285066</guid><pubDate>Wed, 21 Apr 2010 15:48:00 +0200</pubDate><category>as</category><category>operator</category><category>operators</category><category>groovy</category><category>type</category><category>types</category><category>conversion</category><category>convert</category></item><item><title>Extend any class with Groovy's categories</title><description>&lt;p&gt;&lt;a href="http://groovy.codehaus.org/Category+and+Mixin+transformations"&gt;Groovy&amp;#8217;s category system&lt;/a&gt; lets you add new methods to any class. And that&amp;#8217;s more fun than you would think.&lt;/p&gt;
&lt;p&gt;Using categories combines a static method that takes an instance of the class as its first parameter and any number of additional parameters, the &lt;code&gt;use&lt;/code&gt; keyword and a closure:&lt;/p&gt;
&lt;pre&gt;class Foo {
 static Bar rofl(Keks k) {
  k.doIncredibleThings()
 }
}

Keks keks = createKeks()
use (Foo) {
 keks.rofl()
}
&lt;/pre&gt;
&lt;p&gt;Within the closure, every &lt;code&gt;Keks&lt;/code&gt; automagically has a &lt;code&gt;rofl&lt;/code&gt; method.&lt;/p&gt;
&lt;h2&gt;Example: Removing HTML from a String&lt;/h2&gt;
&lt;p&gt;Here, I&amp;#8217;ll use Groovy&amp;#8217;s categories to extend &lt;code&gt;java.lang.String&lt;/code&gt; with a function that removes HTML &lt;small&gt;(a &lt;code&gt;x.replaceAll('&amp;lt;[^&amp;gt;]+&amp;gt;', '')&lt;/code&gt; would have been enough, I know)&lt;/small&gt;.&lt;/p&gt;
&lt;p&gt;First, here&amp;#8217;s the method to strip HTML. It&amp;#8217;s written in Java – not for a particular reason, I just happened to have it laying around.&lt;/p&gt;
&lt;pre&gt;public class TextTools {

    public static CharSequence removeHTML(CharSequence s) {
        StrBuilder b = new StrBuilder(s.length());
        char c;
        for (int i = 0; i &amp;lt; s.length(); ++i) {
            if ((c = s.charAt(i)) != '&amp;lt;') {
                b.append(c);
            }
            else {
                while (i &amp;lt; s.length() &amp;amp;&amp;amp; s.charAt(i) != '&amp;gt;') {
                    ++i;
                }
            }
        }
        return b;
    }

}
&lt;/pre&gt;
&lt;p&gt;Note that this method assumes that the markup in the CharSequence is &lt;em&gt;well-formed&lt;/em&gt;. This is not going to be the case for every page on the web. If you need to parse real-world HTML, take a look at &lt;a href="http://groovy.codehaus.org/modules/http-builder/"&gt;HTTP Builder&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To use the method, I use the &lt;code&gt;TextTools&lt;/code&gt; category:&lt;/p&gt;
&lt;pre&gt;use (TextTools) {
 println '&amp;lt;foo&amp;gt;keks&amp;lt;/foo&amp;gt; bar &amp;lt;rofl blorb="bla"/&amp;gt;'.removeHTML()
}
&lt;/pre&gt;
&lt;p&gt;Now, every String inside the closure has a &lt;code&gt;removeHTML&lt;/code&gt; method.&lt;/p&gt;</description><link>http://groovy-programming.com/post/520850502</link><guid>http://groovy-programming.com/post/520850502</guid><pubDate>Wed, 14 Apr 2010 15:57:22 +0200</pubDate><category>closure</category><category>closures</category><category>use</category><category>keywords</category><category>keyword</category><category>extend</category><category>method</category><category>methods</category><category>string</category><category>category</category><category>categories</category></item><item><title>Simple mapping with Groovy: ISO-639</title><description>&lt;p&gt;One thing I&amp;#8217;m sure every programmer hates writing is mapping code – code that converts from one format to another.&lt;/p&gt;
&lt;p&gt;Glue code might come in second place. ;-)&lt;/p&gt;
&lt;p&gt;In this post, I&amp;#8217;ll show you how to make writing mapping code easier and faster with Groovy. We&amp;#8217;ll write an &lt;a href="http://www.sil.org/iso639-3/codes.asp?order=639_1&amp;amp;letter=%25"&gt;ISO-639&lt;/a&gt; converter in Groovy as an example of mapping – on one hand are English language names (such as &amp;#8220;German&amp;#8221; or &amp;#8220;Tibetan&amp;#8221;), on the other hand are two-character codes (&amp;#8220;de,&amp;#8221; &amp;#8220;bh&amp;#8221;).&lt;/p&gt;
&lt;p&gt;The first step is getting the data in a nice format. &lt;a href="http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes"&gt;Wikipedia&lt;/a&gt; has a nice table that I copied into OpenOffice. I then removed the unused columns and saved the data as CSV.&lt;/p&gt;
&lt;h2&gt;The Groovy Code&lt;/h2&gt;
&lt;pre&gt;class ISO639 {

	Map&amp;lt;String, String&amp;gt; nameTo639 = [:]

	String fromName(String name) {
		nameTo639[nameTo639.keySet().find { it.contains(name) }] ?: ''
	}
	
	String from639(String name) {
		nameTo639.entrySet().find { it.value.contains(name) }?.key ?: ''
	}
	
	String swap(String name) {
	    Map.Entry entry = nameTo639.entrySet().find {
                it.value.contains(name) || it.key.contains(name) }
	    (entry?.value?.contains(name) ? entry?.key : entry?.value) ?: '' 
	}

	ISO639() {
		new File(ISO639.getResource('iso-639-1.csv').file).eachLine {
			def parts = it.toLowerCase()
                            .replaceAll('"', '').tokenize('\t')
			nameTo639[parts[1]] = parts[0]
		}
	}

}&lt;/pre&gt;
&lt;p&gt;All complexity is reduced to a few &lt;code&gt;find&lt;/code&gt; method calls. By using find in combination with the &lt;a href="http://java.sun.com/javase/6/docs/api/java/util/Map.html#entrySet()"&gt;&lt;code&gt;entrySet&lt;/code&gt;&lt;/a&gt; method, mapping in any direction is totally easy and of course easier than in Java.&lt;/p&gt;</description><link>http://groovy-programming.com/post/516574575</link><guid>http://groovy-programming.com/post/516574575</guid><pubDate>Tue, 13 Apr 2010 00:02:00 +0200</pubDate><category>mapping</category><category>map</category><category>entryset</category><category>keyset</category><category>iso-639</category><category>find</category><category>iso-639-1</category></item><item><title>Groovy's in operator</title><description>&lt;p&gt;Groovy&amp;#8217;s &lt;code&gt;in&lt;/code&gt; operator roughly corresponds to Java&amp;#8217;s &lt;code&gt;instanceof&lt;/code&gt; operator. Like its Java counterpart, in lets you check if an object is of a certain type.&lt;/p&gt;
&lt;pre&gt;if (foo in Keks) doIt()&lt;/pre&gt;
&lt;p&gt;Unfortunately, you cannot shorten usage of the &lt;code&gt;in&lt;/code&gt; operator by combining multiple types in a list, like this example:&lt;/p&gt;
&lt;pre&gt;if (foo in [ Keks, Blorb, Rolf ]) doIt()&lt;/pre&gt;
&lt;p&gt;However, by using Groovy&amp;#8217;s &lt;a href="http://groovy.codehaus.org/groovy-jdk/java/util/Collection.html#find(groovy.lang.Closure)"&gt;&lt;code&gt;find&lt;/code&gt;&lt;/a&gt; method, we can express this in a pretty funky way:&lt;/p&gt;
&lt;pre&gt;if ([ Keks, Blorb, Rolf ].find { foo in it }) doIt()&lt;/pre&gt;
&lt;p&gt;In Java, this would be more repetitive to do:&lt;/p&gt;
&lt;pre&gt;if (foo instanceof Keks || foo instanceof Blorb || foo instanceof Rolf) doIt();&lt;/pre&gt;</description><link>http://groovy-programming.com/post/514058979</link><guid>http://groovy-programming.com/post/514058979</guid><pubDate>Mon, 12 Apr 2010 00:01:42 +0200</pubDate><category>groovy</category><category>in</category><category>operator</category><category>operators</category><category>instanceof</category></item><item><title>Default arguments in Groovy</title><description>&lt;p&gt;Groovy supports default arguments (otherwise known as optional parameters) in constructors and methods. This reduces boilerplate code.&lt;/p&gt;
&lt;h2&gt;Example Constructor Optional Parameter&lt;/h2&gt;
&lt;pre&gt;class Keks {
    Blorb blorb
    Keks(Blorb blorb = null) {
        this.blorb = blorb
    }
}&lt;/pre&gt;
&lt;p&gt;This lets you construct instances of &lt;code&gt;Keks&lt;/code&gt; by typing&lt;/p&gt;
&lt;pre&gt;Keks keks = new Keks()&lt;/pre&gt;
&lt;p&gt;as well as&lt;/p&gt;
&lt;pre&gt;Keks keks = new Keks(someBlorb)&lt;/pre&gt;
&lt;p&gt;Note that you can also call&lt;/p&gt;
&lt;pre&gt;Keks keks = new Keks(blorb: someBlorb)&lt;/pre&gt;
&lt;p&gt;The additional flexibility makes it easy to work with Inversion-of-Control containers because some favour &lt;a href="http://picocontainer.org"&gt;constructor injection&lt;/a&gt; and some prefer setter-based injection.&lt;/p&gt;
&lt;p&gt;Behind the scenes, Groovy creates a constructor for each variant.&lt;/p&gt;
&lt;h2&gt;Example Method Optional Parameter&lt;/h2&gt;
&lt;p&gt;Using default arguments/optional arguments in methods works just like in constructors:&lt;/p&gt;
&lt;pre&gt;class Keks {
 def foo(Rolf copter = null) {
  copter?.lol()
 }
}
&lt;/pre&gt;
&lt;p&gt;Now, you can call…&lt;/p&gt;
&lt;pre&gt;new Keks().foo()&lt;/pre&gt;
&lt;p&gt;…and…&lt;/p&gt;
&lt;pre&gt;new Keks().foo(roflCopter)&lt;/pre&gt;</description><link>http://groovy-programming.com/post/511516055</link><guid>http://groovy-programming.com/post/511516055</guid><pubDate>Sat, 10 Apr 2010 23:59:42 +0200</pubDate><category>groovy</category><category>default</category><category>optional</category><category>parameter</category><category>parameters</category><category>method</category><category>constructor</category></item><item><title>Useful Groovy Operators</title><description>&lt;p&gt;Groovy adds a number of interesting operators that make some things that are tedious to do in Java very easy.&lt;/p&gt;
&lt;h2&gt;The Elvis&amp;#160;?: Operator&lt;/h2&gt;
&lt;p&gt;The &lt;a href="http://groovy.codehaus.org/Operators#Operators-ElvisOperator(%3F%3A)"&gt;Elvis operator&lt;/a&gt; is a compact way to express defaults in case an expression evaluates to false.&lt;/p&gt;
&lt;pre&gt;cache[name] = obj ?: NULL&lt;/pre&gt;
&lt;p&gt;This adds &lt;code&gt;obj&lt;/code&gt; with a key of &lt;code&gt;name&lt;/code&gt; to &lt;code&gt;cache&lt;/code&gt;, substituting an Object called &lt;code&gt;NULL&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; evaluates to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In Java, the code is less legible:&lt;/p&gt;
&lt;pre&gt;cache.put(name, obj == null ? NULL : obj);&lt;/pre&gt;
&lt;p&gt;Note that you can chain expressions with the Elvis operator:&lt;/p&gt;
&lt;pre&gt;keks(env.blorb ?: d.blorb ?: 'rolf')&lt;/pre&gt;
&lt;h2&gt;The Safe Navigation Operator&lt;/h2&gt;
&lt;p&gt;The &lt;a href="http://groovy.codehaus.org/Operators#Operators-SafeNavigationOperator(%3F.)"&gt;safe navigation operator&lt;/a&gt; lets you use path expressions without fear of NullPointerExceptions. It removes the need for &lt;code&gt;if&lt;/code&gt; statements or ternary expressions that would be necessary in Java to guard against &lt;code&gt;null&lt;/code&gt; objects.&lt;/p&gt;
&lt;pre&gt;doIt(env.lol?.toInteger() ?: 20)&lt;/pre&gt;
&lt;p&gt;In this example that uses both the safe navigation and Elvis operators, if &lt;code&gt;env.lol&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;, &lt;code&gt;toInteger()&lt;/code&gt; is not called and the default of 20 used.&lt;/p&gt;
&lt;p&gt;The identical Java code would look like this:&lt;/p&gt;
&lt;pre&gt;doIt(env.getLol() == null ? 20 : Integer.parseInt(env.getLol()))&lt;/pre&gt;
&lt;p&gt;Note that using the safe navigation operator does not cancel the evaluation of the expression. If &lt;code&gt;foo&lt;/code&gt; returns &lt;code&gt;null&lt;/code&gt;, …&lt;/p&gt;
&lt;pre&gt;wah.foo?.blorb.keks&lt;/pre&gt;
&lt;p&gt;…this will still throw a NullPointerException.&lt;/p&gt;
&lt;h2&gt;The Spread Operator&lt;/h2&gt;
&lt;p&gt;The &lt;a href="http://groovy.codehaus.org/Operators#Operators-SpreadOperator(.)"&gt;spread operator&lt;/a&gt;, when used on a Collection, returns the result of calling the method on each element of the Collection. Here&amp;#8217;s an example:&lt;/p&gt;
&lt;pre&gt;Collection&amp;lt;Future&amp;lt;?&amp;gt;&amp;gt; futures = // submit some jobs to a queue
Collection&amp;lt;?&amp;gt; objects = futures*.get()&lt;/pre&gt;
&lt;p&gt;This is identical to&lt;/p&gt;
&lt;pre&gt;Collection&amp;lt;Future&amp;lt;?&amp;gt;&amp;gt; futures = // submit some jobs to a queue
Collection&amp;lt;?&amp;gt; objects = futures.collect { it.get() }&lt;/pre&gt;</description><link>http://groovy-programming.com/post/507845186</link><guid>http://groovy-programming.com/post/507845186</guid><pubDate>Fri, 09 Apr 2010 10:52:00 +0200</pubDate><category>operator</category><category>operators</category><category>elvis operator</category><category>spread operator</category><category>safe navigation operator</category></item><item><title>Dynamic Proxies with Metaprogramming</title><description>&lt;p&gt;Groovy&amp;#8217;s metaprogramming features are wonderful.&lt;/p&gt;
&lt;p&gt;In this example, we combine Groovy&amp;#8217;s as automatic Proxy conversion with metaprogramming to create a simple stub for an interface.&lt;/p&gt;
&lt;h2&gt;Automatic Proxies&lt;/h2&gt;
&lt;p&gt;Two ways in Groovy to create an implementation of an interface at runtime are: One based on Closures and one based on Maps.&lt;/p&gt;
&lt;p&gt;The Closure version usually looks like this&lt;/p&gt;
&lt;pre&gt;{ it -&amp;gt; it?.toString() } as Foo&lt;/pre&gt;
&lt;p&gt;The Map-based version looks like this:&lt;/p&gt;
&lt;pre&gt;[ foo: { 'bar' }, keks: { 'blub' } ] as Rofl&lt;/pre&gt;
&lt;h2&gt;Combining Automatic Proxies with Metaprogramming&lt;/h2&gt;
&lt;pre&gt;Configuration configuration = {} as Configuration
configuration.metaClass.getProperty = { name -&amp;gt;
	switch (name) {
		case 'foo': return 'bar'
		case 'keks': return 42
		case 'blub': return 21
		default: 0
	}
}
&lt;/pre&gt;
&lt;p&gt;The first line creates a proxy that implements the &lt;code&gt;Configuration&lt;/code&gt; interface. This proxy delegates all method calls to the empty closure &lt;code&gt;{}&lt;/code&gt;. Surprisingly, this closure doesn&amp;#8217;t actually need to do something.&lt;/p&gt;
&lt;p&gt;The second line appends a &lt;code&gt;getProperty&lt;/code&gt; method to the meta class of the proxy (whose class was generated at runtime). The closure has some values hard-coded in it that I need, but nothing else.&lt;/p&gt;
&lt;p&gt;You&amp;#8217;ll also note that I use Groovy &lt;em&gt;typed&lt;/em&gt;. I don&amp;#8217;t do this all the time but I think it makes understanding the code easier, helps with the &lt;a href="http://groovy.codehaus.org/Eclipse+Plugin"&gt;Groovy Eclipse Plugin&lt;/a&gt; and it might also come in useful once Groovy gets &lt;a href="http://code.google.com/p/groovypptest/"&gt;a little bit less dynamic&lt;/a&gt; again.&lt;/p&gt;</description><link>http://groovy-programming.com/post/506426634</link><guid>http://groovy-programming.com/post/506426634</guid><pubDate>Thu, 08 Apr 2010 22:41:00 +0200</pubDate><category>metaprogramming</category><category>proxy</category><category>proxies</category><category>dynamic</category><category>map</category><category>closure</category><category>stub</category><category>test</category><category>testing</category></item></channel></rss>

