My First Book Published – Business Rules with JBoss Drools

The guys over at the official Drools blog beat me to the announcement, as I was waiting for it to published on Amazon, but now that it has, I’m happy to announce that after 12 months of pushing and shoving, I’ve finally got my first book , on Business rules and Workflow, out the door.

What, you’re still here? Well if it takes a bit more to convince you to buy it, here’s the info on the Business Rules and Workflow book direct from the publishers (Packt) own site. If you can’t wait, and want to dive right in, the code samples from the book are available on the Red Piranha 2 website.

JBoss Drools Business Rules
JBoss Drools Business Rules Capture, automate, and reuse your business processes in a clear English language that your computer can understand.

  • An easy-to-understand JBoss Drools business rules tutorial for non-programmers
  • Automate your business processes such as order processing, supply management, staff activity, and more
  • Prototype, test, and implement workflows by themselves using business rules that are simple statements written in an English-like language
  • Discover advanced features of Drools to write clear business rules that execute quickly
  • For confident users of Excel or other business software, this book is everything you need to learn JBoss Drools business rules and successfully automate your business.


Code download
Request a Review Copy
Send us feedback on this title
Ask a question about this title
Sample Chapter 4 Guided Rules with the Guvnor [2.0 MB]
Table of Contents
Book Details

Language English
Paperback 305 pages [191mm x 235mm]
Release date April 2009
ISBN 1847196063
ISBN 13 978-1-847196-06-4
Author(s) Paul Browne
Topics and Technologies Open Source, Java


A comprehensive, practical guide for business analysts and non-programmers to harnessing JBoss Drools Business Rules in your organization

In Detail

In business, a lot of actions are trigged by rules: “Order more ice cream when the stock is below 100 units and temperature is above 25° C”, “Approve credit card application when the credit background check is OK, past relationship with the customer is profitable, and identity is confirmed”, and so on. Traditional computer programming languages make it difficult to translate this “natural language” into a software program. But JBoss Rules (also known as Drools) enables anybody with basic IT skills and an understanding of the business to turn statements such as these into running computer code.

This book will teach you to specify business rules using JBoss Drools, and then put them into action in your business. You will be able to create rules that trigger actions and decisions, based on data that comes from a variety of sources and departments right across your business. Regardless of the size of your business, you can make your processes more effective and manageable by adopting JBoss Rules.

Banks use business rules to process your mortgage (home loan) application, and to manage the process through each step (initial indication of amount available, actual application, approval of the total according to strict rules regarding the amount of income, house value, previous repayment record, swapping title deeds, and so on).

Countries such as Australia apply business rules to visa applications (when you want to go and live there)—you get points for your age, whether you have a degree or masters, your occupation, any family members in the country, and a variety of other factors.

Supermarkets apply business rules to what stock they should have on their shelves and where—this depends upon analyzing factors such as how much shelf space there is, what location the supermarket is in, what people have bought the week before, the weather forecast for next week (for example, ice cream in hot weather), and what discounts the manufacturers are giving.

This book shows how you can use similar rules and processes in your business or organization. It begins with a detailed, clear explanation of business rules and how JBoss Rules supports them.

You will then see how to install and get to grips with the essential software required to use JBoss Rules. Once you have mastered the basic tools, you will learn how to build practical and effective of the business rule systems.

The book provides clear explanations of business rule jargon. You will learn how to work with Decision Tables, Domain-Specifi c Languages (DSL)s, the Guvnor and JBoss Integrated Development Environment (IDE), workflow and much more.

By the end of the book you will know exactly how to harness the power of JBoss Rules in your business.
Read the full Table of Contents for JBoss Drools Business Rules

