Search code examples
javascriptjquerydesign-patternsprogramming-languages

Does the pattern where you chain methods in your object by returning a reference to itself have a name?


In most modern OO languages chaining methods together is common, and IMHO elegant, practice. In jquery, for example, you often see code like:

$('div').addClass('container').css('color', 'white').length

Does writing your objects to allow this have a name?


Solution

  • Method Chaining is the core concept behind building a Fluent Interface