Hi Grant,<br><br>The Fluent pattern is pretty neat, but I agree with Fowler's assessment of the downside:<br><br>"One of the problems of methods in a fluent interface is that they
        don't make much sense on their own. Looking at a method browser of
        method by method documentation doesn't show much sense to
        <code>with</code>. Indeed sitting there on its own I'd argue that
        it's a badly named method that doesn't communicate its intent at all
        well. It's only in the context of the fluent action that it shows
        its strengths. One way around this may be to use builder objects
        that are only used in this context."<br><br>I think his idea of using fluent builder objects to ease creation of object state would make the core classes a lot more readable (since the core classes themselves would not be cluttered with weird methods like "with").<br>
<br>-Curtis<br><br><div class="gmail_quote">On Tue, Apr 13, 2010 at 11:22 AM, Grant B. Harris <span dir="ltr"><<a href="mailto:gharris@mbl.edu">gharris@mbl.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
<br>
Anybody have any thoughts on the use of a <a href="http://martinfowler.com/bliki/FluentInterface.html" target="_blank">Fluent
Interface</a> (Fowler)
style (also known as <a href="http://www.factorypattern.com/method-chaining" target="_blank">Method Chaining</a>)
in the design of an API. Essentially, by returning the object instance
from the setter methods, you can chain calls, like:<br>
<pre name="code">Rectangle().setX(10).setY(10).setWidth(13).setHeight(15).setColor("red");</pre>
-- <br>
<pre cols="72">Grant Harris
</pre>
</div>
<br>_______________________________________________<br>
ImageJ-devel mailing list<br>
<a href="mailto:ImageJ-devel@imagejdev.org">ImageJ-devel@imagejdev.org</a><br>
<a href="http://imagejdev.org/mailman/listinfo/imagej-devel" target="_blank">http://imagejdev.org/mailman/listinfo/imagej-devel</a><br>
<br></blockquote></div><br>