[rules-users] Better Performance and Maintainability?

Scott Embler Scott.Embler at noaa.gov
Mon Jan 25 11:22:46 EST 2010


I think you've basically answered your own question.  POJOs that 
contains simple property getters and setters will always be faster than 
a hash lookup.  They would also be smaller in size, assuming you avoid 
complicated reference hierarchies, because hash maps create container 
objects behind the scene.  POJOs also help avoid the need to convert 
objects to specific types.  Lastly, if a POJO is more likely to be 
maintainable because your java and drools compiler can tell you when 
you've made a mistake, but a compiler cannot check for the correct key 
or value of a hash map.

HonorGod wrote:
> Hi,
>
> Can someone plz help me understand performance and maintainability in the
> following scenario - ?
>
> I load tons of rows of data from database and store them in an object fact
> model [POJO based] and apply the rules using decision tables and finally
> persist data.
>
> vs
>
> I load tons of rows of data from database and store them in an object fact
> model [HashMap - Key - Value] and apply the rules using decision tables and
> finally persist data.
>
> The difference in the above two scenarios is that one of them is pojo based
> and the other is key-value pairs that are used on LHS of the decision
> tables. When I use Key-Value approach I had to do lot of conversion in terms
> converting the conditions into eval statements and validations but where as
> the pojo approach is very straight forward and less validations.
>
> Which approach gives me better performance and maintainability?
>
> I would consider the following before I make a decision - 
>
> 1 - size of data
> 2 - frequency at which the data changes [in terms of adding new conditions /
> adding new columns / removal of new columns etc]
> 3 - re-usability
>
> Thank You!
>
>   


-- 
Scott Embler
Software Engineer, ERT Inc., Government Contractor
Climate Monitoring Branch
National Climatic Data Center
151 Patton Ave.
Asheville, NC 28801-5001
scott.embler at noaa.gov
(828)350-2027




More information about the rules-users mailing list