Greeting, happy holidays and Merry Christmas everyone!
Yesterday a co-worker and I were having a discussion about storing business logic outside of the business objects in a way such that others (not necessarily programmers) would be able to edit it. I would like to get some feedback from you all.
The idea as is stands would be to store a record in a database table for each business rule with a structure something like this.
BusinessObjectName, StringForBusinessRule, DescriptionOfRule, LastUpdateDate.
Now, StringForBusinessRule would be something specific to the object at hand so pretend I have an Order_EditableRoot. The DescriptionOfRule would read something like "Is Order Valid For Processing" and the StringForBusinessRule would be something like "if(Order_EditableRoot.Details.Count > 0 && Order_EditableRoot.ToAddress.IsValid && Order_EditableRoot.FromAddress.IsValid".
The idea is that we would load these rules at runtime using something like Spring.Net.
My co-worker sees this as a good thing as it could free the developer from any responsibility when business rules change because then the people changing the rule can affect the program directly.
I see this as a great way to complete disable our servers, put the company at great risk and in general make me have to work nights, weekends and holidays. However, just because I'm opposed to something doesn't mean it's wrong, I just may not fully understand the potential. So, now it's your turn to chime in with pros or cons.
Much appreciated!
Will
Thanks for the replies and sorry for my delay in responding. Holidays were hectic.
Well, a lot of good points were brought up and to answer a couple.
No, I don't trust the end users, but I'm not the person advocating this approach, I'm actually against it.
The changing of field lengths is not an intended use for these business rules. Those rules are generally derived from the database through code generation. However, as you mention, the possibility exists that someone will write code to do this and we won't know until it breaks.
Also the possibility that someone will abuse the system since we would essentially be giving them access to a compiler with a direct line to a production environment. How hard would it be to write a "business rule" that shells out another executable on the server or does any number of malicious actions.
The only reason this is being considered is because we work in an environment where a product is promised for a date, say January 1, 2009 and it's not until December 31st that some of the business rules are nailed down. In fact, some rules aren't figured out until well after the product is launched; so I have a guy here who wants to empower the end users with this and take the burden off of us. I just happen to think it's a vision of grandeur with tons of potential pitfalls.
I will try to sway him from tis train of thought if at all possible.
Thanks for all the replies.
Will
Copyright (c) Marimer LLC