Progress MarkLogic is a robust and reliable enterprise database, especially as a single integrated backend for multiple data models.
Whether you need to run business logic on one or multiple data models, creating, testing and maintaining business logic is always a difficult task. There are many reasons why this is the case. Some of the reasons we hear most often are:
In this blog, we’ll explore how Progress Corticon.js solves this problem and transforms the development of business logic for complex rules. The transformation lies in how rules are directly developed, tested and maintained by business specialists who do not need to be programmers. In other words, the rules are owned by the business group itself. When using Corticon.js, business logic becomes real services, and the role of the integrator is to use these services as efficiently as possible.
This blog is for architects and application designers working with MarkLogic databases and associated system applications. It shows how, as a decision-maker, you can greatly improve how business logic is developed, tested and deployed. It is also useful for integrators of such systems as they get an understanding of how a no-code decision service can be integrated into the MarkLogic processing pipeline.
We will explore how business specialists provide these decision services with a simple car insurance example. The insurer is charging a user on daily usage. Specifically, the use case is to compute how much to charge the user based on distance driven today, risk level of zones driven and vehicle cost.
In Corticon, business analysts work with two main artifacts to create a decision service, rulesheets and ruleflows. Additionally, Corticon provides testing at the decision service level (system testing) or the rulesheet level (unit testing).
In the rulesheet, the analysts express the rules conditions and associated action. In the ruleflow, they express how all rulesheets are connected to create a decision service.
In this simple example, we see how a decision service is decomposed into three independent rule sets (three Corticon rulesheets). There are many advantages to such a decomposition. For one, this allows for scaling as each business analyst can work on their specific domain independently.
Additionally, the ruleflow—as its name indicates—specifies the order of execution.
Additional constructs are available to modelers. Of course, a ruleflow can specify different branches to execute depending on business data. For more complex projects, a ruleflow can be decomposed into subflows for better organization and scalability.
The core of the business rules is written in a familiar spreadsheet like the interface shown in the following image.
For example, rule 2 specifies that a driver, aged 18 to 25 with 2 years of driving experience, has driven today a distance in the range of 1 to 29. All that sums up the cost to be 3.98. Additionally, for all cases (column 0), the business analyst records the computation date and computes the driver’s age.
One key aspect of enabling business specialists to author business rules is to provide a common understanding of the data available for processing as input and output.
Corticon provides a view of the enterprise data in an easy-to-work way for the business specialist. If needed, it provides an optional mapping between the actual data and the business representation. This allows business users to work with names or terms that are more familiar to them without impacting the integration of the decision service into the rest of the application.
Typically, as an architect or application designer, you may have to provide this vocabulary to the business specialists.
Here is an example view:
Note that this is an oversimplified vocabulary for illustrating concepts. In practice, Corticon supports very complex vocabulary with very deep relationships (1 to 1, 1 to n or many to many). It is common for us to see a vocabulary containing thousands of items; that’s why we have a filter capability that allows the user to narrow complex vocabulary down to area of interest.
As you have seen in the example, business specialists focus on the business rules in a technology-agnostic fashion. That is, they do not have to be trained or even understand the programming language(s) of the solution with which the decision services integrate.
To provide an integration point, Corticon allows the business rules to be exported to specific target platforms. Corticon supports Java, .Net and JavaScript.
The export process is typically done within a CI/CD pipeline but can also be done interactively with Progress Corticon Studio. Here is an example of a Corticon dialog for packaging the rules for execution:
The decision service “Calculate Daily Insurance” is exported for integration with MarkLogic and could also be exported to various serverless cloud functions or even exported to run directly in a browser. Corticon provides a lot of architectural choices to future-proof your solution.
When exporting to MarkLogic, you will get a decision service that can run directly in MarkLogic as server-side JavaScript providing high performance and simplicity of deployments.
Using a no-code solution for developing some of your MarkLogic business logic provides tremendous value:
Want to dive even deeper? Explore two design patterns for decision services in MarkLogic server-side JavaScript in our blog "Two Design Choices for Your MarkLogic Decision Services."
If you want to know more and get a demo of what we covered in this blog, feel free to register for the MarkLogic Community Event April Edition. You can also enroll in a free training for Corticon.js.
Thierry Ciot is a Software Architect on the Corticon Business Rule Management System. Ciot has gained broad experience in the development of products ranging from development tools to production monitoring systems. He is now focusing on bringing Business Rule Management to Javascript and in particular to the serverless world where Corticon will shine. He holds two patents in the memory management space.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites