Archive for category Book Reviews
Drools JBoss Rules 5.0 Developer’s Guide – Book Review
Posted by Dan Hayes in Book Reviews on December 4, 2009
Drools has come a long way over the past 5 years. Mark Proctor and his team at JBoss have really done an outstanding job bringing Drools up to enterprise grade and making this technology more accessible to the mainstream development community. When I was doing hard core rules development projects using Blaze Advisor (now part of Fair Isaac) and ILOG JRules (now part of IBM) it always bothered me that this technology was way out of reach for most companies due to cost. It seemed ILOG and Blaze/Fair Isaac had become comfortable with an oligopoly and significant price competition was unofficially avoided. The market needed a high quality, low cost competitor to shake things up.
Unfortunately, the open source rules engine space was still very immature. Jess (which was technically not “open source”) was somewhat “academic” with more of a command line orientation and little, if any, tooling. Drools was promising, but it clearly lacked the features that would make it a realistic competitor to commercial solutions. That all started to change in 2005 when Drools was “federated” to JBoss.
Just about when JBoss acquired the development roadmap, version 2.0 of Drools was released. This release dramatically improved performance as it was based upon the popular RETE pattern matching algorithm. Unfortunately, the rules were still authored by hand in XML which was a real deficiency compared to commercial offerings. I found this out first hand when I was doing a small consulting project for Jackson National Life Insurance and conducting impromptu developer training sessions.
Drools is now on version 5 and it has really come a long way. Drools has a solid underlying architecture, clean API, authoring platform, Eclipse-based tooling, rule flow support, decision tables, CEP (Complex Event Processing), and Rule Repository management. If you so desire, you can buy enterprise support from JBoss. I can honestly say that Drools is ready to compete with the big boys.
The presence of this book from PACKT Publishing is a sign that Drools is gaining market share and awareness. The book is well timed and current (it is based upon Drools 5.0). There is another book on Drools called JBoss Drools Business Rules from the same publisher that appears to be geared toward Business Analysts and/or Rule Authors. I have not read that book, but this one is clearly targeted at developers.
Author Michal Bali does an excellent job on this book, in my opinion. He covers most relevant topics in detail, with the exception of Drools Guvnor (a BRMS that is touched upon briefly in Chapter 10, Testing). In the early Chapters, Michal covers some of the basics including “why business rules” and the basics of setup and creating your first rule/execution. My only complaint here is that not enough consideration is given to the key concepts behind rules engines. Things like pattern matching, agenda, refraction, etc. While most of these topics are covered in spots throughout the remainder of the book (including Chapter 12, Performance), I think it would have been a good idea to layout some of the concepts here along with Drools API equivalent. Perhaps a simple explanation of what is actually happening in the Drools Expert when you “fire all rules”.
Over the next couple of chapters, Michal goes into further detail by developing use cases for a banking domain and data transformation. The banking domain setup is also extended later in the book to introduce more complicated concepts. I have to admit that I breezed over the data transformation chapter as I am used to other, simpler approaches to data transformation, usually leveraging purpose built tools. The banking domain model example was pretty good, although I don’t know that I would have modeled the problem in quite the same way. The author’s approach drove me to think too much about the objects involved in the solution rather than focusing on the point of the book – the interaction with Drools. This was a minor issue and ultimately Drools was introduced adequately.
Next, Michal covers the Domain Specific Language capabilities, Decision Tables and introduces Rule Flow. I found it interesting that Michal chose to introduce Decision Tables and Rule Flow in the same chapter as DSL. I thought DSL could have been covered in its own chapter. The same could have been said for Decision Tables. No big deal. Everything was explained clearly. In particular, I thought the Decision Table coverage was solid. It cleared up some confusion I had in a couple of areas.
As we get into the middle chapters, we start getting more advanced. Logical assertions and stateful rule sessions are covered along with serialization techniques. Many readers will not have to deal with difficult serialization issues until scalability becomes an issue. This could have been covered in a later chapter on performance tuning and advanced topics. Chapter 7 covers Drools Fusion, the temporal and event based (CEP) capabilities of Drools. Let me warn you. At this point the content starts to get a little “heady”. Many readers will get lost about now. I wouldn’t let it get you bogged down though. Rules engines can be very valuable in isolating rules without even getting into CEP (for most businesses).
After more detailed coverage of Ruleflow in Chapter 8, a sample application is presented in Chapter 9. Kudos for choosing common platforms (Spring) and persistence APIs (JPA). Frankly, this is what most contemporary Java Enterprise application developers will be dealing with anyway. I also applaud Michal’s usage of previous examples to keep from introducing yet another domain problem. In this way, the Chapter can focus on incorporating the Drools technologies into a conventional web application. I didn’t attempt to run all the code but it did look thoroughly explained.
Chapters 10, 11, and 12 go into Testing, further integration with Spring and build tools like Ant and a deeper dive into the rule engine (for performance tuning, etc.). In the last chapter, there is a much greater explanation of how rules engines work. As I said earlier, perhaps a simplified introduction could have been incorporated early in the book for a context. This would have left Chapter 12 to focus on strictly performance tuning and higher end concepts. Nonetheless, Michal clearly knows what he is talking about in these chapters and provides a solid reference for issues that may come up in production deployments.
Overall, author Michal Bali can be commended for producing a much needed, quality book on Drools. I believe it will help contribute to greater acceptance of Drools and rules engines in general. But be warned. Rules engines are not mainstream for a reason. The concepts can be difficult to absorb as most people (including developers) don’t “think like a rules engine”. For some, this creates a blockage that will never be overcome. The “black box” nature of rule execution is too much for some organizations to handle. However, there is no doubt that certain problems can only be reasonably solved and managed with a rules engine. For those challenged with these problems, this book will help unlock the secrets of using Drools. RECOMMENDED.
Learning Rails – Book Review
Posted by Dan Hayes in Book Reviews on May 13, 2009
Okay, so I have to admit I am not entirely a Rails noob. I have built a couple of applications using Rails and continue to maintain an interest in its emergence in the enterprise. However, since Rails 2.x has come out, I’ve fallen a bit behind and needed a quick refresher. Learning Rails, by Simon St. Laurent and Edd Dumbill seemed to be a good candidate. It didn’t disappoint.
Learning Rails is an excellent book for quickly picking up the nuances of Rails, especially if you are looking for something that is an easy read and is based upon Rails 2.x+. The chapters are relatively short and the authors do an excellent job of knowing how far to push a concept before deferring (referring) to alternate texts for more information. Nonetheless, I picked up a few new tidbits along the way, including some practical suggestions for dealing with nested resources and a couple of ideas for routing. However, make no mistake about it, this is not an advanced Rails text. For more detail, I would look into Obie Fernandez’ excellent “Rails Way” or the myriad of books on specific topics such as AJAX, Active Record, etc.
What could have been better? I thought the chapter on AJAX was a bit weak. The example code didn’t seem as elegant as you may expect from a Rails purest. Also, there was not much coverage on the concept of layouts and how the location of the various view pages relate to MVC routing, etc. I suspect even the most inexperienced Rails developer will quickly embrace the idea of layouts and partials (which were covered to some extent in the forms section). Finally, there was not much mention of some of the newer features such as localization (probably more of an enterprise feature anyway).
One thing the author cautioned is that the book is written from the “outside in”. In the preface, this was clarified to mean that the approach taken in this book was to present it from more of a traditional web developer’s perspective rather than, say, an enterprise application developer’s perspective. It was cautioned that certain readers may be turned off by this approach. I suspect that I am likely in the category of enterprise developer since I do think in terms of MVC architectures, etc. My background is NOT in building simple scripted PHP web apps for low budget clients. However, I was NOT turned off by the approach. I thought everything was explained nicely and accurately, regardless of the audience. So for you Enterprise Java purists out there, don’t be put off by the subtitle.
This book is highly recommended for those just starting out in Rails.
Pro Flex on Spring – Book Review
Posted by Dan Hayes in Book Reviews on May 1, 2009
I just finished reading Pro Flex on Spring by Chris Giametta (APress). Unfortunately, I can’t bring myself to recommend it. I really wanted to, as I am getting more into Flex and I have been a Spring evangelist since before it was called Spring. My primary concerns center around organization and approach to the example application. I believe these things get in the way of presenting the core concepts.
The book starts off with the obligatory chapter on RIA and introduction to Flex and Spring. This is likely necessary to provide a context. Chris then proceeds to spend a chapter developing a lengthy project plan for the application to be developed throughout the book. This includes project objectives, wireframes, etc. I didn’t mind the chapter except that I was ready to launch into construction at this point. Hold your horses. First there is a chapter on exploring the various tools and means for developing Flex/Spring apps. At the end of the chapter there is a rather awkward lesson on creating 3 different Eclipse projects to hold the client, server (Spring/Hibernate), and library projects. They are rather oddly named but that is a personal preference. Okay now we should be ready to start.
Not quite. There are another 6 or 7 chapters to endure first, including another introduction to Flex applications (am I supposed to be adding these snippets/examples to the projects I just created?). The Flex deep dive gets off on some tangents that I believe would be best left for later. For example, diving into graphic manipulation (Matrix, Graphics, etc.) and skinning at this point is a little premature. I would have focused on the basics, perhaps demonstrating the technique of custom components by overriding a behavior or creating a component that combines a couple of UI widgets. So I am typing along, not knowing if this stuff is going to be used down the line or not, or where the heck I should be saving it.
Next is a chapter on Spring. Again, nothing wrong with Chris’ description. Unfortunately, he starts creating sample applications again. I am typing away thinking this somehow all ties together and if I quit now, I’ll only have to come back later. I don’t have any issues with his use of Spring in the examples, it’s just hard to cover the concepts in such limited space much less try to create a sample multi-tiered application within the same chapter. Again, I would have stuck to explaining the concepts and left the detailed code for the sample application (which I presume we will get to at some point).
Moving right along, we dive into Flex and Spring Integration Architecture. Now we are getting somewhere. This is probably one of the more valuable chapters in the book although I probably could have done without another example (RSS feed reader). Chris does a good job explaining the various means for interacting with the server side. He also includes a nice description of the Spring BlazeDS integration project designed to help simplify the configuration.
Chris then digs into Cairngorm and PureMVC, taking the opportunity to introduce yet another sample application – the Contact Manager. Again, I love examples. However, trying to introduce so many unrelated sample applications throughout the book draws attention away from the overall concepts. There is too much space wasted describing code required to make each example work. After all, once you dive into an example application you have to provide the complete code base or that will create other frustrations.
Chapter 8 is on Data Persistence and Chris feels obligated to describe (with examples) each technology that may be used to access data (iBatis, Spring JDBC, Hibernate, Hibernate with annotations, etc).
Chapter 9 is on Security and this was pretty nice as it focused on Flex integration with Spring Security. However, it did not mention the Spring BlazeDS Integration project and how it helps simplify the communication between Flex and Spring Security. Also, I don’t believe he needed to get as detailed on the implementation of the authentication example. There are simple pre-defined beans in the Spring Security library for facilitating authorization against an in-memory or persistent user directory. Perhaps those would have been adequate enough to explain the concepts.
In Chapter 10 we finally get around to the sample application set up in Chapter 2. The remaining chapters deal with building out various aspects of the example, including the database model, Spring Service tier, presentation, etc. I would say that Chris’ strength appears to be in the presentation tier with Flex/ActionScript. I’m not crazy about some of his design patterns/strategies on the server side. In particular, I have to admit that I never quite embraced his “object identifier” concepts and use of an “assocobjectID” field on every entity table. It seemed obtuse and non-descriptive. I’ve never seen this used in practice. I much prefer for green field projects to stay with conventions such as “id” or “xxxx_id” for the primary key and “xxxx_id” for the foreign key fields in many to one relationships. Anyway, I am picking at straws here.
The bottom line is that I am happy to start seeing books on Flex as an enterprise application technology. Unfortunately, this one makes it a little hard to get to the meat of the content. If you are thirsting for any content on the subject, I would pick up a copy. However, I would focus on reading through it rather than trying to work the examples. You may get frustrated.

