Take the 2-minute tour ×

What's the term for this design?


..when all methods return *this?

I found the term for this a while ago, but lost it meanwhile. I have no clue how to search for this on google :) Also if anyone can think of a better title for the question, feel free to change it.


Update-Gishu: After reading about it, I feel that your question is misleading w.r.t. code snippet provided.. (Feel free to rollback)

Method Chaining


Fluent Interfaces

private void makeFluent(Customer customer) {
                .with(6, "TAL")
                .with(3, "LGV")
share|improve this question
Gishu, instead of replying inline like this you should leave a comment or add another answer. stackoverflow.com/questions/14593/… –  Patrick McElhaney Oct 15 '08 at 12:30
add comment

6 Answers

up vote 8 down vote accepted

Looks to me like you are describing a fluent interface. Ive also heard it referred to as pipelineing or chaining.

Update-Gishu: http://martinfowler.com/bliki/FluentInterface.html

share|improve this answer
that's it, thanks, the term was slipping my mind :) –  Prody Oct 15 '08 at 11:19
Thanks for the link Gishu –  Robert Gould Oct 15 '08 at 11:28
add comment

method chaining

share|improve this answer
add comment

It's usually called method chaining. An example of its application is the Named Parameter Idiom.

As an aside, I find it amusing that searching in Google for "object method1 method2" comes up with exactly the page you were looking for. :)

share|improve this answer
well, searching on Google doesn't get you any rep... ;) –  Aardvark Oct 15 '08 at 13:04
add comment

It's method chaining.

share|improve this answer
add comment

chaining is a more common name in the industry and most developers have at least heard of it, while fluent interface is more academic and lots of people will have no idea what your talking about.

share|improve this answer
add comment

You can find a good definitition and the basic concepts of the fluent interface this this post:

Guidelines to Fluent Interface design in C# part 1

I hope that helps.

share|improve this answer
add comment

Your Answer