What you will learn from this book

  • Understand the basics of business rules and JBoss rules with minimal effort
  • Install the required software easily and learn to use the Guvnor, which is a user-friendly web editor that’s also powerful enough to test our rules as we write them
  • Learn to write sophisticated rules and import the fact model into the Guvnor and then build a guided rule around it, which makes your web pages a lot clearer
  • Gain complete knowledge of what we can do with the Guvnor rule editor, and then use the JBoss IDE as an even more powerful way of writing rules, and automate processes for discounts, orders, sales, and more
  • Know the structure of the rule file through the example of a shipping schedule, which will help you with your own shipping schedule
  • Test your rules not only in the Guvnor, but also using FIT for rule testing against requirements documents; run unit tests using JUnit for error-free rules and interruption-free services
  • Specifically, non-developers can work with Excel spreadsheets as a fact model to develop business processes without learning any other new technology
  • Work with DSLs (Domain-Specific Languages) and rule flow to make writing rules easy; which makes staff training quicker and your working life easier
  • Deploy your business rules to the real world, which completes your project successfully, and combine this into a web project using the framework of your choice to provide better services
  • Benefit from concepts such as truth maintenance, conflict resolution, pattern matching rules agenda, and the Rete algorithm to provide advanced and faster business systems so that staff efficiency is maximized

Chapter 1, Drooling over JBoss Rules. This chapter gives you a good platform to understand business rules and JBoss rules. We look at the problems that you might have (and why you’re probably reading this book). We look at what business rule engines are, and how they evaluate business rules that appear very simple and how they become powerful when multiple rules are combined.

Chapter 2, Getting the software, deals with installation. This chapter explains setting up Java, setting up Business Rule Management System (BRMS)/Guvnor running on the JBoss App Server, setting up Eclipse, and installing the Drools Plug-in. It also details the installation of the Drools examples for this book and the Maven to build them.

Chapter 3, Meet the Guvnor, deals with writing our rules using the ‘Guvnor’. Guvnor is the user-friendly web editor that’s also powerful enough to test our rules as we write them. We take up an example to make things easier. Then we look at the various Guvnor screens, and see that it can not only write rules (using both guided and advanced editors), but that it can also organize rules and other assets in packages, and also allow us to test and deploy those packages. Finally, we write our very first business rule—the traditional ‘Hello World’ message announcing to everyone that we are now business rule authors.

Chapter 4, Guided Rules with the Guvnor. This chapter shows how to use the Guvnor rule editor to write some more sophisticated rules. It also shows how to get information in and out of our rules, and demonstrates how to create the fact model needed to do this. We import our new fact model into the Guvnor and then build a guided rule around it. Finally we test our rule as a way of making sure that it runs correctly.

Chapter 5, From Guvnor to JBoss IDE. This chapter pushes the boundries of what we can do with the Guvnor rule editor, and then brings in the JBoss IDE as an even more powerful way of writing rules. We start by using variables in our rules example. Then we discuss rule attributes (such as salience) to stop our rules from making changes that cause them to fi re again and again. After testing this successfully, we look at text-based rules, in both the Guvnor and the JBoss IDE, for running ‘Hello World’ in the new environment.

Chapter 6, More Rules in the jBoss IDE. This chapter looks again at the structure of a rule fi le. At the end of this chapter, we look at some more advanced rules that we can write and run in the IDE.

Chapter 7, Testing your Rules. This chapter explains how testing is not a standalone activity, but part of an ongoing cycle. In this chapter we see how to test our rules, not only in the Guvnor, but also using FIT for rule testing against requirements documents. This chapter also explains Unit Testing using JUnit.

Chapter 8, Data in Excel, Rules in Excel. This chapter explains how to use Excel Spreadsheets (cells and ranges) as our fact model to hold information, instead of the write-your-own-JavaBean approach we took earlier. Then we use Excel spreadsheets to hold Decision tables, to make repetitive rules easier to write.

Chapter 9, Domain-Specific Languages [DSL] and rule flow. This chapter aims to make our rules both easier to use, and more powerful. We start with DSLs—Domain-Specifi c Languages. This chapter follows on from the ‘easy to write rules’ theme from the previous chapter and also discusses both ruleflow and workflow. It would be great to draw a workfl ow diagram to see/control what (groups of) rules should fi re and when. Rule flow gives us this sort of control.

Chapter 10, Deploying rules in real life. This chapter shows you how to deploy your business rules into the real world. We look at the pieces that make up an entire web application, and where rules fit into it. We see the various options to deploy rules as part of our application, and the team involved in doing so. Once they are deployed, we look at the code that would load and run the rules—both home-grown and using the standard RuleAgent. Finally we see how to combine this into a web project using the framework of your choice.

