1. 5

  2. 3

    I have a few difficulties with fluent interfaces:

    1. It seems like they aren’t as easily ‘discoverable’ as normal ‘set up this complex object and do stuff with it’ interfaces.
    2. Probably related to the above: I’m never sure if I’ve finished adding all required calls.
    3. Again probably related: Is ordering important? If so how should I ensure it’s correct? With a ‘normal’ interface this doesn’t seem hard to be sure about.
    4. Can / should I call the same method more than once? Sometimes it’s not clear.

    Perhaps these are all non-issues with careful design (which should be a requirement anyway of course) and the right tooling.

    Recently I’ve played with SwiftUI, where if you get your calls in the wrong order, your UI goes wrong. In theory you can figure out the right order to make calls from the docs - except the docs are mostly missing, so it’s trial and error until what you have looks right. And hope it doesn’t go wrong again with different inputs.

    Did anyone have examples of great fluent interfaces? I’d like to find some to use as references on how to do them well.