Link Details

Link 288583 thumbnail
User 455959 avatar

By phpfreak
via factorypattern.com
Published: Nov 12 2009 / 22:32

Method chaining is a simple technique that allows successive method invocation on the same object and in the same line.
  • 26
  • 8
  • 2163
  • 1276

Comments

Add your comment
User 257148 avatar

trollhorn replied ago:

0 votes Vote down Vote up Reply

Very good tip, though not that "advanced" ;-)... would be nice if you would point out that java.lang.String makes heavy use of method chaining too, as well as the Builder Pattern...
,

User 393686 avatar

RawThinkTank replied ago:

0 votes Vote down Vote up Reply

"One of the problems of the Method Chaining pattern is the fact that it can not ensure the order of the invoked method."

Solution to that was really advanced, thanks.

User 388005 avatar

Hardcoded replied ago:

0 votes Vote down Vote up Reply

Method chaining is a nice approach for Queries and DSL, but it's annoying when an exception occures (e.g. NullPointer). Additional it's harder to debug.
So it's not always the best solution..

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.