Chapter 35. Method Chaining
Make modifier methods return the host object, so that multiple modifiers can be invoked in a single expression.
35.1 How It Works
Method Chaining rapidly caught on amongst people as an example of what an internal DSL should look like. It caught on a bit too much—people started to assume that Method Chaining was synonymous with fluent interfaces and internal DSLs. My view is that Method Chaining is one of several techniques, but it’s still valuable and noticeable.
Its common form is on an Expression Builder. Consider the hard drive in the sketch. Using a regular command-query API, I might set it up like this:
I create ...