Hyperon enables developers to externalize complex business logic. This logic (for example pricing or scoring rules) can be modified by developers or business experts in the Hyperon Studio UI. Each modification is immediately reflected in any application that uses Hyperon Runtime library, so we can say users may modify logic on the fly.
This is why Hyperon fits best to rules-heavy projects found often in finance, telecommunications or insurance industries.
Hyperon is a Business Rules Management System (BRMS) focused on performance. It is designed to easily handle large decision tables. The rules engine uses in-memory structures and carefully designed matching algorithm to search large decision tables (1M rows and more) in few microseconds. At the same time, developers and business experts may modify business logic without touching application’s code. Changes are immediately reflected in any application that uses Hyperon engine.
Hyperon business rules have the following structure:
Business rules are grouped in decision tables called Parameters. Hyperon uses parameters as its most primal structures. Developers can design their applications as configurable on the fly by making application’s code dependent on parameters.
The following is an example of parameter “tariff” used as a decision table:
These business rules grouped as parameter “tariff” can be interpreted as follows:
All above rules form a decision table with a clear structure and meaning. This table can be used as parameter “tariff” in application code:
This shows how client’s fee calculation might be parameterized with tariff parameter. The terms parameter and decision table are used interchangeably in Hyperon.
All Hyperon rules are presented in a user-friendly manner – they are in the form of tables easily exportable to Excel or CSV files.
Hyperon as a Business Rules Management System is useful in the same kind of applications as other BRMS solutions are. These applications have one of the following characteristics:
Hyperon parameters consist of 4 elements:
Each input column (condition) has to be bound to some source. It can point to some valid data in the domain model – for example policy.insurer.age is a valid path to the number which is the age of the insurer found on insurance policy. It can be also bound to the outcome of some script or another parameter.
Each condition has defined matcher which is used to check if bound value matches to a pattern in input column. Common matchers are: equals, between, in, not-in, regex, like, contains/all, contains/any, etc.
Each output column holds potential parameter’s value. This potential value will become the outcome if all conditions in the same row evaluate to true.
Hyperon parameters can return a single value, several values (a vector) or even a matrix or table of values. In combination with different matchers, different matching modes and bound sources it is a quite powerful tool in developer’s hands.
The following screenshot presents a real-life example of a parameter defined in Hyperon Studio.
On this screenshot you can see a parameter that has 6 conditions (IN columns) and 4 outcomes (OUT columns). Conditions include age and value of the vehicle (between matcher), name of previous insurer (in matcher) or insurer’s profile code (default matcher). Hyperon rules engine will find the best matching row and return its 4 values.
Typically, all Hyperon parameters are fetched from a database and converted into in-memory index when used for the first time. The in-memory index allows to find matching rows in few microseconds. The index structure guarantees O(1) lookups if all conditions use default matchers.
It is not uncommon to see a project with more that 500 parameters (decision tables) with many having more that 100k rows and some larger that 1 million rows.
Although Hyperon decision tables are very powerful means to express business logic, sometimes this may not be enough. For such situations Hyperon offers a scripting language. In other words, developers or business users may write functions which behave exactly the same as decision table do – they consume some inputs and produce some outcome.
The following is an example of groovy-based function:
Hyperon functions can read domain model, evaluate parameters or call other functions. They can perform any logic dependent on domain model data. Hyperon functions come with standard library in form of predefined objects that enable developers to:
The following screenshot presents a real-life function edited in Hyperon Studio.
Functions and parameters together form a coherent ecosystem:
Let’s see how this can be leveraged:
The above parameter:
Many projects developed for insurance or finance industries have proven that Hyperon parameters and functions together can handle any business logic.
It is difficult to see at a glance all the possibilities Hyperon offers as a BRMS. As it was mentioned earlier in the text users can express their business rules with different matchers and different matching modes. They can bind different sources to condition columns or use function calls directly in decision table cells. The following examples will demonstrate some of these aspects.
Suppose we have a simple decision table with many rows but a single condition that maps an investment fund code to a management fee:
Unfortunately, after some time an exception to this simple decision table has appeared – from now on the H01 fund fee should depend on the policy year and the policy premium amount. Moreover, the YME fund should have fee calculated with some math formula.
We can adapt easily by creating a H01-specific parameter and YME-specific function as follows:
Now the “fund.fee” parameter can be modified to handle these exceptions:
To understand how Hyperon can be used as a Business Rules Management System we need to lay out some definitions first.
As it comes to application development, business rules define how an application should behave in a given context. In other words, they define the logic an application has to follow. Most often business rules are expressed in the form of when-then statements. Examples of such rules are:
when a customer’s cart value exceeds 100$ then apply 5% discount or when some item is chosen then some other item becomes unavailable.
When the system we create gets large and complex, maintaining all the rules becomes a challenge. And this is where dedicated management system comes into play.
A Business Rule Management System is a software system designed to define and maintain the business logic often in the form of business rules or decision tables. Instead of embedding this logic in application code, the BRMS enables the logic to be externalized and managed away from the source code. Having business rules externalized and accessible to business experts, the BRMS deliver a boost to business agility and productivity offering cost savings and faster logic changes.
A business rules engine is a software component (often delivered in the form of a library) that can evaluate proper business rules and produce desired actions or outcomes. It is desirable that such an engine is performant and allows rules modification at runtime.