-
Get a monthly update on best practices for delivering successful software.
Last week I presented at Agile 2009 a workshop for those new to Agile entitled: The Agile Game: An Experiential Workshop. I love this workshop because it allows those new to Agile to experience the rhythm of an agile project in action and learn first hand many of the practices in a non-threatening, non-technical, and fun way. I have used this workshop for clients a number of times and it works. The feedback from this session was overwhelmingly positive too. Comments such as, “Fun game, good to demonstrate how teams do and don’t work together” and “Very, very, practical way to get concept through” are always great to see.
Recently I had been wondering if Project Management was a questionable career choice. I have spent the last couple of years surrounded by talented individuals who seemed to be able to work fine without me. The test is always when the project manager (me) goes on vacation. Has the team fallen apart? Are they forgetting all of the practices they were doing? Is stuff getting delivered to clients? I was finding that I had a backlog of chores when I came back, but overall things were still humming along.
Although I’ve seen so many players rise and fall over the years, what has inspired this post is the irony of what is happening to Microsoft. In the early years of my technology career it was Microsoft’s ownership of the PC O/S market that primarily allowed other compatible hardware manufacturers to create innovation and eventually marginalize IBM’s dominance of that market.
In the early years of PCs, the applications on top of the O/S weren’t even Microsoft applications. It was only later that Microsoft started developing their own applications and with them the predatory practice of squeezing out other application providers to rule the desktop.
I recently had an issue in flex where I needed the click event for a component in an ItemRenderer to not bubble up to the parent list. Since the click event was being dispatched by Flex SDK code, I could not directly do this by passing false into the event's constructor. I had hoped to find a property I could set on the object, something like "clickBubbles", which I could set which would accomplish this.
Either that property doesn't exist or I could not find it. My solution was to basically hijack the event and send an impersonator in its place.

