I am having trouble defining a software design proposal - I have been calling it "Rules Based Design" but when I look that up it doesn't really match what I am doing. So I want to know if the following already exists as a design pattern and if so which one or at least which one comes closest to what I am doing.
Essentially what I am proposing is creating a collection of small Java classes that perform business functions in an atomic manner. Then I create two tables Rule Set that is a collection of identifiers and filters that point to what I call Rules in another table. The Rules table is mostly just a FQCN that will be created via Java reflection to act on business data to perform the function defined in the filter table.
Let me give a very basic example:
Say I have a system that manages membership in multiple programs here is what the filter and rule table would look like for the "APPLY" function:
Rule Set
Function Program Rule Order
===========================================
Apply All 1 1
Apply PGM1 2 2
Rule
Rule Name FQCN
=========================================================
1 Duplicate Check com.rule.all.DuplicateCheck
2 PGM1 Eligibility com.rule.PGM1.EligiblityCheck
So when someone is on the "Apply for Membership" screen - which his the same screen for all programs - they select the program and I go to the Rule Set table looking for all Rules for the APPLY function that are for ALL programs or the specified program.
Then I loop through these FQCN creating an instance and passing a map of parameters captured on the APPLY screen. If no exception is thrown I move on to the next rule.
If I get through all the rules with no exceptions I move to the next screen.
Aucun commentaire:
Enregistrer un commentaire