Thursday, December 27, 2007

Fluent Interfaces, Domain Specific Languages, OO Roots

I see industry backing for Fluent Interfaces. It is in more places than you may know. In my opinion, all people in the software industry will want to know what Fluent Interfaces are, where they are used, and how they fit into the canvas of what they care about.

What are Fluent Interfaces? Fluent Interfaces is an API style that empowers the user of the API to programatically express something in a natural and easy to read way. Martin Fowler describes Fluent Interfaces well. See

Steve Asher
explores Fluent Interfaces in-depth from the user and designer point of view at his Build Without Boundaries blog at Search for Fluent API.

Having Martin Fowler support Fluent Interfaces is huge. I also see Fluent Interfaces as the bridge towards Domain Specific Languages (DSL). Are DSLs a possibility in mainstream software development?

Kent wrote in a JavaRanch post that there is a transition from OO languages to DSLs (Domain Specific Languages). What a powerful statement! Is it true? What's the sticking power to Fluid Interfaces and DSLs?

The Object Oriented (OO) approach to programming caught on because it feels natural. We play with objects in life. We speak about them within the context of a domain. The customers speak from within their domain perspective. The easier the trip between the problem domain concepts and reflecting those concepts in code the better.

Who's presenting their API / functionality via a Fluent Interface? Thanks to Steve Asher, I now know JUnit has begun that journey. See where the assertThat(...) example is given. JMock uses a fluid interface too. See If you search for "new Expectations" twice you will see examples of a Fluid Interface in action. It is used also where I work at CARFAX. Again, I refer you to the Build Without Boundaries blog.

Similar to the time when people implemented Object Oriented concepts via languages like C and Ada, we will see people using Fluid Interfaces and other approaches with existing languages. The benefits are likely to outweigh most difficulties and challenges.

The next step for DSLs and Fluid Interfaces will be stronger support and perhaps new languages entirely. Will the fashion of Fluid Interfaces and DSLs hold? Time will tell.