I've been spending some time with our internal sales and marketing team to hash out some of our goals for the year, and it became quite clear to me that non-developers are on their computers all day long facing some of the same technical challenges we do.
Some of the tasks they have to do:
So I've resolved to take some time each week to 'Adopt a non-techie', and help them spend less time 'screwing around with the computer' and more time on the most valuable tasks they do.
In the same way that developers need to be as efficient as possible with the tools they use, Continue reading »
Topics: agile, google docs, imacros, neal ford, nfjs, Pair Programming, portableapps, productive programer, regex, regular expressions, Selenium, ubuntu, xp
I've used the ILog Business Rules products on a number of projects. Reasonable software. Does the job. Not exactly cheap. I'm not sure why they went for the aquisition by IBM -- it was announced back at the end of July, so likely nothing to do with hard economic times.
What does this mean for software developers and system integrators? Back when the aquisition plans were first announced, I joked that we would soon be using WebSphere rules. And wouldn't you know it, the aquisition announcement mentions ILog and WebSphere in the same sentence several times.
Topics: Business Rules Engines, IBM, ILog, ILOG JRules, Oracle
If you read one or more of the Pathfinder blogs in our web interface, you may have noticed some tweaks to our navigation and top-level categories. Our goal in making these changes was to help different audiences drill down to the specific content that interests them. Instead of just a few top-level categories, we now boast around 20, though many posts appear in multiple categories. To subscribe via RSS to any specific category - or to our entire feed - just visit our Feeds page.
Topics: news
JBoss Rules (the former "Drools," though it's sad to see that cringe-inducing name making a comeback) is a Business Rules Engine (BRE). Those are the logic engines that allow you to execute a large set of "if-then" rules against a large set of facts (the most common algorithm to achieve this kind of performance is called RETE, from the ancient Greek for "net"). For more on BRE's and how to use them, have a look at our Business Rules blog.
One of the things that has differentiated commercial BRE's like Blaze Advisor and ILOG JRules from the Open Source JBoss Rules is the tools. The commercial BRE's were part of a suite of development and management tools -- IDE's, "natural" language support, Business Rules Management Systems (BRMS) -- that made their use in a corporate IT "ecosystem" much easier.
With version 4 of JBoss Rules, you now get a powerful workbench plugin for Eclipse, support for Domain Specific Languages (DSL) that mimick natural language, and a web-based BRMS. With it you can deploy, roll back, and report on your rules.
The BRMS has a nice Ajax interface and is in fact written in GWT. This is a natural for a Java-based system like JBoss Rules. If the developers who use and develop JBoss Rules can also tinker with the BRMS interface (GWT==Java in the browser), the odds are better that the BRMS will evolve apace with the core system.
Compare this with a framework like Echo2/3 where there is only a small cadre of developers who develop the JavaScript piece of what is essentially a Java centric framework, and consequently the development has lagged relative to other frameworks. So, good decision for JBoss Rules and probably a good decision if you are adding a web interface to your own Java system.
Topics: Blaze Advisor, Business Rules Engines, GWT, ILOG JRules, RETE
After laboring away on Typepad because it was easy and, frankly, we had more important things to do, we have finally made the move to our own in-house blog. It now sits under the web site at http://www.pathf.com/blogs/ and combines our various blogs -- Agile Ajax, UXD, Business Rules and Techdev. You can still access all of the sub-blogs individually through their feeds and category pages.
If you run into any issues (which I'm sure you will, given the contortions we had to go through to deal with Typepad's funky url's), drop us a line at info@pathf.com.
Topics: Announcement
As Rails (and Ruby) climbs the hype curve, more and more systems are getting implemented that could benefit from a BRE. There are two (Rools and SIE) that don't use RETE. But Ruleby does, though it is in version 0.1 now. I'll post a couple of examples in it in the next couple of weeks.
Technorati Tags: bre, ruby, rails, rete, rools, SIE, Ruleby
Topics: Business Rules Engines, RETE
In explaining this pattern, I wanted to take a step back and explain where and how OO and BRE's intersect. To start with, this excellent post over at Mark Proctor's blog makes the following statement:
Assert all your objects as facts: Rule engines usually know how to handle a fairly heavy load of facts, so let the engine do its magic. If you want to reason over a nested set of objects, assert all of them (not only the top level ones) into the engine and make sure your business model models the relationship between them. After that, writing your rules will be easier and the engine will be able to optimize execution (when compared to using eval and other constructs to access deeply nested structures). Example: if you have an Order fact that contains a list of OrderItems, assert both Order and OrdemItems as facts (if you need to reason over OrderItems too, obviously).
Why, by all that is object oriented, do you have to turn your domain model inside out, exposing what was hidden, unencapsulating what was encapsulated? Isn't this defeating the purpose of object orientation? The answer is, in short, yes. You are defeating the purpose of OO when you expose the innards of your model to the BRE. But it is a tradeoff. You get something for your trouble. Specifically, you get the super efficient rule matching of RETE and it's decendents.
This sort of exploding of the object model happens all the time in systems, and it isn't necessarily always bad. Alen Hollub (author of Why getter and setter methods are evil and other Edsger Dijkstra-like articles) has identified the "procedural boundary layer" and explains it nicely in his book Holub on Patterns: Learning Design Patterns by Looking at Code:
One big exception exists to the no-getter-or-setter rule. I think of all OO systems as having a "procedural boundary layer." The vast majority of OO programs run on procedural operating systems and talk to procedural databases, for example. The interfaces to these external procedural subsystems are by their nature generic. The designer of JDBC hasn't a clue about what you'll be doing with the database, so the class design has to be unfocused and highly flexible. UI-builder classes such as Java's Swing library are another example of a "boundary-layer" library. The designers of Swing can't have any idea about how their classes will be used; they're too generic. Normally, it would be a bad thing to build lots of flexibility that you didn't use because it increases development time. Nonetheless, the extra flexibility is unavoidable in these boundary APIs, so the boundary-layer classes are loaded with accessor and mutator methods. The designers really have no choice.
BRE's are not OO. Yes, the facts can be viewed as objects and the BRE's can be implemented using and OO language and design, but really the internal working of the BRE are most definitely not OO, the more the rule engine knows about each and every object and its innards, the more efficient it can be. Thus the PBL (procedural boundary layer) applies.
As an example why you need to expose all object, consider an order that is made up of line items.
public interface Order {
[...]
void addItem(OrderLineItem item);
boolean removeItem(OrderLineItem item);
[...]
}
Now normally you would hide the details of all the line items inside the class that implements the Order interface. Let's suppose now that we haven't added any of the encapsulated line items to the working memory of the BRE's, just the order. Now let's say we update one of the line items through an operation. The only way we have to telling the BRE that something has changes is by flagging the enclosing Order object. That will trigger a reevaluation of every rule in which the Order plays a part, even ones where the line items play no part.
There are all sorts of ways of dealing with exposing the internals of your domain model to the BRE without breaking encapsulation. One way is to implement both the business interface and a bean interface (getters, setters, etc.) in the implementation (see diagram). The business interface is used within the domain model, the bean interface in the BRE.
Another approach is to wrap the domain objects in bean containers that access the private instance variables through reflection.
Of course lots of this depends on the specific BRE you are using. Some require you to expose your instance variables directly and don't deal well with method calls. I'd suggest not using those.
Next time I'll go through a simple example using JBoss Rules showing how to convert a domain model to a Collaboration Cop rule base.
Topics: Business Rules Engines, Patterns
While JBoss Rules 3.0.x has been a great step from its predecessor (the unfortunately named Drools) -- providing a rule editing environment, universal and existential quantifiers (the "not" A is the same as "for all" ~A), and Domain Specific Languages (DSL's) -- there were still a few things missing. I've watched the progress on 3.1 with barely contained excitement and impatience, but the result has been worth the wait. The 3.1 M1 drop contains operations on collections:
rule "Find interesting crash events, with 10 or more port scans within a 1 day window" when $crash : OutageEvent( eventType == OutageEvent.SERVER_CRASH) ArrayList( size > 9) from collect ( HackEvent(hackType == HackEvent.PORT_SCAN, $date : eventDate -> (DateHelper.withinDayWindow($crash.getEventDate(), $date, 1)))) then suspicious.add($crash); end
There is also the accumulate operator, which is even more powerful than the collect operator. The documentation has lagged a little behind (it isn't a full on release, after all), but you can see some examples of it's use here. I find that I use these sorts of collection operations quite a bit. That being said, the above rule isn't terribly efficient. If you have about 50 of those rules and lots of events of both categories, you will run into some cross-product hell (sort of like a poorly thought out database join). I'll show some ways of making this sort of rule more efficient in an upcoming entry.
Finally, the system now in theory allows better debugging of rulesets. The various views into the working memory have been around for a while. See below for some of my issues.
A few nits that I'm sure the JBoss Rules team will work out:
The best thing about this latest version of JBoss Rules is, of course, that I can now start developing non-trivial examples and publishing them without having to constantly caveat that "this feature is present in Blaze and ILog, but not here." An even more interesting question is this: since JBoss Rules is getting close on being a reasonable alternative to some of the commercial products, will what happened in the database arena with mySQL also happen in the BRE arena? Will costs come down, interoperability increase? Will the commercial vendors concentrate on service, support and high end features? Will these same vendors become more open and share more information with the public? I don't think BRE's will ever be as widespread as RDBMS's, but I think the same dynamics might apply.
Some things to look forward to that I hope the JBoss Rules team is thinking about: rule management, specifically rule repositories and deployment management, e.g. revision control for rule sets and deployment of rule modifications to distributed, live production engines; Rule analytics, e.g. analysis of a rule set to see if it contains likely problems (infinite loops, possibly bad logic, etc.), and stats on actual rule execution, performance, etc.
Topics: Business Rules Engines, Drools, JBoss Rules
The pattern I'm writing about today -- Collaboration Cop -- is much meatier than the two previous ones, in my opinion. This one is all about transplanting the implicit and explicit business rules of an OO system from its objects to an external BRE.
This is a somewhat involved pattern, and I'll provide some more examples and references in part II. Also in part II, I'll run down the differences between the rule classifications that come out this pattern and the ones you commonly see in works by Ross.
Pattern Name: Collaboration Cop
Synopsis
Extract the business logic that is in an OO domain model -- collaboration rules, property rules and controller logic -- and express it as a set of business rules. Activity in the system is triggered by the UI inserting events into the working memory and firing the rules. Objects can be persisted by something like and ORM framework.
Slightly longer version: if you strip away the user interface and the persistence mechamism, a typical OO application is designed around a domain model and controller or service classes that set object collaborations within the domain model in motion in response to external events. The methods of the controller/service classes often correspond to steps in a Use Case. Embedded in the various domain classes is logic about how object can be modified and accessed, what collaborations can be created or desolved, etc. With this pattern, you extract all the service/controller and validation and collaboration logic into business rules. You populate the working memory with the objects that comprise the context for a Use Case. Finally, in response to an external event, you inject an event object into the working memory and fire the rules that modify the state of the object model (and persist it).
Context
Take the somewhat simplified Use Case where a customer is trying to rent a tape (he's a sucker for punishment and doesn't like DVD's). In a OO system, we would try to create a collaboration as follows (yes, very simplified):
customer.addRental(new Rental(title.getTape()));
The customer object knows how many active rentals a customer has and knows hat he cannot have more than three. This attempted collaboration would throw an exception to indicate that it is not permitted.
In the Collaboration Cop version we would create an event and insert it into the working memory:
VideoStoreEvent event = new VideoStoreEvent();
event.type = VideoStoreEvent.RENT_TAPE;
event.value = "Gone With the Wind";
IF event.type == VideoStoreEvent.RENT_TAPE AND title.getTitle() == event.value AND title.isInStock()
AND customer.activeRentals() < 3
THEN
customer.addRental(new Rental(title.getTape()));
externalObjectSet.add(customer);
externalResponse.message = "Rented tape.";
externalResponse.success = true;
ELSE
externalResponse.message = "Unable to rent tape.";
externalResponse.success = false;
You can wrap a transaction around the sequence of event injections, then save (using an ORM) all of the modified objects in the externalObjectSet.
-----------
This pattern is complex and powerful, and it's implementation is very much dependent on the capabilities of the chosen BRE, how you choose to deal with concurrency, etc.. In part II, I'll also construct a simple example using JBoss Rules.
Topics: Business Rules Engines, Patterns
It's been a busy month that has taken me away from focusing on Business Rules, but things are almost back to normal and I should have another entry on BRE patterns out this coming week. In the meantime, I thought I'd share with you two interesting resources that I came across recently.
The first is Pychinko, a native Python RETE-based business rule engine. This points out that Java, C# and C are not the only languages that can benefit from a business rules approach. In fact, as you'll see in my next BRE patterns entry, I'd argue that object orientation and business rules are a natural fit, regardless of the specific language used. If your requirements call for any sort of embedded scripting, this solution might be worth considering.
I'm experimenting with a new way of finding resources on the Internet. With this new method, I was able to find the second item, a thorough introduction to business rules and RETE over at InfoQ, entitled Real-World Rule Engines. The article covers quite a bit of territory. Among the topics addressed are:
Definitely a good resource for those wanting to get started with business rules engines.
Last, I wanted to pass on the news that James Taylor has moved his blog over to a new url: http://www.edmblog.com/weblog. If you are a regular reader of his blog, you already probably know this. If you aren't a regular reader of his blog, you really should be.
Topics: RETE
The guys over at JBoss Rules are starting to build a little community of practice over in their Wiki.
There's a ton of good stuff over there, including a link to this tutorial by
Topics: Drools, JBoss Rules, Patterns
I have to apologize in advance. I'm in the middle of squeezing out a book chapter and haven't had time to tackle any of the BRE articles on my writing TODO list. So today I'm going to have to do what I usually hate to do -- become a blog echo chamber. The post I want to alert you to is one posted almost a year ago by Charles Young, entitled Microsoft's Rule Engine Scalability Results - A comparison with Jess and Drools. The article claims to show that Microsoft's BRE cannot be criticized about not implementing RETE properly based on MS's published test results. That's a long way to go for such an ephemeral point.
I don't recommend the article because of the claims it makes, but rather because it both demonstrates the use of three different BRE's through actual code samples, and it provides an approach to benchmarking and comparing BRE's for scalability and performance. I'm a firm believer in benchmarking BRE's based on your actual use cases rather than on abstract worst-case scenarios like Miss Manners. Read through this blog entry. Even if his approach is flawed, as I believe it is, he deserves full credit for publishing the full code to his test and opening it up to public scrutiny.
Topics: Benchmarking, Business Rules Engines, Drools, JBoss Rules, Jess