Nathan Ridley
Nathan Ridley

Reputation: 34426

What is the name of this design pattern?

jQuery uses this pattern. Essentially it involves every method returning a reference to the same object on which the method was called.

myClassInstance
    .DoMethodA()
    .DoMethodB()
    .DoMethodC()
    .CleanUp();

What's this design pattern called?

UPDATE The accepted answer is correct, and here is the link to the wikipedia entry for it - less informative than the link provided in the answer though :P http://en.wikipedia.org/wiki/Method_chaining

Upvotes: 3

Views: 621

Answers (4)

AKS
AKS

Reputation: 1423

It is called Builder pattern..

Upvotes: -1

dfa
dfa

Reputation: 116442

It is called method chaining.

Upvotes: 14

Johnno Nolan
Johnno Nolan

Reputation: 29657

its called a Fluent Interface

Upvotes: 2

mghie
mghie

Reputation: 32344

Fluent interface

Upvotes: 8

Related Questions