Method chaining

Method chaining is a common syntax for invoking multiple method calls in object-oriented programming languages. Each method returns an object, allowing the calls to be chained together in a single statement without requiring variables to store the intermediate results.[1]

  1. ^ "Applying Method Chaining". First Class Thoughts. Archived from the original on 2011-02-22. Retrieved 2011-04-13. 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!.

From Wikipedia, the free encyclopedia · View on Wikipedia

Developed by Nelliwinne