[UPHPU] Fluent interfaces

Dave Smith dave at thesmithfam.org
Thu May 10 20:40:23 MDT 2007


Richard K Miller wrote:
> Has everyone heard of a "fluent interface"? It's a term coined by 
> Martin Fowler that I just learned today. (Wondering if I've been in 
> the dark about this.)

This is very common for string objects. Consider for example the old Qt3 
QString class:

QString foo = "my foo bar";
foo.replace( "foo", "biz" ).replace( "bar", "baz" ).upper();
// foo is now "MY BIZ BAZ"

Can be quite handy. Often times when you would have otherwise returned 
void, consider returning a reference to the this pointer instead.

--Dave


More information about the UPHPU mailing list