Chapter 32. Expression Builder

An object, or family of objects, that provides a fluent interface over a normal command-query API.

image

APIs are usually designed to provide a set of self-standing methods on objects. Ideally, these methods can be understood individually. I call this style of API a command-query API; it’s so normal that we don’t have a general name for it. DSLs require a different kind of API, what I call a fluent interface, which is designed with the goal of readability of a whole expression. Fluent interfaces lead to methods that make little sense individually, and often violate the rules for good command-query APIs.

An Expression ...

Get Domain Specific Languages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.