An Overview of LogicGem

LogicGem is a Windows application which has a two-fold audience, business analysts and software developers. The common thread between these two diverse groups is that they both need to design logically complete business rules.

For a business analyst, it is crucial to establish rules for different processes within a business and illustrate how these rules synergize to build robust business practices. This becomes especially vital when dealing with intricate rules, as you must convincingly show stakeholders that every condition has been thoroughly considered and nothing has been missed.

Programmers often rely on business rules as functional requirements for crucial software applications. This involves accurately translating these rules into code that becomes an integral part of the application.

LogicGem is a valuable tool for business process analysis and software development. You can define your business processes in a structured and organized way that makes them easy to visualize, share and review.

Here are some of the ways LogicGem can help your business:

  • Develop a clear, concise representation of your business rules.
  • Manage and refine complex decision-making processes visually.
  • Show rules in a format that are easily understood by everyone.
  • Ensure proposed business processes are complete and correct.
  • Eliminate errors by documenting all possible outcomes.
  • Quickly find any missing, redundant or ambiguous rules.
  • Automatically generate source code for your business software.
  • Reduce time spent debugging complex business rulesets.

LogicGem enables you to define your business rules using decision table methodology. It consists of a decision table editor which you can use to create decision tables and a logic compiler which converts into documentation or code. With the editor, you can create and modify decision tables which describe a set of logical rules. One part of the table defines the conditions that are linked to create a rule, and the other part defines the actions related to those rules.

With the logic compiler, you can use LogicGem to generate documentation which describes the rules in English, French, German or Spanish. In addition to natural languages, you can also use LogicGem to translate the decision table rules into source code for a software application. LogicGem supports a wide variety of programming languages, including Python, Java, R, C#, Scala and many others.

Decision Tables

Decision tables are a method for visually representing a collection of rules, typically used to describe a specific business process. The table defines what actions can be performed depending on specific conditions. It’s represented in a spreadsheet like structure, with the rows defining the conditions and actions to be taken and each column defining a rule.

This is a simple example of a decision table which describes what actions should be taken when someone orders an item from a store. The top three rows are the conditions, and the bottom three are the possible actions. The goal is to create a set of rules which describe what should be done when any of the three conditions occur.

Using this example, you can see that we have three conditions we want to check when a customer places an order. First, we want to make sure that the quantity they’ve requested is allowed. Here, we just describe it as a maximum limit and don’t explicitly specify a value but that is something we could also do. Next, we want to make sure that there are enough items in stock to satisfy the number of items ordered. And lastly, we want to make sure that our customer has approved credit to make the purchase.

With our three conditions defined, we also want to define what actions can be taken when an order is placed. In this case, we can either accept the order, reject it or defer it because we currently don’t have enough items in inventory to complete the order. The numbers assigned to the rows for each action indicate whether that action should be taken. For simple tables like this, we can use a value of “1” to indicate the action should be taken and leave it blank if no action should be taken for the rule.

Some classic decision tables just use an “X” to indicate the action should be taken, but more complex tables use numbers to define the order in which a particular action should be performed. LogicGem allows you to enter a value of 1-9 to indicate the order, with remaining actions performed in the order they’re listed.

To complete our decision table, we also need to define the rules for each of these conditions and actions. In the top section of the table where we have our conditions, there are three possible states: Yes (y), No (n) and Undefined (-). To define a rule, you first decide how you want to answer each condition and then decide what action should be taken. For example, a description of Rule 1 would be “If the order quantity is acceptable, we have enough items in inventory to complete the order and the customer has approved credit, then accept the order.”

Business Analysis

If you are a business analyst, it’s important to make sure that the rules you’re defining for a business process are logically complete. You want to make sure that your rules aren’t ambiguous or redundant, and even more importantly you want to make sure that you haven’t missed any rules. The more conditions you need to describe, the more complex those rules become and the greater the chance that a mistake will be made, or something will be overlooked.

This is where LogicGem can really help you. More than just a simple decision table editor, LogicGem includes functionality which allows you to easily determine if your table is logically complete. It will check for any ambiguities in your rules and can automatically disambiguate complex rule sets. You can also have LogicGem expand your collection of rules or reduce it to the minimum number of rules required to satisfy all the conditions you’ve described.

What happens if you’ve completed the initial design of your decision table, but LogicGem is showing that it’s incomplete and missing one or more rules? You can ask LogicGem to analyze your table and automatically generate any rules you may have overlooked. You can either have it create all the new rules needed to complete your table, or you can ask it to find those missing rules one at a time.

Software Development

Much of the initial effort in software development doesn’t just involve writing code, but also requires the process of handling every possible condition the program will encounter. When a developer overlooks a possible combination of inputs or events, the application may perform the wrong function. Even worse are errors made during program maintenance, usually when programmers are modifying code they do not fully understand. This is a common situation, particularly when it involves the interaction between dozens of different conditions and actions. It’s easy for developers to omit, duplicate, or contradict conditions.

What if you wanted to take the decision table shown above, and convert that into application code? Of course, you could use the table alone as a guide for how to design the business rules in your application. With a relatively simple table like this, it wouldn’t be too difficult to create a series of if/then or case statements. But what if that table had twelve conditions instead of three, and had several additional actions that would need to be performed in a specific order? Suddenly, you’re looking at much more complex code and there’s a very good chance you’ll get some of it wrong. Worse yet, you could end up missing an edge case that rarely occurs, which means your software now has a defect that’s extremely difficult to reproduce.

Finally, as software developers, let’s be honest. Writing this kind of code is not a particularly enjoyable task. It’s tedious and error prone, requiring extensive testing and debugging when something goes wrong. Wouldn’t it be great if you had a tool where you could take a business analyst’s collection of rules for a process, adjust it to represent those conditions and actions in your programming language of choice and then automatically generate all that code with the push of a button? You wouldn’t have to wonder if you’ve missed a condition or accidentally duplicated the code for a rule somewhere.

LogicGem can do that for you. Let’s take our example decision table and change it so that it can represent code in a Python application.

The only thing that has changed are the descriptions of the conditions and rules, expressed as Python code instead of English. In this case, we’re presuming our application has functions which return the maximum order limit, the number of items in stock and a check for whether the customer has credit.

The actions call three different functions, one to accept the order, another to reject it and a third to defer the order.

Importantly, we have only changed the description of the conditions and actions. None of the rules our business analyst defined for us have changed, so we know this is exactly how they should be implemented in our application. How would this all look inside LogicGem? Very similar to how our decision table looks.

Once we have our table defined inside LogicGem, and we verify that it’s logically complete and unambiguous, it’s time to generate our code. You compile the table by clicking on the toolbar (it’s the lightning bolt icon) or you can select the Compiler menu item. LogicGem supports generating code in over twenty different programming languages, but for this example we’ll choose Python. The result is output into an editor which you can use to review and modify the code to meet your requirements. With all your business logic created at the click of a button, you can start incorporating it into your application.

Getting Started

LogicGem provides a familiar, easy-to-use way to create, edit, verify and compile decision table logic. It provides the means to prototype and expand a high-level procedural concept into a decision table, work it through analysis and design phases, and then generate English language documentation and programming source code in various programming languages. LogicGem gives you all of the tools needed to ensure that your table’s logic is complete, unambiguous and contains every applicable rule in an expanded or reduced format.

To get started with LogicGem, download a free evaluation copy of the software. We have several tutorial videos, and a Quick Start Guide that can provide you with step-by-step instructions on how to create your first decision table and explore the features available in LogicGem. Our support team is always available to help answer any questions you may have.