3

I have a query on whether the following requirements would need to be designed via Business Rules - this is for a JEE based application where currently this is coded as part of the Business logic.

System will create a tax account for every city, county and district combination that imposes tax for only certain cities, counties or districts depending on the taxpayer's business.

When the user establishes an account which exists in all subdivisions (i.e. at city or county level), the application must use his tax code and automatically populate all the locations without requiring the user to data enter every location.

I assume this would mean a data lookup table from a master table (of tax accounts) and fetch and display all locations. Is there some way in which a Rules Engine can be used to manage these combinations?

2
  • 3
    Can you better define Business Rules Engine, because this term typically refers to expensive software suites that allow business analysts to visually drag and drop their own business logic from a GUI. What you are describing isn't the requirement for a Business Rules Engine but is the description for an actual Business Rule. Good Business Rule Engines are extremely complex and expensive third party software suites so I doubt you are expected to write that. Typically instead I will write a Business Logic layer and include each of my business rules in methods through code.
    – maple_shaft
    Commented Nov 23, 2012 at 12:48
  • hi, I mean use of Drools as an example of Rules engine. so is the above statement a valid rule to define in Drools. Commented Nov 23, 2012 at 15:26

1 Answer 1

4

You can create your own simple Business Rule Engine with language like Groovy and concept of Domain specific Language (DSL). Business rule written in dynamic language like Groovy (for your J2EE) allow you to change rule/business logic of the application without redeploying. Groovy also have specific features, like metaprogramming, closures, AST transformations, builders that make this task doable. It will be very painful, if not impossible to create decent DSL in java.

Creating domain specific Language (DSL) allow your business users if not code the rule themselves but at least easily read them and understand. And all you need for authoring business rules is simple text editor or Eclipse.

Groovy very well integrated into J2EE application, so you can write only rule portion in the language.

Another question do you really need power and flexibility of business rules and DSL for your application? In my case business want to change rules themselves quite often.

There are resources available if you want to dig deeper: book GroovyInAction Second edition from Manning, book - Groovy for DSL - the later one has a chapter on creating groovy Rule engine - good starting point. There is also several publications online - just goodle for groovy and dsl keywords. http://docs.codehaus.org/display/GROOVY/Writing+Domain-Specific+Languages

Drool is complex piece of software, maybe overkill for task at hand.

1
  • Other languages such as JRuby and Scala also allow you to create a custom DSL. Commented Apr 3, 2013 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.