Method chaining: Difference between revisions

Content deleted Content added
FrescoBot (talk | contribs)
m Bot: link syntax and minor changes
Line 6:
| title = Applying Method Chaining
| quote = In order to simplify repeated object interactions on the same object the old trick Method Chaining originating the world of Smalltalk should be enforced. The idea is to let methods return this rather than void, thus affecting especially set() and add() methods. Method chaining arose during the designers of Smalltalk pursuit to minimize the number of keywords in the language, which lead to the discovery that void is an unnecessary keyword!.
| url = http://firstclassthoughts.co.uk/java/method_chaining.html}}</ref> [[Local variable]] declarations are [[syntactic sugar]] because of the difficulty humans have with deeply nested method calls.<ref>{{cite web|url=http://cs.uni.edu/~wallingf/teaching/cs3540/sessions/session18.html|title=Session 18 Variable References|quote=Today you learn that variable names are not necessary: they are really syntactic sugar.}}</ref><ref>{{cite web|url=https://www.cs.umd.edu/class/spring2013/cmsc631/lectures/lambda.pdf|title=CMSC 631 – Program Analysis and Understanding|quote=• Syntactic sugar for local declarations - let x = e1 in e2 is short for (λx.e2) e1}}</ref> A method chain is also known as a ''train wreck'' due to the increase in the number of methods that come one after another in the same line that occurs as more methods are chained together<ref>{{cite book
| last = Martin
| first = Robert Cecil
Line 300:
* [[Pipeline (Unix)]]
* [[Nesting (computing)]]
* [[Builder_pattern|Builder pattern]]
 
==References==