Fluent interface endgame


This post was originally published here.

In a conversation on BDD on the altnetconf message board, the topic switched to language-oriented syntax in the CLR, to which Scott notes:

When IronRuby gets here, I think we should at least stop and consider the value to the community of encouraging them to try do language-oriented specification with tools and programming languages that don’t quite hit the mark.

Or maybe we should be turning our focus to Boo or IronPython for achieving the solubility in specification code that we can’t have in C# and VB.

I’ve felt this for quite a while now, though I have reservations about focusing on Boo’s Specter or IronPython for the time being.  My response was:

I think there’s an assumption among anyone developing language-oriented tools in CLR using extension methods, fluent interfaces, etc. that it’s all a poor man’s substitute for the clearer syntax that Ruby inherently provides. Once IronRuby hits some sort of beta/RC status, I don’t see much point at all continuing to try to wrestle a pig into a yoke while the farmers laugh “use an ox you moron”.

I do like the readability the Boo macros provide, but I’m always reminded of that scene from King of the Hill when Hank meets his new neighbor Khan (who is from Laos) for the first time:

Hank: So are you Chinese or Japanese?
Khan: No, we are Laotian.
Bill: The ocean? What ocean?
Khan: From Laos, stupid! It’s a landlocked country in Southeast Asia
between Vietnam and Thailand, population approximately 4.7 million!
Hank: … So are you Chinese or Japanese?
Kahn: D’oh

As someone who wants to use BDD more, Specter looks like a promising CLR tool, but as a proponent of BDD, Boo might set the bar too high when there’s only Chinese or Japanese in the greater community. Then again, if curly-braces dilute a concept that is supposed to lie very close to the conversations BDD starts with, maybe it’s better to draw a line so the value isn’t diminished.

I don’t really have any answers yet. Make it pure or make it accessible, tough choice…

Again, I don’t have anything against Boo, but I just don’t know how successful these efforts will be once IronRuby comes out.  For example, why should I care about the Boo Build System when I can use Rake in Visual Studio when IronRuby ships?

Until these languages are officially supported by Microsoft, they are for the most part eliminated as an option for one reason or another, whether it be company policy, lack of adoption, or just apathy for learning a new language.  Once they are supported, I will happily ditch my fluent interface and extension methods for a true natural-language friendly programming language.

Double-edged sword of InternalsVisibleTo