Chapter 11, Peeking under the covers. This chapter looks at what happens under the cover by opening up the internals of the Drools rule engine to understand concepts such as truth maintenance, confl ict resolution, pattern matching, and the rules agenda. In this chapter, we explore the Rete algorithm and discuss why it makes rules run faster than most comparable business logic. Finally we see the working memory audit log and the rules debug capabilities of the Drools IDE.

Chapter 12, Other Drools features. This chapter deals with the other advanced Drools features that have not yet been covered. This includes Smooks to bulk load data, Complex Event Processing, and Drools solver to provide solutions where traditional techniques would take too long.

Approach

This book takes a practical approach, with step-by-step instructions. It doesn’t hesitate to talk about the technologies, but takes time to explain them (to an Excel power-user level). There is a good use of graphics and code where necessary.

Who this book is written for

If you are a business analyst – somebody involved with enterprise IT but at a high level, understanding problems and planning solutions, rather than coding in-depth implementations – then this book is for you.

If you are a business user who needs to write rules, or a technical person who needs to support rules, this book is for you.

If you are looking for an introduction to rule engine technology, this book will satisfy your needs.

If you are a business user and want to write rules using Guvnor/JBoss IDE, this book will be suitable for you.

This book will also suit your need if you are a business user and want to understand what Drools can do and how it works, but would rather leave the implementation to a developer.


Author(s)

Paul Browne
Paul Browne’s first job was selling computers in France and things went steadily downhill from there. He spent millons on behalf of a UK telephone company’s procurement department and implemented direct marketing for a well-known Texan computer maker before joining the IT department of a company that builds bright red tractors and other seriously cool machines.

Paul then embraced his techie side (he was writing games in machine code from the age of 11) and started a consultancy that used IT to solve business problems for companies in the financial and public sectors in Ireland, UK , Belgium, and New Zealand. Eight years later, he now works with an Irish government agency that helps similar software companies to grow past their initial teething pains.

More formally, Paul has a bachelor’s degree in Business and French from the University of Ulster, a master’s degree in Advanced Software from UCD Dublin, a post-grad qualification in Procurement from the Chartered Institute of Procurement and Supply (UK), and will someday complete his ACCA financial exams.

Paul can be found on LinkedIn at http://www.linkedin.com/in/paulbrowne , and via the Red Piranha (Business knowledge) project at http://code.google.com/p/red-piranha/ .

Advertisements

Collective Intelligence in Action

Don’t you hate it when you spend months (or years) working on a pet project / book / mad take over the world idea, then somebody comes out with something even better?

Yep, it’s just happened to me. Years working on the idea of the ‘Wisdom of Crowds’ (even prior to web 2.0 in the shape of Red-Piranha). Month’s working on a Masters Dissertation on applying Web 2 techniques to the Finance industry (pdf link). And somebody comes out and does it even better.

Not just better. But much much better.  The sort of better as in ‘If I had this earlier, I’d have just copied it and changed the words around a bit’. The book is available from Manning as ‘Collective Intelligence in Action‘. A free, first chapter (Understanding Collective Intelligence) is available here (pdf).

Collective Intelligence in Action

So what’s it about? We’ve all heard about the Wisdom of Crowds idea. But what if you need to actually implement it on your website? This book shows you how to (using both concepts and practical code, as well as the theory behind all of it that I was missing). It includes

  • Intelligent, learning search, using Lucene.
  • Extracting data from blogs using web-crawling.
  • Executing Real time feedback on facebook-like sites.
  • Scalable data-mining techniques to manage the torrent of information
  • Making personalised recommendations based on all of the information.

Disclaimer:Manning provided me with a free review copy of the book – but no strings attached. And , maybe if I’m nice enough to the Author (Satnam), I can persuade him to talk about making millions using JBoss Drools and Complex Event processing in the book.

Business Rules without Java

I like this sample as it explains what Business Rules are, in a way that professional (i.e. non technical people) can understand. This one I originally posted on the O’Reilly Java and JBoss Drools blogs. If you were around in Dublin last month, you’ll notice that it’s also the sample that I talked through at the Irish Java Technologies Conference.

Like many countries, the Health services in Bangladesh can’t get enough doctors. Training more is not a solution ; Qualified doctors often leave for better pay elsewhere. Given the urgent need for trained medical staff in rural areas so save lives (often children dying of curable diseases), what are health workers to do?

