Flexible Business Rules with Brick
By brian d foy (brian d foy) from NY.pm
Date: Sunday, 29 April 2007 10:00
Duration: 30 minutes
My main consulting work in 2007 is a (unreleased) module to represent business rules and allow programmers to join them in various ways. Most CPAN modules to do this proved inadequate because they based their work on input fields, making it difficult to validate data on out-of-band information or complex relationships. I created Brick (Business Rules in Closures, 'kay?)
A "brick" is just a business rule represented by a closure, for instance, the input date has to be before April 17. Each brick has access to all of the input data and can easily represent complex relationship without code acrobatics. Creating a brick puts it into the "bucket", after which the programmer can compose existing bricks to create larger rules, which are also bricks. Since everything is made of of small pieces, it's easy to show the user (or programmer) exactly what happened, or to explain a particular composition as text (and, future work includes going from that same text description back to code).