java - How to dynamically load strategies (Strategy Pattern)? -
my application have different strategies objects. best way implement that? ideally, dynamically load strategy implementations from, say, relational database. i'm not sure how that, though. what's best approach?
for instance, want apply strategy strategy123 object myobj: load object database, using id 123, deserialize it, strategy class, , use myobj.
this approach have issues when comes maintenance: while sounds easier @ first glance, can pain in long run, example if strategies' interfaces change.
what other solutions have? solution allows me keep strategy classes outside codebase, don't need modify code , re-deploy application if strategy changes, or if add new strategy.
you can implement strategy using rules engine drools or scripting language groovy , store these in database. can load these rules database @ runtime , apply on object.
Comments
Post a Comment