On Fluent Usage

Objection was raised to my critique On Grammar, that it seems heretical, an anathema to the Swift API Design Guidelines. To clarify, I take issue with guideline literalism:

Strive for Fluent Usage

  • Prefer method and function names that make use sites form grammatical English phrases.

The rule attempts to clarify, what fluent means. It’s literal interpretation is used as an excuse to bikeshed about English-grammar minutia. But this is possible only by ignoring the fact that “Fluent“ here refers to term of art, the programming style Fluent Interface as described by Martin Fowler in 2005. The Wikipedia summary explains it well:

fluent interface […] is a method for constructing object oriented APIs, where the readability of the source code is close to that of ordinary written prose, essentially creating a domain-specific language within the interface.

Note the absence of any reference to grammar. Guidelines tried to distill the essence of programming style into pithy catchphrase, but accidentally created a red herring.

When practiced well, fluent interface design leads to a lot of smaller methods that compose well (by chaining) to form complex behaviors and improve code readability at the use site. Applied to Swift standard library, this expresses a desire to form a small yet powerful set of tools with broad general utility. This is what fluent means in programming. I’m fully on board with that!

Pavol opened four separate threads to discuss different aspects of what I think is really a single argument. I’m therefore going to lock this thread and recommend that any further conversation be taken to the thread with the most discussion.