<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Java static imports + Fluent interfaces + Builder pattern= DSL</title>
	<atom:link href="http://blog.centuryminds.com/2007/10/java-static-imports-fluent-interfaces-builder-pattern-dsl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.centuryminds.com/2007/10/java-static-imports-fluent-interfaces-builder-pattern-dsl/</link>
	<description></description>
	<pubDate>Tue, 06 Jan 2009 23:39:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Scott Hanselman's Computer Zen - The Weekly Source Code 14 - Fluent Interface Edition</title>
		<link>http://blog.centuryminds.com/2007/10/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-197</link>
		<dc:creator>Scott Hanselman's Computer Zen - The Weekly Source Code 14 - Fluent Interface Edition</dc:creator>
		<pubDate>Thu, 31 Jan 2008 06:20:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.centuryminds.com/2007/10/21/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-197</guid>
		<description>[...] Similar things are done in Java with their support for mixins, called Static Imports in Java 5. [...]</description>
		<content:encoded><![CDATA[<p>[...] Similar things are done in Java with their support for mixins, called Static Imports in Java 5. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikel Alcón</title>
		<link>http://blog.centuryminds.com/2007/10/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-196</link>
		<dc:creator>Mikel Alcón</dc:creator>
		<pubDate>Tue, 23 Oct 2007 15:34:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.centuryminds.com/2007/10/21/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-196</guid>
		<description>Stephan: Rather than using something so obfuscated as a method called $, I would rename it to something more clean:

System.out.println(i18n( FILE_NOT_FOUND, file))

for example. Anyone who reads this knows what the code is doing (I think it cannot be said the same for the $ method).

BTW, good post about fluent interfaces.</description>
		<content:encoded><![CDATA[<p>Stephan: Rather than using something so obfuscated as a method called $, I would rename it to something more clean:</p>
<p>System.out.println(i18n( FILE_NOT_FOUND, file))</p>
<p>for example. Anyone who reads this knows what the code is doing (I think it cannot be said the same for the $ method).</p>
<p>BTW, good post about fluent interfaces.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikel Alcón</title>
		<link>http://blog.centuryminds.com/2007/10/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-195</link>
		<dc:creator>Mikel Alcón</dc:creator>
		<pubDate>Tue, 23 Oct 2007 15:25:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.centuryminds.com/2007/10/21/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-195</guid>
		<description>Paulo: Antlr is a good tool, but I wouldn't use it unless it is strictly necessary. When you build a external DSL you lost a lot of functionalities from the host language. Generally I prefer internal DSL. If you want to use Antlr you have to think it if it worth it. For many organizations is easier to develop a Java/Ruby/Groovy based DSL, which they can reuse their host language experience, than constructing a completely new language.</description>
		<content:encoded><![CDATA[<p>Paulo: Antlr is a good tool, but I wouldn&#8217;t use it unless it is strictly necessary. When you build a external DSL you lost a lot of functionalities from the host language. Generally I prefer internal DSL. If you want to use Antlr you have to think it if it worth it. For many organizations is easier to develop a Java/Ruby/Groovy based DSL, which they can reuse their host language experience, than constructing a completely new language.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephan Schmidt</title>
		<link>http://blog.centuryminds.com/2007/10/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-194</link>
		<dc:creator>Stephan Schmidt</dc:creator>
		<pubDate>Tue, 23 Oct 2007 12:46:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.centuryminds.com/2007/10/21/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-194</guid>
		<description>@Marcos:

I've been using the $() shortcut in Reposita Messages, as a lookup for i18n bundles and keys. System.out.println($( FILE_NOT_FOUND, file)) is easier to read than ...(bundle.getMessage(...)). I'm not sure if in your case it would be more readable with days(5) and hours(3), the $() seems to me a try to rebuild the Ruby way with 5.times. It's clean, but times(5) and days(3) is as readable and no need to extend Integer.

Peace
-stephan</description>
		<content:encoded><![CDATA[<p>@Marcos:</p>
<p>I&#8217;ve been using the $() shortcut in Reposita Messages, as a lookup for i18n bundles and keys. System.out.println($( FILE_NOT_FOUND, file)) is easier to read than &#8230;(bundle.getMessage(&#8230;)). I&#8217;m not sure if in your case it would be more readable with days(5) and hours(3), the $() seems to me a try to rebuild the Ruby way with 5.times. It&#8217;s clean, but times(5) and days(3) is as readable and no need to extend Integer.</p>
<p>Peace<br />
-stephan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephan Schmidt</title>
		<link>http://blog.centuryminds.com/2007/10/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-193</link>
		<dc:creator>Stephan Schmidt</dc:creator>
		<pubDate>Tue, 23 Oct 2007 12:37:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.centuryminds.com/2007/10/21/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-193</guid>
		<description>Funny, I recently wrote about the same things.

I'm not sure what DSL really means, when mixed with a base language. A real DSL would be it's own language, but then Rails wouldn't be a DSL also.

I wrote about a fluent interface to Google collections: http://stephan.reposita.org/archives/2007/10/17/creating-a-fluent-interface-for-google-collections/

and how to automatically create fluent interfaces from an Java interface with reflection:

http://stephan.reposita.org/archives/2007/10/10/fluent-interface-and-reflection-for-object-building-in-java/

I also hope that closures in Java 7 will move us in the right direction.

Peace
-stephan

--
Stephan Schmidt :: stephan@reposita.org
Reposita Open Source - Monitor your software development
http://www.reposita.org
Blog at http://stephan.reposita.org - No signal. No noise.</description>
		<content:encoded><![CDATA[<p>Funny, I recently wrote about the same things.</p>
<p>I&#8217;m not sure what DSL really means, when mixed with a base language. A real DSL would be it&#8217;s own language, but then Rails wouldn&#8217;t be a DSL also.</p>
<p>I wrote about a fluent interface to Google collections: <a href="http://stephan.reposita.org/archives/2007/10/17/creating-a-fluent-interface-for-google-collections/" rel="nofollow">http://stephan.reposita.org/archives/2007/10/17/creating-a-fluent-interface-for-google-collections/</a></p>
<p>and how to automatically create fluent interfaces from an Java interface with reflection:</p>
<p><a href="http://stephan.reposita.org/archives/2007/10/10/fluent-interface-and-reflection-for-object-building-in-java/" rel="nofollow">http://stephan.reposita.org/archives/2007/10/10/fluent-interface-and-reflection-for-object-building-in-java/</a></p>
<p>I also hope that closures in Java 7 will move us in the right direction.</p>
<p>Peace<br />
-stephan</p>
<p>&#8211;<br />
Stephan Schmidt :: <a href="mailto:stephan@reposita.org">stephan@reposita.org</a><br />
Reposita Open Source - Monitor your software development<br />
<a href="http://www.reposita.org" rel="nofollow">http://www.reposita.org</a><br />
Blog at <a href="http://stephan.reposita.org" rel="nofollow">http://stephan.reposita.org</a> - No signal. No noise.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prashant</title>
		<link>http://blog.centuryminds.com/2007/10/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-192</link>
		<dc:creator>prashant</dc:creator>
		<pubDate>Tue, 23 Oct 2007 08:44:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.centuryminds.com/2007/10/21/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-192</guid>
		<description>Hi,

Good thought proving article.enjoyed reading.

Thanks
Prashant Jalasutram
http://prashantjalasutram.blogspot.com/</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Good thought proving article.enjoyed reading.</p>
<p>Thanks<br />
Prashant Jalasutram<br />
<a href="http://prashantjalasutram.blogspot.com/" rel="nofollow">http://prashantjalasutram.blogspot.com/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcos Silva Pereira</title>
		<link>http://blog.centuryminds.com/2007/10/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-191</link>
		<dc:creator>Marcos Silva Pereira</dc:creator>
		<pubDate>Tue, 23 Oct 2007 06:23:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.centuryminds.com/2007/10/21/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-191</guid>
		<description>You are right, brackets made the code less readable because they break the sequence. I am developing a tiny api to work with dates using the same strategy, but with different phrases:

Date before = $(2).days().before().now();
Date from   = $(5).hours().from(aDate);

Kind Regards</description>
		<content:encoded><![CDATA[<p>You are right, brackets made the code less readable because they break the sequence. I am developing a tiny api to work with dates using the same strategy, but with different phrases:</p>
<p>Date before = $(2).days().before().now();<br />
Date from   = $(5).hours().from(aDate);</p>
<p>Kind Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pabrantes</title>
		<link>http://blog.centuryminds.com/2007/10/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-198</link>
		<dc:creator>pabrantes</dc:creator>
		<pubDate>Mon, 22 Oct 2007 23:19:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.centuryminds.com/2007/10/21/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-198</guid>
		<description>Interesting combination you suggest. Never had thought in that.

Just as a reference for anyone interested in DSLs, another way of creating DSLs is to
create a grammar using antlr and use that grammar to generate code.
Although I know that is  more complicated not to mention that solutions with generated
code can sometimes be very "spooky" :-)

Congratulations for the well written article.
Regards,

Paulo Abrantes</description>
		<content:encoded><![CDATA[<p>Interesting combination you suggest. Never had thought in that.</p>
<p>Just as a reference for anyone interested in DSLs, another way of creating DSLs is to<br />
create a grammar using antlr and use that grammar to generate code.<br />
Although I know that is  more complicated not to mention that solutions with generated<br />
code can sometimes be very &#8220;spooky&#8221; <img src='http://blog.centuryminds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Congratulations for the well written article.<br />
Regards,</p>
<p>Paulo Abrantes</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikel Alcón</title>
		<link>http://blog.centuryminds.com/2007/10/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-200</link>
		<dc:creator>Mikel Alcón</dc:creator>
		<pubDate>Sun, 21 Oct 2007 19:45:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.centuryminds.com/2007/10/21/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-200</guid>
		<description>Yes, you are right. You need getters and setters in order to be POJO "compatible". This is the reason why I prefer using fluent interfaces only with Builder Pattern, for decoupling the construction facilities of the object from the object itself. Obviously having a name setter and a setName one is not very DRY, the comment was more about that, if you want, you can have fluent interfaces and POJO like methods (Yes, it is not very advisable)

This type of methods are useful for human usage, not for frameworks like Hibernate,JSF, etc. where getters and setters are more suitable. As a summary, I would use fluent interfaces with Builder Pattern for construction and a POJO for the object/entity.

Yes this._name is obviously not needed (I started with a 'name' property and I changed after, but I missed removing this :D)</description>
		<content:encoded><![CDATA[<p>Yes, you are right. You need getters and setters in order to be POJO &#8220;compatible&#8221;. This is the reason why I prefer using fluent interfaces only with Builder Pattern, for decoupling the construction facilities of the object from the object itself. Obviously having a name setter and a setName one is not very DRY, the comment was more about that, if you want, you can have fluent interfaces and POJO like methods (Yes, it is not very advisable)</p>
<p>This type of methods are useful for human usage, not for frameworks like Hibernate,JSF, etc. where getters and setters are more suitable. As a summary, I would use fluent interfaces with Builder Pattern for construction and a POJO for the object/entity.</p>
<p>Yes this._name is obviously not needed (I started with a &#8216;name&#8217; property and I changed after, but I missed removing this :D)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://blog.centuryminds.com/2007/10/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-199</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sun, 21 Oct 2007 19:24:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.centuryminds.com/2007/10/21/java-static-imports-fluent-interfaces-builder-pattern-dsl/#comment-199</guid>
		<description>How can this method

public Person name(String name){
  this._name=name;
  return this;
}

be compatible with existing accessors in a javabean? Do I need the setter method

public void setName(String name) {
  this._name=name;
}

co-existing with the new one above? I wouldn´t like to count on two separate methods to do that. How'd be the getter like?

Btw, if the bean fields start with a leading '_', ain´t using this._field=field kinda superfluous?

Good post.</description>
		<content:encoded><![CDATA[<p>How can this method</p>
<p>public Person name(String name){<br />
  this._name=name;<br />
  return this;<br />
}</p>
<p>be compatible with existing accessors in a javabean? Do I need the setter method</p>
<p>public void setName(String name) {<br />
  this._name=name;<br />
}</p>
<p>co-existing with the new one above? I wouldn´t like to count on two separate methods to do that. How&#8217;d be the getter like?</p>
<p>Btw, if the bean fields start with a leading &#8216;_&#8217;, ain´t using this._field=field kinda superfluous?</p>
<p>Good post.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.448 seconds -->
