Saturday, October 21, 2006

BNL: DRY code, DAMP BNL - Update

Business Natural Languages: Introduction
Business Natural Languages: The Problem
Business Natural Languages: The Solution
Business Natural Languages: DRY code, DAMP BNL
Business Natural Langauges: Moving to the web and multiple contexts
Business Natural Languages: Limitations
Business Natural Languages: Common Pieces

DRY code, DAMP Business Natural Languages

Don't Repeat Yourself (DRY) is a best practice in software development. Specifying behavior once and only once is the essence of the DRY rule. When you follow this rule the maintainability of the software is increases. The rule helps ensure that if you are required to make a change you can be sure that you will only need to change the software in one location. The benefits of this rule should be quite obvious; however, does it also apply to Business Natural Languages?

Based on my experience I believe that the DRY rule does not apply to Business Natural Languages. A major reason for using a Business Natural Language is to separate the business logic from the complexities of the under-lying system. When using a Business Natural Language, business users who are the most familiar with the domain can maintain the business logic. To a business user, a Business Natural Language should be no different than a group of phrases that describe the rules for running the business correctly.

A well-designed Business Natural Language will appear as Descriptive And Meaningful Phrases (DAMP).

In 'The Solution' I used the following business logic to calculate Jackie Johnson's bonus:

employee Jackie Johnson
compensate $3000 for each deal closed in the past 30 days
compensate $800 for each active deal that closed more than 365 days ago
compensate 5% of gross profits if gross profits are greater than $1,000,000
compensate 5% of gross profits if gross profits are greater than $2,000,000

By creating shorter phrases you could rewrite the logic to be more concise:

employee Jackie Johnson
compensate $3000 each past 30
compensate $800 each closed 365
compensate 5% of profits if profits greater $1,000,000
compensate 5% of profits if profits greater $2,000,000

The new logic can be considered more DRY; however, much of the readability has been lost at the expense of removing the some of the duplication. You should not trade readability for conciseness when designing Business Natural Languages.

As businesses change their software requires change. If software can be understood and altered by subject matter experts the business can be more responsive to change. Business Natural Languages facilitate empowering subject matter experts by using a meaningful syntax to express business logic. Creating meaningful syntax often requires defining verbose phrases; however, they increase the overall readability of the phrase. Therefore, the verbose phrases carry maintainability value for the subject matter experts. If the verbose phrases are removed the logic becomes less maintainable.

It is also important to note that employees often change roles within an organization. Because staffing does change, you should not design a Business Natural Language that sacrifices readability for conciseness simply because the current subject matter expert is able to comprehend the concise version. Instead, you should design the Business Natural Language to be easily understood by any subject matter expert placed in that role.

Some programmers object to verbose phrases because they are not necessary for program execution. This is a fairly common thought because programmers are still thinking in terms of 'what will make the system work' instead of trying to solve a more valuable question: How can I empower a subject matter expert to make the system work? When you begin to think in these terms you see that verbose phrases are not strictly required; however, it's highly important to the subject matter expert who will need to continually understand and update the system.

The main goal of a DAMP Business Natural Language is empowering subject matter experts by providing the most maintainable syntax available. A Business Natural Language clearly has room for improvement in the syntax if it requires training to understand. An ideal Business Natural Language contains phrases that are descriptive and meaningful enough that they require no explanation at all.


  1. Anonymous4:40 PM

    I have been following your BNL series since the first post. Very interesting.
    I see that most of the advantages that you point out for a BNL are true for a BRMS as well.
    My personal take is that a BRMS offers more in terms of options & flexibility. Specifically
    1. Rule Development, maintenance & Business User tools
    2. Multiple deployment options
    3. Rule repositories
    4. Multiple rule formats like Decision Tables, If Then Rules

    Could you blog about where you think a BNL should be considered over a BRMS?

  2. Anonymous7:35 AM


    I've been taking my time responding because I wanted to put together a decent response. Sorry.

    After talking to a few friends who have been working in the same space it was clear that we shared a common thought: Rules engines are a great solution if they can offer you 100% of the required features. However, in our experience, 20% of the features of the rules engines solve 80% of the requirements; and, to solve the remaining requirements generally takes significantly more effort. Another issue is the overwhelmning amount of unnecessary features that are generally available in rules engines.

    The power of rules engines is elegantly solving general problems for the masses.

    The power of a BNL is a concise, readable, and specific language tailored to an individual problem within the domain.

    Thus, if you have a general problem, seek a general solution; however, if you have a specific problem that is fairly unique, a BNL is likely a good solution candidate.


Note: Only a member of this blog may post a comment.