Recently, I have been studying a newly published book on JBoss Drools Business Rules Framework named “Drools JBoss Rules 5.X Developer’s Guide“. I found this book very good, so decided to post review of this book on this blog.
This book is from Packt Publishing and written by Michal Bali. He is a freelance software developer having more than 8 years of experience working with Drools and various Java/JEE Technologies and he’s an active member of the Drools community.
The book is about Drools framework provided by JBoss Community. Drools is a Java based Business Rules Framework. Consider you are having Billing System in which you have multiple business cases on Bill generation. For example, if a customer is having category as “Gold“, apply discount 30%. If a customer is having category as “Gold” and is registered in system for more than 3 years, apply additional 10% loyalty discount. If a customer is a senior citizen, exempt some percentage of Tax etc.
In above example case, generally we write number of If… else blocks in the code to filter the conditions on given rules. But what if the system is very huge and having enormous amount of such rules. Once the rules are hard-written in code and if any changes may require in rules, you may have to change the code, build the system and release the maintenance patch to the user, which is a very hectic and time consuming process.
To get rid of such problems, Business Rules Frameworks are there using which you can configures rules in some rule configuration files, and you can alter the rules at run time without making any single changes in the code. Drools is one of the widely used open source rule engine by JBoss Community.
This book gives good insight on Drools framework by JBoss Community. The book mainly consists of 12 Chapters full of easy to understand theories and rich examples. We will quickly have brief reviews on each chapters:
Chapter 1: Programming Declaratively
This chapter consists of basic introduction of the business rules and business process domain. The need of business rules and why standard solution fails if the number of rules are huge and rules are complex. Also, the history of Drools is mentioned in this chapter.
Chapter 2: Writing Basic Rules
This chapter shows the basics of working with the Drools rule engine, Drools Expert. It shows the simple examples and explained step-by-step. Also, it mentions the development environment setup, writing a simple rule and then executing it. The chapter goes through some necessary keywords and concepts that are needed for more complex examples.
Chapter 3: Validating
This chapter explains the example of a banking domain. This example will be the basis for examples later in this book. The chapter then goes through an implementation of a decision service for validating this banking domain. A reporting model is designed that holds reports generated by this service.
Chapter 4: Transforming Data
This chapter explains how Drools can be used for doing complex data transformation tasks. It starts with writing some rules to load the data, continues with the implementation of various transformation rules. Also, it puts together the results of this transformation. This chapter shows how we can work with a generic data structure such as a map in Drools.
Chapter 5: Creating Human-readable Rules
This chapter focuses on rules that are easy to read and change. Starting with domain-specific languages, the chapter shows how to create a data transformation-specific language. Also, it focuses on decision tables as another more user friendly way of representing business rules. An interest rate calculation example is shown. And finally, this chapter introduces the JBoss jBPM as a way of managing the rule execution order.
Chapter 6: Working with Stateful Session
This chapter talks about executing the validation decision service in a stateful manner. The validation results are accumulated between service calls. This shows another way of interacting with a rule engine. Logical assertions are used to keep the report up-to-date. Moreover, various ways to serialize a stateful session are discussed in this chapter.
Chapter 7: Complex Event Processing
This chapter goes through various features such as events, type declarations, temporal operators, sliding windows, and others. Drools Fusion, another cornerstone of the Drools platform, is about writing rules that react to various events. The power of Drools Fusion is shown on a banking fraud detection system. This is a very interesting chapter.
Chapter 8: Defining Processes with jBPM
This chapter discusses into more detail about the workflow aspect of the Drools platform. It is shown on a loan approval service that demonstrates the use of various nodes in a flow. Also, the chapter talks about implementing a custom work item, human task, and a subflow etc.
Chapter 9: Building a Sample Application
This chapter shows how to integrate Drools in a real web application. You will be gone through the design and implementation of persistence, business logic, and presentation layers in this chapter. Also, all the examples written so far will be integrated into this sample application.
Chapter 10: Testing
This chapter aims to give you an idea of various ways of how to test your business logic. Starting with unit testing, integration testing through acceptance testing will be shown on the business rules management server, whis is known as Guvnor. This chapter provides useful advice on various troubleshooting techniques as well.
Chapter 11: Integrating
This chapter demonstrates the integration with the Spring framework. It describes how we can make changes to rules and processes while the application runs. It shows how to use an external build tool such as Ant to compile rules and processes. It talks about the rule execution server that allows us to execute rules remotely. It also briefly mentions support of various standards.
Chapter 12: Learning about Performance
This chapter takes us under the hood of the Drools rule engine. By understanding how the technology works, you’ll be able to write more efficient rules and processes. It talks about the ReteOO algorithm, node sharing, node indexing, and left/right unlinking. You’ll find this chapter very interesting if you are a kind of performance geek!
In summary, I would like to quote that,
This drools book is a very good step-by-step reference with practical examples. This helps specially for the beginners since the flow of the book is very structured and intuitive. I would recommend to grab this book if you are willing to dig deep into Drools framework. A perfect guide for the drools developers!!!
You can grab the copy of this book on Packt Publishing website at
Share if you have liked this review. Enjoy!