Tips for writing fluent interfaces in C# 3

The single biggest challenge I have experienced as a consumer of fluent interfaces is that most of them aren’t really fluent intefaces — instead they are really instances of what I tend to refer to as ‘legible interfaces’.

A fluent interface implies that its primary goal is to make it easy to SPEAK it whereas a legible interface implies that its primary goal is to be easy to READ it. Most fluent interfaces only tend to be ridiculously difficult to code with but conversely incredibly easy to READ later by others.

Assert().That().This(actual).Is().Equal().To(expected).
    Except().If(x => x.GreaterThan(10));

…is alot easier to read later than it is to actually compose in code!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)