[UPHPU] Fluent interfaces

Bryan Petty etierra at gmail.com
Fri May 11 03:10:34 MDT 2007


On 5/8/07, Richard K Miller <richardkmiller at gmail.com> 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.)

It's actually a somewhat common approach to many property setting
structure classes in many languages. One that pops into mind since
it's something I work with on occasion more recently is wxAuiPaneInfo
(part of wxAUI in the wxWidgets GUI toolkit). Almost every function
for modifying a property of the object returns a reference to itself:
http://www.wxwidgets.org/manuals/stable/wx_wxauipaneinfo.html

It allows for you to define full pane properties on a single line:
wxAuiPaneInfo().Name("tb").Caption("Toolbar").ToolbarPane().Top().LeftDockable(false)

Regards,
Bryan Petty


More information about the UPHPU mailing list