Jan 11, 2008

Thinking about Fluent Interfaces

I am really inspired by the new ideas of DSLs, Language Oriented APIs, an so on... I found today a link about Fluent Interfaces.

And that gave me an idea of using explicitly and implicitly implemented interfaces.
Where, in the following example:

class Order: IOrder, IFluentOrder

IFluentOrder can really be implemented explicitly and user will never have a problem of mixed modes, i.e. the following code will be very easy to implement:

.with(6, "TAL")
.with(5, "HPK").skippable()
.with(3, "LGV")

And then, when user will be working with Orders, he will be working with IOrder interface, instead of dealing with methods from both IOrder and IFluentOrder interface.

That requires additional thinking...

No comments: