Refactoring to a fluent interface



Oren has a nice little gem where he introduces a nice refactoring for defining an email message. Fluent Interfaces introduce more a natural language flow to the code and walk you through the workflow of whatever task it is that you are performing. FluentInterfaces and DSLs (not the XML kind) go hand in hand in that a FluentInterface is often syntactic sugar for an Embedded or Internal DSL. In that case it’s an abstraction from the code that allows you to focus on the problem rather than the nitty gritty details.

Personally I am big fan of Fluent interfaces and have thought more than a few times that we should be introducing usage of them within our guidance.

What are your thoughts?

Glenn Block

Sr. Program Manager, Azure

Follow Glenn   


    Leave a comment