The solution that the Health workers came up with was IMCI – or Integrated Management of Childhood Illness. It takes what the Knowledge in Doctor’s head’s and stores it as a simple guide that health workers can follow. When a sick child is brought into the clinic the health worker is able to follow the simple step-by-step instructions to make quite a sophisticated diagnosis.

I’ve no medical training beyond simple CPR (and if you’re relying on that then you’re in real trouble) but even I can understand it.

imci.jpg

Look at the pale blue box in the diagram above. It’s a set of medical rules: Are there any danger signs? What are the main symptoms? What combination of these symptoms are there? What is the age of the child? How long have they been ill? Depending on the outcome of the rules, go to the next set (the pink / yellow /green) boxes and apply the rules that you find there.

That’s Rules and RuleFlow.

  • Rules are ‘when something is present , then do this’. And not just single rules, but many of them. Together, loads of simple rules allow you to come up with quite a sophisticated diagnosis.
  • Ruleflow allows you to group your rules. If you’re a health worker with a sick child you want to do the most important checks first. Depending on the outcome, you then apply the next set of medical rules: Pink if they need urgent referral to the hospital, yellow if the clinic can cope , or green if the child can be looked after at home.

As gory as it sounds, everybody, including the doctors, are happy that their ‘brains have been put into a PC‘ (or in this case , a set of paper cards). The Doctors are happy because they can (guilt free) move to better paying jobs. The medical workers using the system are happy because they can help the sick children that they see every day. And the children gain because the better availability of medical knowledge (via Rules and RuleFlow) is literally the difference between life and death.

Business Rules (Drools), Workflow (jBPM) and Seam – anybody want a training session?

Update: The presentation to the Irish Java Technologies Conference: Life and Death Workflow, using JBoss jBPM is partly based on this training session. (Link to Slides)

We’ve given Enterprise Java Training, Struts 2 Training (the most widely used Java-Web framework), and now it’s the turn of JBoss Rules (Drools) , Workflow (jBPM) and Seam. A lot of the material is coming from the forthcoming Masters Dissertation on Enterprise Web 2.0.

The course (summary below) is a private session. If there’s enough interest I’ll setup a public training session, or cut it back to 1 hour and do it as a ‘free’ intro session. If you can’t wait for that, Mark Proctor’s blog has a lot of useful rules information, and Tim Shadel has the pdf of a presentation that he gave in Phoenix Arizon on his blog.

Knowledge and Process Management

JBoss Rules, jBPM and Seam

Executive Briefing

Description: Success or failure in your business depends on dealing with information faster and better than your competitors. This briefing shows you how the JBoss Business Stack (Rules , jBPM and Seam) can do this and how to apply it to your organisation. Crucially, the briefing shows you when not to use these and details the alternative approaches.

The briefing will give delegates an overview of JBoss Rules within a web / enterprise development environment, how to architect an distribute rules within multi-tier applications and how to link these components with existing sources of information using Enterprise Application Integration (EAI).

Audience: This Briefing is suitable for IT Managers and Directors, IT project managers and technical staff who need an insight into the latest JBoss technologies and business processes, and business managers who need to be aware of the new application models and to give buy-in and commitment to applications developed within it.

Duration: Half-day

Objectives: On completion of this Briefing, delegates will:

  • Understand the benefits JBoss technologies offers your business and the key areas where it should be used.
  • Know how to successfully use JBoss Rules, jBPM and Seam with new and existing systems and technologies, including the use of Enterprise Application Integration (EAI).
  • Be able to boost projects using pre-built components and frameworks and be able to choose the right one for their needs.
  • Be aware of the main precepts of good application design within the Java component framework, as well as knowing the main Enterprise Java architecture components, terminology and acronyms and their interaction.
  • Understand how end-to-end applications are built using the JBoss frameworks (Rules, jBPM, Seam) and appreciate their organisational impact.

Presenter Biography

Paul Browne has 13 years experience delivering IT Projects in the Financial, IT/ Telecoms, Pharmaceutical and Public sectors. An author on JBoss Rules for O’Reilly Books, he has delivered courses for Limerick Institute of Technology, Siemens, Dell, Trigraph and IACT. Holding a Degree in Business from UUC, he is awaiting conferral of an Msc. in Advanced Software Engineering from UCD.

Briefing Content

