Ckrule Rule Engine

Source: Internet
Author: User
Tags table definition

Recently, I participated in the ERP system development of a material company, mainly responsible for warehousing systems. As the company's business processes are relatively complex and changeable, it is so painful to do it that It is immersed in the endless loop of business code change. Over time, there is a sense of despair.

How can we adapt to such complex business changes well or easily? Recently, I did not really look at the posts of the great gods in the garden, but I have little but I may not understand them deeply. When I was bored two days ago, I posted my nagging questions in the circle. Someone later recommended me a rule engine called ckrule. Rule engine? I heard this for the first time. Baidu found the official website of ckrule and decisively downloaded the trial version. The green version of the file is very small, less than 1 m. After opening the main program, the interface is refreshing.

Ckrule rule engine software Main Interface

Then, I downloaded the user manual on the official website, which looked very powerful. I am not familiar with text-based things, so it is difficult to understand every sentence with heart, or to study the examples in it. This effect is more direct. Open the parking fee instance from the program.

 

Ckrule rule engine development interface

Taking a serious look, the instance mainly consists of three main parts: "Object Library", "Call Library", and "rule library. Looking at the results, I clicked the test in the test list directly. After the test is completed, I realized that the instance meets the need for changing parking fees due to a variety of variable factors.

Ckrule Rule Engine Test

Knowing the business needs of the Instance implementation, let's take a closer look at its implementation. The content in the "Object Library" is relatively easy to understand, that is, classes and variables in. Net at ordinary times. In the "parking fee" instance, all the variables needed to calculate the parking fee are defined in the input and output variables. The "Call Library" is not used in the "parking fee" instance and is skipped for the moment. The next "rule repository" should be the core part of ckrule. After clicking the relevant interface twice, I still don't feel much about it, I had no choice but to find the corresponding user manual. After reading it, I have some understanding of the terms. A "decision table definition" defines a table. You can add custom fields and set the data type and logic type of fields (the conditions and conclusions can be customized ). After the table is defined, you can enter the content in "decision table settings". The content is some criteria. In this example, it is actually a "hourly parking fee" table, when the condition is met, a correct parking unit price is returned. The content in "definition of the customer rule pool" appears to be automatically generated, without special settings, and has not been studied in depth for the moment. "Decision Tree" should also be a more advanced feature to implement more complex businesses, which is not mentioned in this instance. A main program is added to the "main rule". The main logic in the program is relatively small. The main function is to use "parking hours * unit charges" to get parking fees, the "unit charge" is calculated and obtained by decision-making rules.

Looking back at this instance, the ckrule Rule Engine removes the various computing "unit-based charging" logic from the logic of the master rule and independently computes it through decision-making rules, this ensures that, without changing the main rules, you only need to easily configure the "unit charge" rule to adapt to the business needs of the different charging elements of the parking lot, which is awesome.

It took two hours to get to know it through the instance that comes with the ckrule rule engine. When dealing with complicated and changing businesses, the ckrule rule engine can still be the only one. Later, we will learn more about its advanced functions and share our learning process with our friends.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.