you're reading...
Code Comprehension, Requirements Gathering

Extracting Business Rules from Legacy Code

I had written earlier on why there is need to understand code from legacy systems here https://eswarann.wordpress.com/2010/04/23/on-understanding-code/ . One of the concerns during migration of legacy systems is to document the business rules from the software. What are business rules?

Wikipedia defines it as –

Business rule is a statement that defines or constrains some aspect of the business. It is intended to assert business structure or to control or influence the behavior of the business. Individual business rules that describe the same facet of an enterprise are usually arranged into business rulesets. Business rules describe the operations, definitions and constraints that apply to an organization in achieving its goals.

www.businessrulesgroup.org defines it at two levels – Zachman Framework at Row 2 level and at Row 3 Level. 

  • From the business (‘Zachman row-2’) perspective, it pertains to any of the constraints that apply to the behavior of people in the enterprise, from restrictions on smoking to procedures for filling out a purchase order.
  • From the information system (‘Zachman row-3’) perspective, it pertains to the facts that are recorded as data and constraints on changes to the values of those facts. That is, the concern is what data may, or may not, be recorded in the information system.

When business rules are embedded in the software and there is no documentation that details them outside of the software, there is a requirement to extract business rules from the software and generate documentation to put it in plain English. Essentially this would mean extracting Zachman Row 3 artifacts and re-writing them in Zachman Row 2 format.

 Extracting business rules from code is not that simple. What forms a business rule? This may take many forms. Some of them are:

  • Validation on-screen entry variable
  • Processing conditions expressed as if conditions
  • Select conditions in SQL Statements

Tools that are used to extract business rules must be able to extract them from the above descriptions and may be more. This is the challenge in extracting business rules and knowing when you extracted all of them.

One approach in handling the extraction problem is to classify the business rules. One possible classification scheme is as follows.

  1. Input data validation
  2. Access Rights
  3. Processing rules – from if conditions, for loops, while loops etc.
  4. Database defined rules – SQL triggers, schema controls
  5. Rules of existence or form, from files and look up.
  6. Batch job execution sequences
  7. Operational process constraints – logging, auditing, reporting rules

If we able to classify them properly then a tool could be configured to extract specifically these class of business rules. Once extracted it is a simpler exercise to create the relevant Zachman Row -2 with the help business experts.

The older the legacy system the more difficult it would be to identify the same. One solution is to extract all and then examine the same for relevance and prune it down.






2 thoughts on “Extracting Business Rules from Legacy Code

  1. These are the simpler rules to extract. What about those that are intrinsic to the particular problem domain? Where can you find them in the code?

    For example, where in the code will I find the rule that says that all work centers will request a work status reprot at 3PM so that they may scheudle OT?

    Where might I find the rule that says check deadbeat accounts at a given address for typical pet names?

    Posted by Larry Bernstein | July 30, 2010, 2:56 am
    • True!

      This is where I differentiate understanding code and undertanding intetntion behind code. If commentary is missing then only recourse is to have a good domain expert else…

      From code only can glean only how the code works . true application mining would probably give rise to answers to some of your questions.

      Posted by eswarann | July 30, 2010, 7:40 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 71 other followers

%d bloggers like this: