<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>Gooder Code</title>
	<atom:link href="http://www.goodercode.com/wp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.goodercode.com/wp</link>
	<description>Me code gooder one day (and more fastly)</description>
	<pubDate>Tue, 17 Aug 2010 14:41:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Intercept method calls in Groovy for automatic type conversion</title>
		<link>http://www.goodercode.com/wp/intercept-method-calls-groovy-type-conversion/</link>
		<comments>http://www.goodercode.com/wp/intercept-method-calls-groovy-type-conversion/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 11:28:00 +0000</pubDate>
		<dc:creator>kerry</dc:creator>
		
		<category><![CDATA[Lessons]]></category>

		<category><![CDATA[groovy]]></category>

		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.goodercode.com/wp/intercept-method-calls-groovy-type-conversion/</guid>
		<description><![CDATA[
One of the cooler things you can do with groovy is automatic type conversion.&#160; If you want to convert an object to another type, many times all you have to do is invoke the ‘as’ keyword:
def letters = 'abcdefghijklmnopqrstuvwxyz' as List
But, what if you are wanting to do something a little fancier, like converting a [...]]]></description>
			<content:encoded><![CDATA[<p><script language="javascript" src="/js/syntaxhighlighter_2.1.364/scripts/shBrushGroovy.js"></script>
<p>One of the cooler things you can do with groovy is automatic type conversion.&#160; If you want to convert an object to another type, many times all you have to do is invoke the ‘as’ keyword:</p>
<pre class="brush: groovy">def letters = 'abcdefghijklmnopqrstuvwxyz' as List</pre>
<p>But, what if you are wanting to do something a little fancier, like converting a String to a Date? </p>
<pre class="brush: groovy">def christmas = '12-25-2010' as Date

ERROR org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '12-25-2010' with class java.lang.String' to class 'java.util.Date'</pre>
<p>No bueno!</p>
<p>I want to be able to do custom type conversions so that my application can do a simple String to Date conversion. Enter the metaMethod. You can <em>intercept method calls in Groovy</em> using the following method: </p>
<pre class="brush: groovy">def intercept(name, params, closure) {
  def original = from.metaClass.getMetaMethod(name, params)
  from.metaClass[name] = { Class clazz -&gt;
    closure()
    original.doMethodInvoke(delegate, clazz)
  }
}</pre>
<p>Using this method, and a little syntactic sugar, we create the following &#8216;Convert&#8217; class: </p>
<pre class="brush: groovy">// Convert.from( String ).to( Date ).using { }
class Convert {

    private from

    private to

    private Convert(clazz) { from = clazz }

    static def from(clazz) {
        new Convert(clazz)
    }

    def to(clazz) {
        to = clazz
        return this
    }

    def using(closure) {
        def originalAsType = from.metaClass.getMetaMethod('asType', [] as Class[])
        from.metaClass.asType = { Class clazz -&gt;
            if( clazz == to ) {
                closure.setProperty('value', delegate)
                closure(delegate)
            } else {
                originalAsType.doMethodInvoke(delegate, clazz)
            }
        }
    }
}</pre>
<p>Now, we can make the following statement to add the automatic date conversion: </p>
<pre class="brush: groovy">Convert.from( String ).to( Date ).using { new java.text.SimpleDateFormat('MM-dd-yyyy').parse(value) }

def christmas = '12-25-2010' as Date</pre>
<p>Groovy baby!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.goodercode.com/wp/intercept-method-calls-groovy-type-conversion/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Absent Code attribute in method that is not native or abstract</title>
		<link>http://www.goodercode.com/wp/absent-code-attribute-in-method-that-is-not-native-or-abstract/</link>
		<comments>http://www.goodercode.com/wp/absent-code-attribute-in-method-that-is-not-native-or-abstract/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 20:44:37 +0000</pubDate>
		<dc:creator>kerry</dc:creator>
		
		<category><![CDATA[Lessons]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://www.goodercode.com/wp/?p=145</guid>
		<description><![CDATA[I got the following, quite puzzling error today when running a unit test:
java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/http/Cookie
A google search found this post, which explains that it is caused by having an interface in the classpath, and not an actual implementation.
In this case it&#8217;s the [...]]]></description>
			<content:encoded><![CDATA[<p><script language="javascript" src="/js/syntaxhighlighter_2.1.364/scripts/shBrushXml.js"></script><script language="javascript" src="/js/syntaxhighlighter_2.1.364/scripts/shBrushPlain.js"></script>I got the following, quite puzzling error today when running a unit test:</p>
<pre class="brush: plain">java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/http/Cookie</pre>
<p>A google search found <a href="http://www.andrejkoelewijn.com/wp/2010/03/04/absent-code-attribute-in-method-that-is-not-native-or-abstract/">this post</a>, which explains that it is caused by having an interface in the classpath, and not an actual implementation.</p>
<p>In this case it&#8217;s the java-ee interface.  To fix this I added the jetty servlet api implementation to my pom:</p>
<pre class="brush: xml">
    <dependency>
        <groupId>jetty</groupId>
        <artifactId>javax.servlet</artifactId>
        <scope>test</scope>
    </dependency>
</pre>
<p>Piece of cake.  I have run in to this before, so I figured I would capture the fix here in case I run in to it again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.goodercode.com/wp/absent-code-attribute-in-method-that-is-not-native-or-abstract/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Naming your unit tests</title>
		<link>http://www.goodercode.com/wp/naming-your-unit-tests/</link>
		<comments>http://www.goodercode.com/wp/naming-your-unit-tests/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 15:00:40 +0000</pubDate>
		<dc:creator>kerry</dc:creator>
		
		<category><![CDATA[Lessons]]></category>

		<category><![CDATA[agile]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[unit tests]]></category>

		<guid isPermaLink="false">http://www.goodercode.com/wp/?p=137</guid>
		<description><![CDATA[When you create a test for your class, what kind of naming convention do you use for the tests?  How thorough are your tests?  I have lately switched from the conventional camel case test names to lower case letters with underscores.  I have found this increases the readability and causes me to [...]]]></description>
			<content:encoded><![CDATA[<p><script language="javascript" src="/js/syntaxhighlighter_2.1.364/scripts/shBrushJava.js"></script>When you create a test for your class, what kind of naming convention do you use for the tests?  How thorough are your tests?  I have lately switched from the conventional camel case test names to lower case letters with underscores.  I have found this increases the readability and causes me to write better tests.</p>
<p>A simple utility class:</p>
<pre class="brush: java">

public class ArrayUtils {

  public static < T > T[] gimmeASlice(T[] anArray, Integer start, Integer end) {
    // implementation (feeling lazy today)
  }

}
</pre>
<p>I have seen some people who would write a test like this:</p>
<pre class="brush: java">

public class ArrayUtilsTest {

  @Test
  public void testGimmeASliceMethod() {
    // do some tests
  }
}
</pre>
<p>A more thorough and readable test would be:</p>
<pre class="brush: java">
public class ArrayUtilsTest {

  @Test
  public void gimmeASlice_returns_appropriate_slice() {
    // ...
  }

  @Test
  public void gimmeASlice_throws_NullPointerException_when_passed_null() {
    // ...
  }

  @Test
  public void gimmeASlice_returns_end_of_array_when_slice_is_partly_out_of_bounds() {
   // ...
  }

  @Test
  public void gimmeASlice_returns_empty_array_when_slice_is_completely_out_of_bounds() {
    // ...
  }
}
</pre>
<p>Looking at this test, you have no doubt what the method is supposed to do.  And, when one fails, you will know exactly what the issue is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.goodercode.com/wp/naming-your-unit-tests/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using runtime generic type reflection to build a smarter DAO</title>
		<link>http://www.goodercode.com/wp/java-reflection-runtime-generic-type/</link>
		<comments>http://www.goodercode.com/wp/java-reflection-runtime-generic-type/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 14:52:55 +0000</pubDate>
		<dc:creator>kerry</dc:creator>
		
		<category><![CDATA[Lessons]]></category>

		<category><![CDATA[generics]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[reflection]]></category>

		<guid isPermaLink="false">http://www.goodercode.com/wp/?p=127</guid>
		<description><![CDATA[Have you ever wished you could get the runtime type of your generic class?  I wonder why they didn&#8217;t put this in the language.  It is possible, however, with reflection:
Consider a data access object (DAO) (note: I had to use brackets b/c the arrows were messing with wordpress):

public interface Identifiable {

   [...]]]></description>
			<content:encoded><![CDATA[<p><script language="javascript" src="/js/syntaxhighlighter_2.1.364/scripts/shBrushJava.js"></script>Have you ever wished you could get the runtime type of your generic class?  I wonder why they didn&#8217;t put this in the language.  It is possible, however, with reflection:</p>
<p>Consider a data access object (DAO) (note: I had to use brackets b/c the arrows were messing with wordpress):</p>
<pre class="brush: java">
public interface Identifiable {

   public Long getId();

}

public interface Dao< T extends Identifiable > {

  public T findById(Long id);

  public void save(T obj);

  public void delete(T obj);

}
</pre>
<p>Using reflection, we can create a DAO implementation base class, HibernateDao, that will work for any object:</p>
<pre class="brush: java">

import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;

public class HibernateDao< T extends Identifiable> implements Dao< T > {

  private final Class clazz;

  public HibernateDao(Session session) {
    // the magic
    ParameterizedType parameterizedType = (ParameterizedType) clazz.getGenericSuperclass();
    return (Class) parameterizedType.getActualTypeArguments()[0];
  }

  public T findById(Long id) {
    return session.get(clazz, id);
  }

  public void save(T obj) {
    session.saveOrUpdate(obj);
  }

  public void delete(T obj) {
    session.delete(obj);
  }
}
</pre>
<p>Then, all we have to do is extend from the class:</p>
<pre class="brush: java">
public class BookDaoHibernateImpl extends HibernateDao< Book > {

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.goodercode.com/wp/java-reflection-runtime-generic-type/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Subscribe to gooder code via email!</title>
		<link>http://www.goodercode.com/wp/subscribe-to-gooder-code-via-email/</link>
		<comments>http://www.goodercode.com/wp/subscribe-to-gooder-code-via-email/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 13:52:00 +0000</pubDate>
		<dc:creator>kerry</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.goodercode.com/wp/subscribe-to-gooder-code-via-email/</guid>
		<description><![CDATA[I have added a new feature to the blog.&#160; Email subscriptions!&#160; 
If you signup using the form on the right rail, you will receive email notifications when I make a new post.&#160; These are delivered by Feedburner.&#160; So signup, it’s fast, and convenient.
And if you are reading this post in your email reader, thanks for [...]]]></description>
			<content:encoded><![CDATA[<p>I have added a new feature to the blog.&#160; Email subscriptions!&#160; </p>
<p>If you signup using the form on the right rail, you will receive email notifications when I make a new post.&#160; These are delivered by Feedburner.&#160; So signup, it’s fast, and convenient.</p>
<p>And if you are reading this post in your email reader, thanks for signing up!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.goodercode.com/wp/subscribe-to-gooder-code-via-email/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Javascript Syntax Highlighter</title>
		<link>http://www.goodercode.com/wp/javascript-syntax-highlighter/</link>
		<comments>http://www.goodercode.com/wp/javascript-syntax-highlighter/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 13:49:00 +0000</pubDate>
		<dc:creator>kerry</dc:creator>
		
		<category><![CDATA[Developer Tools]]></category>

		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.goodercode.com/wp/javascript-syntax-highlighter/</guid>
		<description><![CDATA[I just want to do a quick shout out to Alex Gorbatchev for his most excellent Javascript syntax highlighter.&#160; I installed it to the blog and am very happy about it.&#160; You can now hover over code snippets and copy+paste, view, or print the code.
So, if you have a blog or other use for it, [...]]]></description>
			<content:encoded><![CDATA[<p>I just want to do a quick shout out to Alex Gorbatchev for his most excellent <a href="http://alexgorbatchev.com/SyntaxHighlighter/" target="_blank">Javascript syntax highlighter</a>.&#160; I installed it to the blog and am very happy about it.&#160; You can now hover over code snippets and copy+paste, view, or print the code.</p>
<p>So, if you have a blog or other use for it, I highly recommend it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.goodercode.com/wp/javascript-syntax-highlighter/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Quit your shitty job!</title>
		<link>http://www.goodercode.com/wp/quit-your-shitty-job/</link>
		<comments>http://www.goodercode.com/wp/quit-your-shitty-job/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 15:41:00 +0000</pubDate>
		<dc:creator>kerry</dc:creator>
		
		<category><![CDATA[Lessons]]></category>

		<category><![CDATA[agile]]></category>

		<category><![CDATA[process]]></category>

		<guid isPermaLink="false">http://www.goodercode.com/wp/quit-your-shitty-job/</guid>
		<description><![CDATA[As a developer, what happens when you are running late on a deadline?  Do you work late for more pay?  Do you get chewed out?  What happens if a feature fails to deliver the business value that was expected?  Is it your responsibility?]]></description>
			<content:encoded><![CDATA[<p>As a developer, what happens when you are running late on a deadline?&#160; Do you work late for more pay?&#160; Do you get chewed out?&#160; What happens if a feature fails to deliver the business value that was expected?&#160; Is it your responsibility?</p>
<p>Too often in the software development industry this is the case.&#160; Developers are not given the respect afforded other professionals.&#160; Instead, there is a perception that they are underperforming, lacking skills, or irresponsible.&#160; There is no concept of total team effort.</p>
<p>What is total team effort?</p>
<p>What if, instead of blaming the developers, missed deadlines are the result of a failure in planning, or a lack of resources?&#160; The failure needs to be identified, and corrected in a respectful manner.&#160; Only then can you take corrective measures to insure it doesn’t happen again.&#160; Does your company have a process for regularly analyzing workflow?&#160; </p>
<p>I recently had a job interview with a company where the representative practically bragged about making their developers work long hours under duress.&#160; This is not an environment I care to subject myself to.&#160; Nor would any other talented developers that I know.&#160; Who suffers?&#160; The business suffers.&#160; Product development suffers.&#160; When we fail to deliver value to the business on a regular basis, they start to question our worth.&#160; It’s a cyclical, self-feeding trend.&#160; One that I don’t want to be a part of, and you shouldn’t either.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.goodercode.com/wp/quit-your-shitty-job/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Cucumber tests with Maven and Java</title>
		<link>http://www.goodercode.com/wp/using-cucumber-tests-with-maven-and-java/</link>
		<comments>http://www.goodercode.com/wp/using-cucumber-tests-with-maven-and-java/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 16:28:35 +0000</pubDate>
		<dc:creator>kerry</dc:creator>
		
		<category><![CDATA[Lessons]]></category>

		<category><![CDATA[cucumber]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://www.goodercode.com/wp/?p=85</guid>
		<description><![CDATA[What's that?  You like using Cucumber and want to use it with your Java project but your company ecosystem is not hip to JRuby?  Enter the cukes4duke project, which allows you to run cucumber with most JVM-based languages.]]></description>
			<content:encoded><![CDATA[<p><script src="/js/syntaxhighlighter_2.1.364/scripts/shBrushCucumber.js"></script><script src="/js/syntaxhighlighter_2.1.364/scripts/shBrushBash.js"></script><script src="/js/syntaxhighlighter_2.1.364/scripts/shBrushXml.js"></script><script src="/js/syntaxhighlighter_2.1.364/scripts/shBrushPlain.js"></script><script src="/js/syntaxhighlighter_2.1.364/scripts/shBrushJava.js"></script>Want to jump right in?  I have zipped up a working project, with examples.  You can download it <a href="/resources/maven-cuke.zip">here</a>.</p>
<p>What&#8217;s that?  You like using <a href="http://cukes.info/" target="_blank">Cucumber</a> and want to use it with your Java project but your company ecosystem is not hip to JRuby?  Enter the <a href="http://wiki.github.com/aslakhellesoy/cuke4duke/" target="_blank">cukes4duke</a> project, which allows you to run cucumber with most JVM-based languages.  I am focusing on running it with the <a href="http://maven.apache.org/" target="_blank">Maven</a> plugin.  This tutorial assumes you have maven installed, and Java knowledge.</p>
<p>Before you start, you must run the following goal.  It will install JRuby and the gems to your .m2 repository.</p>
<pre class="brush: bash">mvn -Dcucumber.installGems=true cuke4duke:cucumber</pre>
<p>Then add the following to your pom:</p>
<pre class="brush: xml">
    <repositories>
        <repository>
            <id>codehaus</id>
            <url>http://repository.codehaus.org</url>
        </repository>
        <repository>
            <id>cukes</id>
            <url>http://cukes.info/maven</url>
        </repository>
    </repositories>
<pluginRepositories>
<pluginRepository>
            <id>cukes</id>
            <url>http://cukes.info/maven</url>
        </pluginRepository>
    </pluginRepositories>
<properties>
        <cuke4duke.version>0.3.2</cuke4duke.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>cuke4duke</groupId>
            <artifactId>cuke4duke</artifactId>
            <version>${cuke4duke.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.picocontainer</groupId>
            <artifactId>picocontainer</artifactId>
            <version>2.8.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
<plugins>
<plugin>
                <groupId>cuke4duke</groupId>
                <artifactId>cuke4duke-maven-plugin</artifactId>
                <version>${cuke4duke.version}</version>
                <configuration>
                    <jvmArgs>
                        <jvmArg>
                  -Dcuke4duke.objectFactory=cuke4duke.internal.jvmclass.PicoFactory
                        </jvmArg>
                        <jvmArg>${cucumber.debug}</jvmArg>
                    </jvmArgs>
                    <cucumberArgs>
                        <cucumberArg>${basedir}/target/test-classes</cucumberArg>
                        <cucumberArg>--tags ~@wip</cucumberArg>
                    </cucumberArgs>
                    <gems>
                        <gem>install cuke4duke --version ${cuke4duke.version}</gem>
                    </gems>
                </configuration>
                <executions>
                    <execution>
                        <id>run-features</id>
<phase>integration-test</phase>
                        <goals>
                            <goal>cucumber</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</pre>
<p>Next, create a feature file under the &#8216;features&#8217; directory (at the root of your project).</p>
<p>features/example.feature:</p>
<pre class="brush: cucumber">Feature: Example of a feature file
  As some aspiring cuke4duke user
  I want an example of how it works
  So that I can easily setup my project to use it

  # This should pass
  Scenario: A simple passing scenario
    Given the letter 'A'
    When I check the letter
    Then the letter should be 'A'</pre>
<p>Then, create a &#8217;step&#8217; class under src/test/java/cukes:</p>
<p>src/test/java/cukes/CukeSteps.java:</p>
<pre class="brush: java">package cukes;

import cuke4duke.annotation.I18n.EN.Given;
import cuke4duke.annotation.I18n.EN.Then;
import cuke4duke.annotation.I18n.EN.When;

import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.is;

public class CukeSteps {

    private char theLetter;

    @Given("^the letter '([A-Za-z])'$")
    public void gimmeALetter(final char theLetter) {
        this.theLetter = theLetter;
    }

    @When("^I check the letter(?:s)?$")
    public void checkThem() {
        // just a stub
    }

    @Then("^the letter should be '([A-Za-z])'$")
    public void checkTheLetter(final char aLetter) {
        assertThat(theLetter, is(aLetter));
    }
}</pre>
<p>Now, run that test using:</p>
<pre class="brush: bash">mvn integration-test</pre>
<p>I have zipped up an example project with more example steps.  It is located <a href="/resources/maven-cuke.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.goodercode.com/wp/using-cucumber-tests-with-maven-and-java/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Does Your Build Suck?</title>
		<link>http://www.goodercode.com/wp/does-your-build-suck/</link>
		<comments>http://www.goodercode.com/wp/does-your-build-suck/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 13:02:00 +0000</pubDate>
		<dc:creator>kerry</dc:creator>
		
		<category><![CDATA[Lessons]]></category>

		<category><![CDATA[ant]]></category>

		<category><![CDATA[build]]></category>

		<category><![CDATA[build antipatterns]]></category>

		<category><![CDATA[continuous integration]]></category>

		<category><![CDATA[maven]]></category>

		<category><![CDATA[project management]]></category>

		<category><![CDATA[rake]]></category>

		<guid isPermaLink="false">http://www.goodercode.com/wp/does-your-build-suck/</guid>
		<description><![CDATA[A few questions to determine build suckage.]]></description>
			<content:encoded><![CDATA[<p>I have come up with a few questions you should ask yourself if your build is up to snuff.&#160; </p>
<ul>
<li>Does it take longer than 10 minutes to setup a new computer to build a project?</li>
<li>Are there only a one or two people who know how to completely setup a new computer?</li>
<li>Do builds sometimes fail on the integration server when they are passing on your development machine?</li>
<li>Do you often make cross-repository commits?</li>
<li>Does building a subproject force you to build several other subprojects?</li>
<li>Does it take longer than 2 minutes to checkout a new project and build it successfully?</li>
<li>Is it possible for other developers (or other external factors) to break your development build without checking in code?</li>
<li>Can you use any IDE with your project?</li>
</ul>
<p>If you answered yes to any of these questions, perhaps you should spend some time refactoring your build and/or project structure.&#160; A nasty build can be very frustrating for developers yet is an oft overlooked part of development.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.goodercode.com/wp/does-your-build-suck/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Extending Currying: Partial Functions in Javascript</title>
		<link>http://www.goodercode.com/wp/extending-currying-partial-functions-in-javascript/</link>
		<comments>http://www.goodercode.com/wp/extending-currying-partial-functions-in-javascript/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 14:00:44 +0000</pubDate>
		<dc:creator>kerry</dc:creator>
		
		<category><![CDATA[Lessons]]></category>

		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.goodercode.com/wp/extending-currying-partial-functions-in-javascript/</guid>
		<description><![CDATA[Last week I posted about function currying in javascript.  This week I am taking it a step further by adding the ability to call partial functions.
Suppose we have a graphing application that will pull data via Ajax and perform some calculation to update a graph.  Using a method with the signature ‘updateGraph(id,value)’.
To do this, we [...]]]></description>
			<content:encoded><![CDATA[<p><script language="javascript" src="/js/syntaxhighlighter_2.1.364/scripts/shBrushJScript.js"></script>Last week I posted about <a href="http://www.goodercode.com/wp/function-currying-in-javascript/" target="_blank">function currying in javascript</a>.  This week I am taking it a step further by adding the ability to call partial functions.</p>
<p>Suppose we have a graphing application that will pull data via Ajax and perform some calculation to update a graph.  Using a method with the signature ‘updateGraph(id,value)’.</p>
<p>To do this, we have do something like this:</p>
<pre class="brush: js">

for(var i=0; i < things.length; i++) {
  Ajax.request('/some/data', {id: things[i].id}, function(json) {
    updateGraph(json.id, json.value);
  });
}
</pre>
<p>This works fine.  But, using this method we need to return the id in the json response from the server.  This works fine, but is not that elegant and increase network traffic.</p>
<p>Using partial function currying we can bind the id parameter and add the second parameter later (when returning from the asynchronous call).  To do this, we will need the updated curry method.  I have added support for sending additional parameters at runtime for curried methods.</p>
<pre class="brush: js">
Function.prototype.curry = function(scope) {
  scope = scope || window;
  var args = [];
  for (var i=1, len = arguments.length; i < len; ++i) {
    args.push(arguments[i]);
  }
  var m = this;
  return function() {
    for (var i=0, len = arguments.length; i < len; ++i) {
      args.push(arguments[i]);
    }
    return m.apply(scope, args);
  };
}
</pre>
<p>As you can see, partial currying gives is a very useful tool and this simple method should be a part of every developer’s toolbox.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.goodercode.com/wp/extending-currying-partial-functions-in-javascript/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
