I've been tasked to look into one of the existing business logic wrapped around the rules engine to calculate the cost of products, and come up with better solution to address some of the issues identified within existing system.

Problem Statement

I want to calculate the cost and/or time required to manufacture product X.

We have a complex Business requirement. We manufacture a wide range of products. Every product is customized to meet customer needs.

Existing Architecture

As of now, we have been working through something called "Rules Engine". As the name suggests, calculation for the cost/time product requires to manufacture goes through a set of pre-defined rules. Rules are stored in a database with a very complex table design. Rules engine has evolved from simple if conditions to loops, go-to, etc... it also stores formulas for the calculations. Rules of the Rules engine are managed by users.

the table design looks something like this:

Image description

Need for restructuring/reengineering

Since the release of the project (early 2000), rules are rarely touched. It has grown to be more complex, the last feature added within the rules engine was in 2019.

users have complained about the difficulties in understanding existing rules. Since they do not have the testing environment to test their changes, they are less inclined to make any changes to existing rules.

This is causing them grief. They would like to see something different.

Need Advice

I believe there are multiple ways to solve this issue. but I am not sure which one is the best.

  1. simplify existing rules engine:
    This means, removing many of the complex conditional statements support from the existing rules engine, this may make it easy to read and understand the rules engine. However, the GO-TO is the most painful one... I don't think something like loop and go-to should exist in the rules engine.

  2. hard-coded rules with some flexibility with configurations:
    This means, moving all existing rules from the table to the hard-coded functions. This means, now responsibility of the maintaining shift from users to developers.

  3. new rules engine
    I don't know what and how to approach this. Many of the business need meets the "Rules Engine" requirement. But striking the balance is important.

  4. DSLs
    "Domain Specific Language" (DSL) is also one of the ways to resolve this issue. However, I think this might be an overkill. We don't have the resources to meet the development requirements.

I would like to know what you'd do in this situation.

Thanks.
:)