New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Presentation: Business Natural Languages Development in Ruby

| by Werner Schuster on May 12, 2008. Estimated reading time: less than one minute |
In this presentation from QCon San Francisco, Jay Fields talks about his concept of Business Natural Languages (BNL) and how to implement them in Ruby.

A BNL is a type of Domain Specific Language (DSL), which is focussed on being readable and maintainable by subject matter experts. While these experts might not necessarily write code with the BNL from scratch, they can understand and maintain the business logic implemented with it very easily. As with all DSLs, a BNL reduces the clutter of general purpose languages - which also makes it possible for code using a BNL to be both executable specification and documentation of business processes.

In the presentation, Jay shows the motivation behind BNLs - why he even thought there's a need for the term, instead of just using the term DSL. He proceeds to go through the design process of an actual BNL and how to implement it using Ruby, and reports his experiences on doing this for several real world projects.

Watch Jay Fields' presentation "Business Natural Languages Development in Ruby".

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

BNL or simple UI by Michael Niv

I enjoyed the presentation. Thanks!

Two related questions:

1. If I understand correctly, the system is not forcing the user to type syntactically-well formed string in some controlled grammar. Instead, the regexes do the magic under the hood. If so, does/could it happen that the business user naively uses a novel language construct (and instead of or, or a meaningful "not" or "could" instead of "does") which the BNL designer did not anticipate, but which get swept up in general regexes, and the meaning is harmed in some subtle way that may be hard for a business user to defend against using the testing tools available?

2. Given the narrowly targeted domain specificity of the language, a similarly targeted UI might work as well. for example:

compensate $ [number] per [enum: $1M-profit, deal] if
[enum: gross, recent_deals, all_deals] exceeds [number]

(where the stuff in square brackets is shorthand for the appropriate HTML form-tags)

Do you have insights as to which circumstances favor a UI vs BNL?

Thanks again!

Michael Niv.

Re: BNL or simple UI by Jay Fields

Hi Michael,

Like almost everything in software: it depends. There are so many ways to translate external DSLs to executable code that it will depend on which solution you go with. If you have a strong security (or just general) concern you can use something such as TreeTop to create an entirely external DSL and pretty much entirely mitigate the risk. On the other hand, if you do something as simple as replace spaces with dots, then you are allowing for potential issues. Of course, those issues might be acceptable given timelines, trust, etc.

Using form elements instead of a DSL is a commonly discussed option. I think it generally depends on how dynamic the language is. For example, I always thought trying to create SQL statements with forms was dreadfully painful. I would go with forms when possible, but if things are dynamic, I would quickly start considering a language.

For example, my current project allows you to specify the following conditions:
Date Range is 5/10/99
Date Range is from 4/10/99 to 5/10/99
Profit is greater than X
Profit is less than X
Profit is X
Cost is greater than X
Cost is less than X
Cost is X

And, so on, for many different conditions. This is something dynamic enough that it's painful to do in forms.

I hope that's helpful, please shoot me another question if you want more info.

Cheers, Jay

Re: BNL or simple UI by Sergio Diaz

This thing of DSL isn't new at all, and here is an experiment that might offer some insight about.

I remember reading Lisp's books from the 90's where the term DSL was about the actual jargon used by the business people. All of this in the context of Analysis and collecting requirements

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

3 Discuss

Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and dont miss out on content that matters to you