Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • Someone who looks at the API documentation might then wonder why the method returns Conf It's not our job to cater to the lowest common denominator of programming. If a professional developer doesn't know the fluent interface pattern, that's on them. Commented Jun 30, 2017 at 17:24
  • I adressed this in the third paragraph (use a language that allows you to specify a more precise type that explicitly spells out that fact that it is a Fluent DSL) and in the last paragraph (document the fact that it is a Fluent DSL and that the return types shouldn't be viewed in isolation but rather as ways of connecting the different parts of a "Fluent Sentence" together). But, honestly, tell me why a professional developer who happens to know mostly languages with message cascades should know the Fluent Interface pattern? He would just use a message cascade instead. Commented Jul 1, 2017 at 7:40
  • Martin Fowler has this to say: "One of the problems of methods in a fluent interface is that they don't make much sense on their own. Looking at a method browser of method by method documentation doesn't show much sense to with. Indeed sitting there on its own I'd argue that it's a badly named method that doesn't communicate its intent at all well. It's only in the context of the fluent action that it shows its strengths. One way around this may be to use builder objects that are only used in this context." Commented Jul 1, 2017 at 7:41
  • And this: "I've also noticed a common misconception - many people seem to equate fluent interfaces with Method Chaining. Certainly chaining is a common technique to use with fluent interfaces, but true fluency is much more than that. The JMock example I show above uses method chaining, but also nested functions and object scoping." – Note that the question explicitly talks about Method Chaining and not a Fluent Interface. So, how would a professional developer recognize the Fluent Interface pattern in something that isn't a Fluent Interface but rather simple Method Chaining? Commented Jul 1, 2017 at 7:42