Introduction and Problem Space

  • Delegate introduction
  • Trainer introduction
  • Course introduction
  • The problem we are trying to solve
  • Who is JBoss
  • 3 Tier Applications
  • What is a rule engine
  • Alternatives using Java
  • Alternatives to Rules
  • Alternative Rule Engines
  • Section Summary / Intro to next section

Rule Engine overview

    • Business Rules (examples)
    • Sample Business Uses
    • If then statements – can we do better?
    • Rete Algorithm
    • Forward and Backward Chaining
    • Domain Specific Languages (DSL)
    • Decision Tables (what the user sees)
    • Decision Tables (for the Developer)
    • Rule Editors
    • JBoss IDE (Red Hat Tools)
    • Advanced Rule Language
    • System Development Roles
    • Section Summary / Intro to next section

    Integration and Deployment

    • Web environment
    • 3 Tier system
    • Integration with Spring
    • Integration with EJB
    • What is workflow
    • What is jBPM
    • What is Seam
    • Seam and JSF
    • Seam and jBPM
    • Drools.Net
    • Section Summary
    • Course Summary and Feedback

Enterprise Web 2 Book – latest chapters (workflow,rules,search)

This an in progress draft of ‘Financial knowledge capture using Rules , Workflow, Search and Enterprise Web 2.0‘, complimenting the Red-Piranha Open Software project.


Chapter 1 – Introductionnotes

Chapter 2 – Problem Domain good draft

Chapter 3 – Red – Piranha Framework good draft

Chapter 4 – Technical Overviewdraft [new]

Chapter 5 – Financial Workflowdraft [new]

Chapter 6 – Financial Calculator and Business Rulesdraft [new]

Chapter 7 – Adaptive Searchgood draft [new]

Chapter 8 – Future Work and Conclusionnotes

Chapter 9 – Appendicesnotes


Your favourite colour – what should be in our new web site design?

Thanks to Eoghan, there are going to be some changes around here. He’s just announced that we’re the winner of the 2000 Euro worth of web design work. For a sample of his work , check out the redesign that he has done of the Barcamp Dublin site.

I actually tried to convince Eoghan to pick somebody else with even more readers (in a mercenary get some more exposure kind of way). He’s sticking with the person choosen by his random number omiter.
Winner

So the question is, What’s your favourite colour? What part of this website do you think needs an upgrade – this blog, the main FirstPartners.net ‘Corporate site’, or the wiki / knowledgebase? What changes do you think should be made?Or should I save the prize for the forthcoming mad, take over the world attempt part 2 (Red Piranha)?

Further Kudos to Eoghan for carrying out some Charity work as well: tuppenceworth.ie, entered by Simon McGarr, the other is a project by IQ Content for the Red Door School, entered by Laurence Veale

Masters / Msc in Web 2?

This post was originally titled ‘Readers Wives Questions’

Mike from Galway writes …

I read your blog regularly so I thought you might have
some insight to a specific topic i’m currently researching in GMIT,
Galway. My current research title is “An Evaluation of the Uses of
Object-Oriented Web Application Frameworks in the Irish Services
Sector”. This basically involves examining the usages of web
technology, services and SOA in service companies, such as [name]
Insurance

I’m in the process of doing a masters myself and I still haven’t got a final title for the dissertation! There are a couple of areas that I think are worth covering:

  • Does innovation stop at the firewall? How are the raft of publically available Web2 / SOA innovations going to be adopted by business?
  • Is SOA too complicated? Why has Google moved from SOAP to a more simple (but still XML-Web based) API?
  • Is Security scaring people off? Do current security solutions (based on simple human based web interactions) cut it with the more complex machine based transactions?
  • Is it a ‘Winner Takes all’? Connecting to a web service takes time and (some) money. Will there be a series of ‘mini microsofts’ in each sector, with nobody willing to (spend money) to connect to the company in 2nd place?
  • Do Business people know (or need to know) what SOA is? What is the ‘killer application’ that we have them knocking at the IT department’s door to do an implementation.
  • Are the skills widely available to do SOA / Web Services implementations? What are the preferred technologies to use?

Anybody else have any suggestions? I’m guessing that Mike would be very interested in hearing from Irish companies currently doing an SOA implementation. Email me at PaulB [at-sign] firstpartners.net , and I’ll pass any contact details onto him. Otherwise, just leave a comment!